Jan09

Optimize Performance When Developing Android Gaming Apps with Open Source Tools

It is a simple fact for Android App Developers – especially those who focus on developing gaming apps – users will give a game a negative rating if they don’t experience optimal performance on their devices.  In many ways, this isn’t totally fair.  After all there are a multitude of low-end devices in the market place, and there really isn’t a way to effectively restrict those devices on Google Play, yet those lower rating can negatively impact future downloads and adoption rates.  So what is a developer to do?

The short answer is to optimize the game as much as possible.  Given that a game typically will tax the capabilities of a device to the max, the cleaner the code and the use of best practices in Android development will pay off and hopefully serve to limit negative ratings relating to performance.

This doesn’t mean that you have to slave over your code for hours at a time. Instead you can look for freely available tools that can do much of the hard work for you.  We’ll take a look at one of these below.

Introducing the AndEngine

Nicolas Gramlich developed a freely available open source OpenGL game engine for Android called AndEngine.  Since it covers the most useful aspects of OpenGL, it will make it much easier for you to create some great gaming apps without being an OpenGL expert.

To get a copy of the AndEngine, get a git clone of it –
git clone git://github.com/nicolasgramlich/AndEngine.git

Please be aware that when Nicolas created AndEngine, he seemed more focused on the power of the tool, and so…. The documentation is a bit sparse.  So you might want to bookmark the AndEngine Forums where you can go to find thousands of topics and posts.

Without the creator giving us a mass of documentation, you can at least look at some examples of how it was intended to be used with this git clone:

git clone git://github.com/nicolasgramlich/AndEngineExamples.git

Once you do that you should see a bunch of other items to clone – they have a lot of dependencies to the extensions, so get these:

git clone git://github.com/nicolasgramlich/AndEngineAugmentedRealityExtension.git
git clone git://github.com/nicolasgramlich/AndEngineLiveWallpaperExtension.git
git clone git://github.com/nicolasgramlich/AndEngineMODPlayerExtension.git
git clone https://github.com/nicolasgramlich/AndEngineMultiplayerExtension
git clone https://github.com/nicolasgramlich/AndEnginePhysicsBox2DExtension
git clone https://github.com/nicolasgramlich/AndEngineSVGTextureRegionExtension
git clone https://github.com/nicolasgramlich/AndEngineTexturePackerExtension
git clone https://github.com/nicolasgramlich/AndEngineTMXTiledMapExtension

Once cloned you should see them all in your workspace, so now you can start your GPU emulation emulator to see an example of how this work.  If you run the AndEngineExamples on it and you should be able to see the physics example working.  It’s pretty cool.

AndEngine Open GL tool for Android

The AndEngine Physicsbox Extention shows how the OpenGL tool saves Android Developers a lot of work

That’s just scratching the surface, of course, but hopefully you can see how using freely available tools like AndEngine, rather than starting from scratch, you can leverage some impressive functionality that will let your apps run more smoothly.  Even on one of those el-cheapo $50 tablets that tend to show up at Christmastime.

Let us know what you think – are there other tools that you use to get things running more smoothly on older Android devices?  If so, let us know your best practices in the comments section below.

Leave a Comment

Your email address will not be published. Required fields are marked *