Why are mobiles punishing my game with low fps?

  • 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:

    <img src="http://i.imgur.com/AhYxlUX.jpg" border="0">

    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?

  • 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.

  • Ah, thanks!

    Dammit, that's a shame, I enjoyed using PhoneGap because it was so easy! I'll try Cocoonjs instead :-)

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You should change window size from 960 x 640 to like 480 x 320 or 240 x 160 as you get better rendering performance.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)