Improving Performance in Auto Runner

Discussion and feedback on Construct 2

Post » Sat Jan 18, 2014 7:13 pm

Hey Developers,

The project I'm working on includes an auto runner game. What are some keys ways to get 40+ fps on the layout?

My game isnt really heavy demanding when it comes to GPU but it seems to take alot of CPU & Draw Calls at like 75%. I've tried using "60 * dt" on everything that moves in the layout but I cant seem to get any higher than 17 fps. I'm destroying platforms that are less than -Self.Width.

I'm testing on a blackberry z10 which has webgl already in the browser.
Is there something I can add to the xml or index.html?

C2 is a powerful engine, I feel like 40+ fps in auto runner should be doable with webgl I just cant pin point exactly what I'm doing wrong or overlooking
B
6
S
2
Posts: 151
Reputation: 1,366

Post » Sat Jan 18, 2014 7:17 pm

Preview in debug mode, then check profile for cpu load %

You can easily spot which piece is sluggish
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sat Jan 18, 2014 8:32 pm

Without capx, it's really hard to help.. Check collisions, game logic etc.
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Wed Jan 29, 2014 7:43 am

Its weird cause while debugging with Webgl "Off" (With game running in canvas2D) I get the fps that I'm looking for (40-60) but the game will crash even tho not a whole lot is going on cpu wise (stays under 30%). The Blackberry Z10 comes with web gl integrated but if the game didn't crash so much in canvas 2D I would of just stuck with that because of the higher frame rate.

With webgl on I get about 18-20 fps the most but the frames are always jumping & dropping so its not consistent.

I'm testing on a BB 10 device, I think the low frame rate may have to do with the many global variables active while the layout runs. In the Auto Runner I'm having frame issues with, I'll use variables to account for the platforms speed and its color ( since tiled background don't have animation sequences I created my own way of changing platform colors as the player progresses in distance traveled.)

The global variables are always active and may be the reason for a high Draw Calls percent, so if I could use instance variables to account for things like platform speed & color that might help me improve the frame rate.

My Goal is to make an auto runner that gets 40+ fps and has accelerating platforms that's color changes as the total distance traveled increases. I've been able to do everything but get the 40+ fps WITH WEB GL ON. I'll try to convert as many global variables down to instance variables as possible and if I get any luck with that I will let yall know.
B
6
S
2
Posts: 151
Reputation: 1,366

Post » Wed Jan 29, 2014 7:29 pm

@EyezWidee, try to limit the number of top-level actions, because those are being checked every tick.

One of the performance measures I've added into my game was using the System condition "Every x seconds". Then, I put many things as sub-events under that. For example you can put at least the following as subconditions to "Every 0.2 seconds":
- Update the score on screen
- Check for player falls out of bounds
- Destroy blocks that go off screen.

This is much more efficient than every tick.
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Wed Jan 29, 2014 9:25 pm

I am going to try that today, it makes sense that not all actions need to be checked every tick. Also I didn't think about how sub-events could help performance as oppose to having a bunch of actions taking place every tick including score which goes into local storage.

So I'm guessing there's not much of a difference, performance-wise, in having instance variable account for things like accelerating platforms or having global variables account for those things.
I also have a Block color variable that allows me to change the color sequence of platforms since they are tiled backgrounds with no animation sequences built in like sprites.

Thanks again I'll def try out your method @DanialGoodwin
B
6
S
2
Posts: 151
Reputation: 1,366

Post » Thu Jan 30, 2014 6:30 am

It worked! @DanialGoodwin
- Best Regards
B
6
S
2
Posts: 151
Reputation: 1,366

Post » Thu Jan 30, 2014 6:36 am

[QUOTE=EyezWidee] It worked! @DanialGoodwin
- Best Regards[/QUOTE]

Happy to hear it! By the way, I'm glad you checked the FPS before doing these changes. So, what's your FPS now?
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Thu Jan 30, 2014 8:55 am

I get different fps in debug mode. If it on inspect then the fps is 20+ with low CPU%, when on Watch or Profile I get 45+ fps.

Not sure which tab is the most accurate but if I just run the layout without debugging it looks like 40+ fps

Do you happen to know why the fps changes between Inspect , Watch , Profile (While in Debug mode) ?
If I had to guess Inspecting requires checking all conditions every tick.
B
6
S
2
Posts: 151
Reputation: 1,366

Post » Thu Jan 30, 2014 9:04 am

I just checked within the layout by using text & setting it to display fps.I get 30+ which playable. If I made a few more tweaks I might be able to get to stay 40+
B
6
S
2
Posts: 151
Reputation: 1,366

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 27 guests