Language :
 

Low performance issue solved!

I’m in the early stage of my project. Currently, I have a very basic collision handling mechanism, and I’m blitting a “few” sprites to screen. On the emulator, everything seems to work fine. However, when I transfer the software to an actual device, either the Touch Diamond or the Axim X51v, two devices with good specs, I received the following FPS :

Axim : 11FPS

Touch : 21FPS

These low values are really annoying, especially that I intend to add way more “features” to my game, meaning that these values will go down ! So I had to find out quickly why the performance was so low.

I probably should’ve used a profiler, but somehow, I just commented out of the program some parts of the code. Taking out the collision handling logic did not even give me a single added FPS. So it was definitely with the blitting. Removing most objects ( about 100 of them ), gave me a very decent increase. Now what’s a game if you can’t see what’s going on ? :)

So I tried something else. It seems that it is not the number of pixels written that takes time, but the number of calls to the blit engine. Since most of the time, the objects shown do not change, I blit everything once in an offscreen surface. I draw the modifications on that surface, and I finally blit the whole updated surface on the screen. The same amount of pixels are transfered, but with less than 10 calls to ->blt(), instead of more than a hundred before.

Axim : 40fps ( but very smooth display, due to the usage of hardware page flipping )

Touch : 47fps

Clearly, that did the trick. I guess that we need to think a little when using these devices, which makes developing for them much more fun :)

Comments are closed.