Sep 2, 2010

Tilt Mini Golf, or "should I use OpenGL or not" ?


Tilt Mini Golf might seem similar to Mini Golf'Oid, but in fact they are very different internally.

Category: Android
Posted by: pierrot

Amongst key differences is the rendering system. In Mini Golf'Oid it was pure 2D/Canvas based, whereas for Tilt Mini Golf I initially choosed to go with OpenGL-ES, as this game had more specific performance requirements. This was an error.

In Mini Golf'Oid, there is (most of the time) a single animation : the ball. Hence a small fraction of the screen is refreshed on each frame, and this is really fast. However in Tilt Mini Golf two elements need to be refreshed on each frame : the ball and the time counter. The problem that happens here, is that these areas may be far from each other, and the Android view system merges invalidated regions when redrawing. As a consequence a much larger part of the screen is being refreshed : a rectangle starting at the ball and ending at the corner where the time is displayed. I feared it would significantly degrade performances, so I implemented an OpenGL renderer. It took me almost two days to build this renderer with all needed features but the result was very good, the framerate was excellent... on my device.

So what is the problem with this ?

Firstly I should have used an existing game engine, for instance AndEngine. But this was not the real problem. The real problem is that not all devices have an accelerated OpenGL implementation, and even simple meshes will be slowwwww with a software renderer. As Tilt Mini Golf is not a 3D game, users without hardware OpenGL do not understand why it is so slow, since it only displays a few 2D things on the screen. These relatively few users for which the game is sluggish logically give poor ratings. Satisfied users tends to not rate unless they are asked to. And the game was lost somewhere in the bottom of the applications list, despite my personal feeling that this game is much more fun than Mini Golf'Oid.

So, once again, I came back to work and replaced the GL renderer with a 2D SurfaceView renderer (not the same as Mini Golf'Oid, but a smarter one), and published the new version on Android Market. Its average rating seems to increase now, but downloads do not really take off. Let's hope it will change...