I've been using GLSurfaceView since it was introduced in Android 1.5 and I was a little let down to find that the new Live Wallpaper APIs didn't include anything like that. I like the design because it makes it very easy to quickly start working in OpenGL. Without it, there is quite a bit of tedious initialization and thread management code that isn't necessary for the vast majority of apps. Fortunately, for my first live wallpaper (Live Waterpaper), I adapted the GLSurfaceView's code and created a GLWallpaperService with a GLEngine which takes a Renderer and does the job for me.
Sooner or later in your Android game development foray you may find the need to have some code that runs faster. It turns out that Android code written in C runs 10-100 times as fast as its Java counterpart. I can verify this, as I've already moved a few major components in my newest 3D game engine into native land. That's quite a boost but let's face it - C is a pain in the ass and while Eclipse is great for Java, it's not for C, right? Wrong. Here's how to set up a super speedy NDK development environment.
The nice people at Verizon let me borrow a Droid for a few days so I'm going to take full advantage of this opportunity to bring you developers some specifications on the 3D capabilities of it. First of all, this phone is fast. How fast? It loads Light Racer 3D in 1/3 the time of my G1. Not only that, but it has a PowerVR SGX530 GPU in it (14 MPolys/s). Hello fast gaming! That's very close to the same chip used in the iPhone 3GS. Not only fast gaming, but all SGX series GPUs supposedly exceed OpenGL ES 2.0 specifications. Android doesn't currently support OpenGL ES2.0, but I have to imagine that with hardware like this on the market, it will soon. I tested Light Racer 3D on this phone and it works extremely well. 45-50 frames per second at 569x320. I have to imagine that it'd run at 60FPS if the screen were HVGA which would make it twice as fast as the G1. Read on for a list of supported OpenGL extensions and other specifications.
Real-time Android games have a few threads to worry about. You can't block up the main UI thread because it's needed by the OS. If you block it, even for a second, your app will be deemed unresponsive and users will get the dreaded "Force Close or Wait" dialog. If your game doesn't do anything in a logic or main thread then you should be in the clear. If you do use a main thread for your game and run it as fast as it can go, as is the case with 2D games that draw to the canvas or 3D games that simply have a lot of game logic to process, you may want to think about how you're handling your input.
The Android Developer's Challenge 2 has begun. The judging application is available for download on the market. If you're not familiar, the ADC is a contest sponsored by Google in which developers submit apps and games for Android. Apps are initially judged by users for a first round. Later, Google judges will be responsible for 60% of the score. The top 3 apps for any given category get a cash prize. An early version of one of my games, Light Racer 3D, is in this contest. Good luck to everyone who entered and thanks to Google for running it!
Upon last check of the Android market, there are over 4000 applications and games in total. One strange and interesting app that I've come across lately is called FaceIt. FaceIt is an app which listens to sound from the phone's microphone and shows a mouth which opens based on how much sound it's hearing.
While doing performance testing of Light Racer 2, I had to figure out how to do the fastest common operations. One problem I found was that I was drawing a static background in a 32 bit color mode with transparency when it was much faster to draw it in 16 bit with none. Another thing I wanted to check for was to see what was faster for finding half of a number: Division by two or multiplication by point-five? This matters because I do a whole lot of that in the game to place graphics and find mid-points for various physics and AI stuff. I wasn't sure which would be faster because the ARM processor in a G1 has neither a hardware divider nor a floating point unit. I wrote this little utility to tell me how many frames per second I can get with various operations. Also - Divide by two is at least twice as fast.
I was recently asked how to have objects that animate themselves (change frames) in a stable way that isn't dependent on the FPS or lag of the device. There are many ways to do this but I have a simple one which uses the difference between the last tick and the current tick to count down. My example is in Java and is suitable for most games. The first step is to use a main loop which gives the updates that info. The best way to do this is to give every thing that is updating the exact same time information and have them all use that.
I get a lot of questions from people who are trying to decide what specific hardware to put into their computers. More often than not, they are trying to take a very old computer and make it usable again. The problem with very old computers trying to run current operating systems and applications is that it requires almost an entire new computer worth of upgrades to bring it up to speed. On the other hand, I've used several computers now that are a few years old and only need a very simple upgrade to keep them usable for another year or two. The problem is that most people simply don't know when it's worth it to upgrade and when it's time to just replace it all. Fortunately for them, we can answer most of the questions here.
If you have a Pioneer or Premier CD/MP3/Radio in your car and you don't have an auxiliary input already, it's really not too difficult to add it, provided you have a compatible head unit. Models starting with a "P" after the dash such as the Pioneer DEH-P2900 are compatible. The aux input connects through the blue IP-Bus connector on the back of the unit. Pioneer sells an adapter that comes in the form of a little metal converter box but you can get just a cable adapter for much cheaper. I've done this in 2 cars now for about $10 each total and it has worked perfectly each time.