Phil Hassey - game dev blog
Phil Hassey as Rambo
".. I've been there,
I know what it's like,
and I'll do it again if I have to."

Archive for August, 2010

Coming VERY Soon: Android Galcon

Tuesday, August 3rd, 2010

After a long week of hard work I’m almost ready to launch the Android port of Galcon!

droidpromo

In other news, I’ve been working on updated the front page of the Galcon website to include access to the latest news and links to my development blog. You’ll definitely want to keep an eye on those as I’ve got a lot of fun stuff in store this year!

Anyway, stay tuned, I’ll be announcing the availability of the Android port of Galcon VERY SOON!

-Phil

Porting Galcon using the Android NDK

Tuesday, August 3rd, 2010

droidslimI’ve completed my port of Galcon (an iPhone game written primarily in C/C++) to the Android NDK – meaning I’ve kept the game written in C/C++ but I’ve replaced my ObjectiveC/iOS device interface with a Java/Android device interface layer.

Porting to the Android has been a thrilling experience, one that I will not soon forget. The epic journey took seven days of toil through the forests of software installation, Java integration, bug extermination, and quirk comprehension. I’ve journaled my quest in detail. This entry servers as a portal to that vast mountain of knowledge. I also include some final thoughts.

Android Day 1: SDK, Eclipse IDE, and device activation
This documents how I installed the Android SDK and NDK software, set up the IDE, and activated the devices. Through the rest of my process I did not use the Eclipse IDE, so that step can be skipped if you have the same goals as me.

Android Day 2: The NDK
Next I got the NDK installed and ran a few sample apps with it. I then found a port of STL for the Android NDK and dropped that into my codebase.

Android Day 3: Packaging, Assets, JNI, and OpenGL
With a bit of work I was able to get Java to talk to C and C to talk to Java. I also researched my options for packaging game assets such as graphics and audio, as well as got an OpenGL context setup and got Java loading my textures for me.

Android Day 4: Video cleanup, Input handling
I was able to get the visuals complete in the game, and added event handling for onTouchEvent’s. I also removed the title bar that shows at the top of the screen by default. The advice about onPause is a bit vague, but I explain a bit better in a later part.

Android Day 5: Keyboard, Multiplayer / Networking
After considerable searching I was able to find out how to get the software keyboard to display. I then worked on getting the multiplayer portion of the game working, which was rather challenging as the debugging tools did not seem to yield tracebacks, but they gave just enough that I was able to figure out what was wrong.

Android Day 6: Save games, Audio, other Details
During this day I focussed mostly on getting save / restore (or pause / resume) working better. I also got the audio features of the Android working on playing my music and sound effects. To wrap it up, I added the game’s icon.

Android Day 7: Leftovers
A lot of cleanup here – better pause / resume support, better device support, keyboard support, volume controls, copy protection, bugs, and signing. The game is running quite well now!

So that was my journey. It has been a challenging quest – I haven’t used Java in about 10 years, and doing Java-to-C integration is a fragile process! Learning to navigate through Java classes to get things done is not what I’m used to in the more simple worlds of C and python. But the port is almost ready, and I’m quite pleased with it.

-Phil