Tuesday, February 8, 2011

Success and crashes

One day has passed, and PewPew is doing well. It has entered the Hot android app category on AppBrain.com, and I am receiving a lot of positive feedback. While monitoring twitter I found 14n3 saying "Oh man, making a review of PewPew, this game rocks!". Always gratifying.
Unfortunately, there are a few people reporting crashes.
Since PewPew is very stable on the iOS devices, the crashes must stem from Android specific code I added. There are two areas where I am not sure I am doing everything right:
It's either the handling of the application life cycle, specifically the part where I have to reload the openGL data when the game is resumed, or the http requests to upload and download the scores and replays.
Those thing would pose no problem if PewPew was a Java application like most Android applications, but it is 99% a C++ app with a thin Java wrapper (and thus uses JNI). To reduce the amount of JNI code I cut some corners.
At first I started using the Android Java API for the http requests, but then I realised it involved doing a boatload of JNI functions and threads, so I decided to use a C++ library. Curl and Boost are the most well known C++ libraries for that kind of job, but they are also completely overkill and would require too much time to integrate in PewPew. I searched for a light alternative and found HappyHTTP.
HappyHTTP does all what I need, and can be integrated into a project simply by adding a .h and .cpp file. The only problem is that it uses C++ exceptions. I can't use exceptions in PewPew even if I wanted to, because currently the Android NDK does not support exceptions handling and STL usage at the same time! I quickly hacked an exception-free version of HappyHTTP, but I may have messed up some things up, which may cause the crashes on some devices under certain conditions...
I hope I fix everything quickly so that I can resume doing the fun stuff: working on new levels and game modes.