Regarding Graphics and Performance?

Get help using Construct 2

Post » Tue Feb 11, 2014 11:47 pm

Hello ^^

Just some questions.

1)Does adding more objects to a layout reduce the performance of a game?
2)Does the speed you get during the runtime of your game in a browser, reflect how fast it's going to be when it's exported?
3)Are there any factors that might be causing my game to slow down?
B
8
Posts: 35
Reputation: 388

Post » Wed Feb 12, 2014 12:12 am

Hopefully this covers all your questions: https://www.scirra.com/manual/134/performance-tips
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,661

Post » Wed Feb 12, 2014 12:28 am

My brief experience with C2 has led me to deduce that the biggest resource hog are often the collisions. I've found you can drastically improve performance by:

Playing with the collision boundaries in the image editor until they are as small as you can get away with to function correctly.
A 32px square with collisions set to bounding box causes much more stress on the fps rate than the same square with the collision boundary set to (1,1),(31,1),(1,31)(31,31).
Try rotating a square 45 degrees if it doesn't affect the objects interaction it can reduce collisions.
Turn off collisions on objects that don't need them.
Make sure all objects that can collide are on the same layer.
In layout view check the View tab/show collision polys option to see how the objects interact and overlap at rest. Look especially for overlaps and ways of minimizing them
Don't use complex collision polys if a pinned rectangle will suffice.
Check your code for extraneous collision checks.
Use your debugger all the time and the built in profile tab which tells you pretty well where your resources are being used because we've assumed the code isn't leaky, it might well be and the debugger/profile tab will help you nail it.
Bertie Booster2014-02-13 10:47:26
There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Thu Feb 13, 2014 4:52 am

@Ashley

Thank you very much, It answers most of my queries ^^. Thank you,
B
8
Posts: 35
Reputation: 388

Post » Thu Feb 13, 2014 4:53 am

@Bertie Booster

Yes, I have somewhat noticed that happening. That and my computer isn't what you call an exactly high performance one ^^. I might need to go ahead and try optimizing my project, thank you very much for the note.
B
8
Posts: 35
Reputation: 388

Post » Thu Feb 13, 2014 6:56 am

@Bertie Booster

Thanks for all of those! Curious about a couple:

[QUOTE=Bertie Booster]A 32px square with collisions set to bounding box causes much more stress on the fps rate than the same square with the collision boundary set to (1,1),(31,1),(1,31)(31,31).[/QUOTE]

???

[QUOTE=Bertie Booster]Try rotating a square 45 degrees if it doesn't affect the objects interaction it can reduce collisions.[/QUOTE]

Why would this be? Maybe because there are generally more vert/horz surfaces than diagonal, and rotating the square means you touch most objects with just the tip of your col poly?

Collisions really do eat up a lot of cpu. Col cells really help, but if you have a lot of moving objects in a small space, it can still get very laggy, very quick. However, with some thought, there are usually optimizations that can be done (many involving checking cols less often).
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Feb 13, 2014 7:01 am

Remember to delete objects who left the layout, otherwise you have a growing number of collision checkers!
Image
Check out our start-up and configure your own helmet in true 3D.
B
44
S
11
G
11
Posts: 1,154
Reputation: 9,978

Post » Thu Feb 13, 2014 7:03 am

@iceFlashEX1

To answer your second question:

Debug is always a little slower than normal preview. Generally, it's a small difference though. Your finished project will be a little faster still, if the java minifier is working.

Much depends on whether your cpu usage is going towards graphics or event logic. Event logic will run a bit faster, but you won't notice if it's only a small percentage of your cpu usage.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Feb 13, 2014 9:47 am

[QUOTE=Ashley] Hopefully this covers all your questions: https://www.scirra.com/manual/134/performance-tips[/QUOTE]

I think the claim on that page that layers have little effect on performance is wrong. I had nearly 20 layers doing pretty much nothing except hold static sprites. The game at this point had no ticks whatsoever. I was getting 35-40fps. I moved all my images onto 2 layers and the FPS went up to 60fps. This was the only change I made. There were no moving sprites and no ticks. The game at that point was just sitting waiting for keyboard input.
B
10
S
2
Posts: 26
Reputation: 922

Post » Thu Feb 13, 2014 10:27 am

Also, be aware that laptops can present a problem if you're using WebGL in any way on those layers. I had a game I made in C2 where the game ran really slowly at random points and I couldn't work out why.

Turns out that when the game was running slowly my laptop was running off the battery. When that happens, many laptops disable the 'higher level' graphics chips to save power. This is worth keeping in mind both for debugging and for when considering distribution.

Is there a way to get round that, now that I think about it?
B
6
S
2
Posts: 62
Reputation: 628

Next

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, dand, tinhofiel and 25 guests