Android, ho!
So I picked up a Nexus One up off ebay and have added Android support to my engine! This means that Mind Wall, Dungeon Scroll, and even Dink probably can be released soonish.
Get by with a little help from your friends
Big thanks to Phil Hassey of Galcon fame for sharing android tips and source to get me going. The indie world is aflame with Pov’s Challenge and Phil’s been making great progress on a new game over there. Purty.
Abstracting Android specific stuff and the Proton SDK
I’ve tentatively named my new game programming framework I’ve created Proton. Because it sort of sounds like Protoss and I’ve been using them a lot in SC2.
It allows you to write a game in C++ using Windows and smoothly also compile for iPhone, WebOS, and Android by abstracting away all platform specifics.
The Android file system
Android apps like to read stuff directly from their .apk file (fine, it’s really a .zip) so I added the ability to Proton’s file manager to mount a .zip as an additional file system.
So in code, when it does this:
[cpp]uint8 *pFile = GetFileManager()->Get("interface/somefile.dat");[/cpp]
The game code itself won’t care where it comes from, or its compression type.
If you don’t fancy loading an entire file at once (example, Dungeon Scroll’s 1 MB+ dictionary should be streamed in slowly) , you can do:
[cpp]StreamingInstance *pStream = GetFileManager()->GetStreaming("interface/somefile.dat");
static int someSize = 512;
uint8 buffer[someSize];
pStream->Read(buffer, someSize);
[/cpp]
A little Java, a lot of C++
Using the Android NDK I can use my base C++ game code and a single .Java file to handle the glue between them. This is very similar to what I did previously for iPhone and WebOS.
I figured out ways to keep the “glue” code in a shared place for all my apps for iPhone and WebOS, but with Android/Java and its weird class space stuff and I can’t figure out how to do that yet so if I make a change in the .Java I have to populate it to each game’s project dir manually. Very error prone. It would help if I knew anything about Java, probably a clean way to do it with subclasses or such.
Starting with the emulator
My Nexus One was a little slow to get here, so I used the Android emulator to do the real porting and testing. It worked out ok. The FPS is crap (software GL ES only I guess) but it worked perfectly fine to get the job done. Of course you should never release anything without a bunch of testing on the real device though.
I’ve also ordered a G1, need to see how this stuff works on weaker phones and this is sort of the baseline I’m going for.
Handling different screen sizes
The way I’m doing it is a combination of “manually” supporting major screen sizes with resources and code (480X320, 1024X768, etc) and then on similar screen sizes saying “Just stretch the GUI to fit, but do any 3D rendering parts at native resolution”. It looks great, although you need to watch out for some strange aspect ratios.
What’s left before I can release something for Android?
Dungeon Scroll is running blazingly fast on the Nexus One but I still have more things to abstract out such as vibration, accelerometer, and dealing with packaging issues.
Also, big Dink Smallwood HD update coming soon with… some DMODS!
Seth ,
You will open Protoss code ?
Proton SDK? Yes, I plan to release it under a very liberal bsd style license.
Gettint it on svn, putting together some tutorials in a wiki and setting up its main page is a must before I put it “out there” though.
If anyone wants “early access” and might be interested in helping me maintain it, let me know.
How soon may we excpect this? Sounds really nice!
Should be ready in early November.