I've created an HTML5 Canvas and JS game that runs great on a desktop or laptop in Chrome (30fps), but on mobile Safari I only get around 8 fps. Are there any simple tips or tricks to increase the framerate?
|
up vote
6
down vote
accepted
|
Unfortunately, the answer is to draw less. I've found the bottleneck with canvas based applications (on any platform, really) is the time it takes to actually draw pixels. Here are some things to try:
The thing with developing on Chrome is that a) its JavaScript engine (V8) is fast as hell and b) the newest versions (7,8,9) all have some GPU acceleration when it comes to canvas rendering. That coupled with the fact that mobile hardware just isn't as powerful as your desktop/laptop means that it'll be really difficult to get anywhere near the same performance on mobile safari. I think, for the time being, the best approach might be to target your game at mobile safari from the get go and try and build a game that's not as redraw intensive. |
|||
|
up vote
2
down vote
|
everything @Gosub said plus: look at whatever math you're doing, see if there's anyway to use more efficient algorithms. use smaller images. try making the dimensions of the image powers of 2 see if you can get rid of alpha blending on the canvas or dont use CSS opacity property. please post back your results. would be interesting to know what things helped most. |
||
|