Simple Android template for new Game using an Entity System

If you’re working with Android, you quickly find that Google forgot to include some core things in the OS. Getting a “Hello World” application to run on your phone requires many hundreds of lines of code, 90% of which you’ll never change from application to application (i.e. it should have been built-in to the OS).

NB: you can do a fake “Hello World” on Android in literally 10 lines of code – but it’s not a real app. It only exists to pretend that Android is correctly configured by default – i.e. it’s a marketing hack :) .

If you’ve been using the free Entity System libraries over at http://entity-systems.wikidot.com, the Java versions need to be manually integrated into each new Android project. The Objective-C versions don’t need any integration – the default templates for iPhone/iPad projects work fine – it’s just the Java/Android ones that need work.

So, here’s a pre-made template you can use for starting new Android games / Entity-system projects. It starts up and draws a starfield, so you can confirm that the render-loop is running, and animation is working. It also shows that auto-rotate is configured and running (by default, Google doesn’t provide this):

https://github.com/adamgit/Android-Starting-Project-with-basic-Entity-System

NB: the code provided works fine – but the Activity-integration could probably be done a lot better. I just ripped it out of an old project, so I’m sure it works – but it could be a lot more elegant.

Post-Install

The Entity Systems libs are constantly being updated, so the project above does NOT include any particular version – you have to download the lib you want separately. Install instructions are in the README (which also shows up as the main body of that webpage above).

NB: if you don’t know what Entity Systems are, none of this is of help to you! Go have a look at Entity Systems are the future of MMOG development – Part 1.

(it’s a coding / design technique for making computer games faster / easier to write and maintain)