Friday, May 22, 2009

Robotic Space Rock 1.0.10 for android 1.5 (cupcake)

Since the release of the android 1.5 SDK, I wanted to update the code of RSR to use the 1.5 SDK. It seems that as far as openGL/ES is concerned, programming is greatly simplified by the introduction of the class GLSurfaceView and the Renderer interface. It only took me a couple of hours to change the code to use the new programming interface. However I spent several days trying to find out why my application misbehaved when it was paused and then brought back to life. However I was able to track the problem down using the setDebugFlags(DEBUG_CHECK_GL_ERROR);

It had to do with incorrect rendering of a square (used for the moon/earth) surface. I also replaced the mediaPlayer class I was using to play back an mp3 with the JetPlayer class, which can be used to play back midi files that are a lot smaller compared to mp3's and they can use little cpu power. Now a midi file is used for playback, and the application size has reduced considerably to well under 1 Megabyte. However I did not find the time to write a proper midi song, so all you gonna hear is a repetitive ditty that is probably gonna drive you crazy...

Overall I think that the game is now a lot more responsive and fast but I only tested it on the emulator, so your feedback is welcome. Go to http://code.google.com/p/monolithandroid/downloads/list , download roboticspacerock1.0.10beta.apk and keep those bug reports coming...

The 1.0.9 version did not work, probably due to the getHolder().setType(android.view.SurfaceHolder.SURFACE_TYPE_GPU);

bug. In order for the game to work in real phones it seems that you still have to use the previous line.