I published my first Android app last night. It's a pretty but fairly boring game (called RockinRoll) that I originally did for the iPhone, which I ported mostly as a learning exercise. The game has nothing to do with music; it is a match-3 style game crossed with a 2D physics engine that is hooked up to the phone's accelerometer. Different colored stones come out on top and fall, and how you tilt the phone controls where they fall toward. Making 3 or more of the same kind touch makes them disappear, and you get points. There are a few kinds of powerups that help you out too.
Here's one of the powerups about to go off:
The iPhone version of the game is written in C++, with as little Objective-C as I could get away with. I do not approve of Objective-C. It includes rendering code for both OpenGL ES 1.1, which was available on 2nd generation hardware, and OpenGL ES 2.0 which uses programmable shaders, and was available on 3rd gen hardware and up. The shaders let me do some special effects, and much better anti-aliasing than the 1.1 renderer. The iOS version of the game looks roughly like this:
Android applications are written in Java. Google also provides a native development kit, which lets your Java application load separately compiled C or C++ code and make calls into it. I tried pretty hard to port the GL ES 2.0 rendering path to Android; I have a Nexus 1, which supports ES 2.0 and it looks quite a bit better. Alas, nothing doing. I could not get it to work. I am pretty certain that the ES 2.0 support is just busted, either in the phone itself (unlikely) or in the NDK (I hope). There is a newer release of the NDK available than what I built with, so I should probably try again. Anyway, there are no shaders in the Android version, which looks about like this:
Some random thoughts on the two platforms:
- Sound on Android is tremendously easier than on iOS. It is still harder than it should be, but Core Audio on iOS can provoke true rage.
- When I published RockinRoll for the iPhone, I uploaded it and clicked publish and waited for over 5 weeks while Apple debated its worthiness for their platform. Last night I clicked publish on the Android Market backend, waited a few minutes, and it was available to my phone.
- Google's architectural aesthetic is much better than Apple's, IMO. The APIs are better thought out, easier to use, and Java is a much better language than Obj-C.
- Apple's technical domeepentation sucks meep. Google's is better, but still sucks.
- The busted shader layer really bums me out.