I recently released the MicaByte “Game Library” as open-source.
I work almost entirely in Native Android. That’s mostly a convenience thing – the time I have for game development is very limited, and although I am a C++ programmer by trade I like Java as well. Java is not a perfect programming language (none of them are), but it is good at getting out of the way and letting you simply do work. And while there are very many things that I absolutely hate with the Android APIs, it shares many of the strengths (and weaknesses) of Java. One of the reasons I started doing Android games was because of how easy it was to move into – I literally spent 2 weekends to create the first version of “A Brief History of Rome” (not published incidentally).
There’s another reason why I prefer sticking to Android, and it’s my dirtly little secret: I hate GUI and graphics programming. It’s not that it is hard (though it can be, take a look in the fantastic libGDX code base to see how complicated it can get); it’s mostly that I’d rather spend what time I have actually working on the things that I find interesting: the game design, the game engine and the artificial intelligence. The GUI and graphics are the dreary chore that I need to do in order to do justice to the rest.
Unfortunately, pretty much every game library for Android (and I’ve looked at most) aims for cross-platform compatibility, and in the process essentially end up making the development of graphics and GUI for Android harder, rather than easier. They also tend to focus on full-screen arcade/action game functionality, which tends to be less than useful when you need impart lots of information and display large maps. If there is something better and easier than native Android for doing simple strategy games, then I certainly haven’t found it yet.
The Game Library (though it hardly merits that name) is essentially a collection of utility functions and classes based on the native Android interface (not OpenGL) that I’m using in the development of Dwarf King and Small Battles. Most interesting for those who can get a little use out of this, perhaps, is the implementation of the SurfaceView and SurfaceRenderer, which builds pan, fling and pinch-zoom on the typical examples. When I have time to clean up something clean, I’ll put up an example Android app that shows how I use the classes in the android library in practice. The library is licensed under Apache License 2.0, which essentially means you can use any parts as you like, as long as you provide attribution.
Why open-source? Well, why not? All of the code in the library is either trivially simple, or stuff I picked up the ideas for around on the web. It’s not as if I’m doing anything terribly original or even – for that matter – very complicated. If others can benefit from looking at my code (or even improve it), that alone is worth the effort of cleaning it up and putting it online. Also – these days, open-source is in my DNA (I work with open-source software for a living).
The source code is available on GitHub; https://github.com/micabyte/android_game
It’s still pretty simple as I’m still cleaning up and adding a little code + I also need to create an example app that shows how it can all be made to comes together, but it’s a start. Enjoy.