Here’s The Traditional ‘Hello World!’
Welcome to the first post on this new blog. Here I’d like to talk a bit about what you can expect to find here the coming time. For details about myself, I’ll refer you to my personal website. All I’ll say regarding myself is that I have been a professional software developer for a number of years now, and have experience with a wide variety of languages and tools. How’s that for qualifications? 🙂
The primary reason why I’m starting this blog is to detail the development of a new Android game I recently came up with. I have been professionally programming for the Android platform since early this year and have developed a number of applications, including for other companies. While I do not particularly enjoy programming in Java (I’m more of a procedural-style C/C++ programmer by preference), smartphones nevertheless are an interesting platform to develop games for, if only because of the radically different interface and mobility compared to a PC and laptop.
While I won’t be spilling the beans on the game’s idea yet, I will be blogging about the low-level issues I encounter and the libraries, game engine, etc. I will be using. I’ll also be blogging about Android and other programming issues not directly related to the game. You may encounter posts about C++, ASM, VHDL and a variety of other languages I use too, so be prepared 🙂
Back to the game. The main issue with developing games for Android or basically any kind of application which is heavy on multimedia is the lack of support for advanced audio features in particular. While OpenGL ES (1.0, 1.1, 2.0) is supported, with ES 2.0 common in recent phones, there’s no audio support beyond basic stereo audio. IOS on the iPhone/iPad has had OpenAL support since the beginning, and video codec support is also very strong. Assuming you stick to the Apple-endorsed formats, naturally.
Only with Android 2.3 did we get OpenSL support, a kind of competitor to OpenAL developed by Khronos. Both are 3D positional audio libraries and APIs, so beyond the annoyance of porting existing audio code between both APIs, it’s good to have native support. Unfortunately Android 2.3 isn’t that widely used yet, with the Android Market statistics showing a usage of under 25%: http://developer.android.com/resources/dashboard/platform-versions.html
Android 2.1 and 2.2 combined still account for a marketshare of about 71%, making them the main targets for development. Other Android versions – including 3.x – can be basically ignored at this point. The target I use for my Android development is 2.1 and up, although I suspect that most if not all of the applications developed by me also run on 1.6. Anyway, our target for new development clearly should be 2.1, which will make it run on all Android devices but the 3.3% which runs 1.5 and 1.6 and no doubt run on antiquated hardware.
Then the OpenGL version. Again, we look at the Android Market: http://developer.android.com/resources/dashboard/opengl.html
Clearly OpenGL ES 2.0 is the way to go, with over 90% marketshare. If the game engine we end up using supports 1.1 as well, then that’s just a bonus. Next, for screen resolutions. Here we see that normal screens at hdpi densities are most common. This means WVGA800 (480×800), WVGA854 (480×854) and 600×1024 with a DPI of 240, according to the Android documentation. My own Android device (Huawei U8800 IDEOS X5) is an 800×480 device with ~240 DPI, running Android 2.2.3.
Finally, back to audio. If on sub-2.3 versions of Android we do not have access to a proper audio API for games, what should we do? The best answer I have found is to use a ported version of OpenAL Soft, the non-hardware-accelerated version of OpenAL. Instructions on how to use it can be found here: http://pielot.org/2010/12/14/openal-on-android/
There are some issues with OpenAL on Android, particularly due to the underlying audio hardware often not being designed for low-latency operations. Do be aware of this and be mindful of the limitations of the platform. I only intend to use basic positional sound for this reason in the game.
At long last, the game engine. After looking around for a few days, I think I have found the best engine for Android in terms of feature set and documentation: http://www.jpct.net/jpct-ae/. This is the Android port of the jPCT Java-based game engine. It’s fairly basic and doesn’t take too much time to understand. From what I gather it should have complete OpenGL ES 2.0 support soon: http://www.jpct.net/forum2/index.php/topic,2067.0.html. It’s also a 3D engine unlike the many 2D game engines for Android also available 🙂 My game is going to be 3D, of course.
I guess that this about wraps up the low-level preparations for an advanced 3D Android game. I hope to update soon with more progress 🙂