Tag Archives: game development

Quitting your game without killing the Android process

I’m back with a small article on how to improve Android Cocos2D-X based games. To quit an Android game when pressing Back, the engine sample tells you to call

  Director::getInstance()->end();

Now this the job in most cases, but has one major drawback: it doesn’t follow Android guidelines for finishing an Activity. Instead, it kills the whole Linux process hosting the Android game. This has implications if your game includes Android services (eg. for push notifications), because it kills the service as well. Therefore, your push notifications will not work properly.

So I had to come up with a fix. I implemented this C++ function which calls a native Java method:
Continue reading Quitting your game without killing the Android process

My favorite new genus : Cocos

I’m not actually talking about the palm tree. I really mean Cocos2D, which is a well known 2D graphics engine, made famous by some iPhone games (see here for a list).
I recently started playing with it, well, with one of its variants: cocos2d-x. This port has taken the developers by storm, because it’s cross-platform. It can run on both Android and iOS, and the progress is quite amazing. More than this, it’s written in C++ :). Which means guys like me, who really are shocked by Objective-C’s “unnatural” syntax, feel right at home ;).

So the fun stuff is (for geeks anyway), I can start Visual Studio, build the project, run it in Windows… Fire up Eclipse, build it for Android and run it on my HTC Desire… then start the *cough* Hackintosh *cough* and recompile everything for iOS… and run in the iPhone emulator (I don’t have an iStuff). Also it supports another platform (uphone), developed by China Unicom, a telecom company.

Anyway, it seems the guys behind the engine itself are a few engineers from China Unicom. So if the project has some funding, it may become the next best thing for mobile game development. Who knows, they may even add support for Windows Phone 7 at some point (although I doubt it now, since we can’t use C++ on it… at least not yet).

So for those interested, yes, I’m also working on a (secret) game 🙂