Why are mobiles punishing my game with low fps?

Get help using Construct 2

Post » Tue Sep 24, 2013 6:31 pm

I've been making a game for android, and noticed how slow it is. So I've gone right back to basics and created just a small test project just to see what affects the framerate the most.

I used some pixel art for a sprite and added the car movement behaviour, with some buttons to move it around etc. Here's a screenshot:


Download my test game capx

On the desktop I get regular framerates of 50-60 fps, but when exporting to Android through phonegap I'm punished with a really low framerate of 15-30 fps.

Maybe the framerate counter is broken? When I leave the android app idle the framerate does go up to 179 though, which is MENTAL. But I assume incorrect?

I think I'm doing everything that one should do to optimise for mobile, for example:
Aspect ratio 16:9
Window size: 400,225 (I assume smaller is better - right?)
Pixel rounding: on
Scale outer
Sampling: point
Sprites with images no larger than 128px (although if you download the project file you'll notice a jpeg in there for testing. Including/removing this doesn't have much impact on the fps).

Any other ideas for what I should be doing to optimise for mobile?
B
12
S
2
G
3
Posts: 86
Reputation: 2,960

Post » Tue Sep 24, 2013 7:26 pm

Phonegap is not hardware accelerated, and as such gets lousy framerates. Use cocoonjs instead. The jump in fps is likely due to c2 skipping the rendering process when nothing on screen has changed.
Moderator
B
95
S
34
G
33
Posts: 3,007
Reputation: 27,876

Post » Wed Sep 25, 2013 7:50 am

Ah, thanks!
Dammit, that's a shame, I enjoyed using PhoneGap because it was so easy! I'll try Cocoonjs instead :-)
B
12
S
2
G
3
Posts: 86
Reputation: 2,960

Post » Wed Sep 25, 2013 10:40 am

I've upped the window size to 960x640 now, to see if that would improve things - my reasoning being that the device shouldn't have to put effort into stretching the pixels too much - although does mean more pixels to display of course.

This actually seems to make the game more smooth, although that could just be that there's more frames to play with. The fps hasn't changed at all, it's still around 12-19 on my Nexus 4.

This also changes the aspect ratio to 3:2 as suggested by a blog article I read. I'm using "scale outer" though so this won't be noticeable to a player.
B
12
S
2
G
3
Posts: 86
Reputation: 2,960

Post » Wed Sep 25, 2013 10:42 am

Oh btw, the last comment was still using PhoneGap. I started using Cocoonjs but it's a bit more complicated, you have to register, then download their launcher app, then get a code, and their registration page is currently offline. So I'll have to wait until that's back up.
B
12
S
2
G
3
Posts: 86
Reputation: 2,960

Post » Wed Sep 25, 2013 12:25 pm

You should change window size from 960 x 640 to like 480 x 320 or 240 x 160 as you get better rendering performance.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Thu Sep 26, 2013 12:34 am

Okay @Joannesalfa I'll give that a try and see if it helps. Although I expect it to be more jerky as the theoretical pixels are larger.
B
12
S
2
G
3
Posts: 86
Reputation: 2,960


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 46 guests