Sunday, December 19, 2010

Changes in Chaos 1.4

I've uploaded another version of Chaos to the Market. This adds the oft-requested "Quit" feature. Now you can leave a game at any time by selecting the option from the game menu. Once on the splash screen, if you press "back" the game will exit and you'll be returned to the home screen, or wherever you were when you started the game.

The second change reduces the size of the frame width around the board. In the GBA version I had increased this to 16 pixels (2 GBA hardware tiles) so that scrolling was less pointless. When the whole game fits on a single screen with space to spare, having such a large border doesn't make sense. This decrease in the total game board size means the graphics are slightly bigger than before once they've been scaled up. Here is a screen shot showing the before and after versions of the game screen so you can compare:



You can just about see the extra pixels used on the left and right of the screen. Now the game reaches to the ! on the "USB attached" icon and to the 2 of the 22:00 on the clock. We're only talking a few pixels here, but it's better than nothing.

I fixed a minor bug that caused the game to show the meditate spell incorrectly on the "examine spell" screen. No biggie there.

The last change I've made is to reduce the size of the APK file. What can I say? I was using uncompressed sound files, and now they are MP3-compressed. The APK size went from 512K to 160K, and the installed size went from around 800K to 380K. This was such a simple change that it reminded me of the Daily WTF article about the software company that added a pointless loop in the code that they reduced by an order of magnitude every now and again for an "amazing speedup".

Finally, I've released the GBA and Nintendo DS versions based on this same code base. I had a C++ semi-rewrite that ran on the DS, the old C code for the GBA, and then this version of the GBA C code tidied up for Android. The Android version also incorporated the bug fixes and improvements from the DS version, including the new spells. Now that I've finally figured out how to write cross platform code without too many hacks, all of these are based off of the same common C core.

I've created a new site with the Nintendo DS and Game Boy Advance downloads as well as some instructions on how to play on Android.

The hardest part about testing the GBA version was dusting off my old Windows 98 laptop, finding the "Flash Advance" adapter (the drivers came on floppy disk!) and copying the GBA file onto the aging flash cartridge. My current laptop doesn't have a printer port, so there was no other way to get the GBA files onto the flash cartridge. Here's a photo of my workshop set up on the dining room table.
My own computer museum

The photo was taken using a DSi of course :-) Suffice to say my dear wife was not impressed. I was accused of being like Jean Michel Jarre, surrounded by gadgets.

Sunday, December 05, 2010

Chaos 1.3

 I've uploaded a new version of Chaos to the Android Market. The only bug fix is the missing attack sound, but there are a couple of Android-specific cleanups in there. First off, I've now forced the game to run in landscape mode. Swapping between landscape and portrait was more of a tech demo than an actual useful feature. In addition, maybe people didn't realise you can rotate the screen to get a better view. I never used portrait mode anyway, it was too small. The second change is that you can now install the game to the SD card if you are running Android 2.2. I only have Android 1.6, so let me know if this works or fails spectacularly for you.

Spell select screen
For this release I upgraded my tools to the latest Android SDK, which is designed for Android 2.2. Prior to this upgrade I had assumed that I needed to use the old toolkits to compile for old versions of Android, I didn't realise that I could compile for 1.6 using the latest tools too. The explanation on the developers' documentation page is pretty confusing. As usual, looking for the API strings on Google Code Search turns up real world uses of the features and the correct implementation.

Speaking of confusing versioning, how about this tongue twister: the Android SDK is currently at API 8, revision 2. This is for Android 2.2. The SDK tools are at revision 7. These SDK tools are not tied to a version of Android, but API 7 is compatible with Android 2.1 in other places. In order to run on Android 1.6, you have to use "minSdkVersion=4", which corresponds to API 4. The latest version of the Android NDK is revision 4b. But the 4 here doesn't mean it only works with Android 1.6. In fact the NDK includes the libraries and header files for API versions 3, 4, 5 and 8, which correspond to Androids 1.5, 1.6, 2.0 and 2.2. Note that it doesn't include different headers, etc. for API levels 6 or 7.

And then you wonder why it took me so long to figure out how to use the latest SDK to compile for older versions of Android! :-P

Wednesday, December 01, 2010

Responding to Android Market Comments

The Android Market lets anyone comment on any of the applications available. Sadly there is no way to respond to a comment on the Market itself, so here is my feedback to your comments on Chaos...

by Neko_Noskire (November 28, 2010) ★★★★
This is what trading card games should have been like. A way to get out of the game would be nice.
Seems this comment was later deleted, but it still shows up on AppBrain. Adding a way to quit is actually quite tricky given the way the Android Activity lifecycle works with applications using native code. At the moment you can just press the Home button to go back to the home screen. This pauses the game and, assuming the OS does not kill the Chaos process, you can restart the game by pressing its icon again. This can lead to some surprising resets, though the alternative (always hard reset when you hit the Home button) is worse, I think. I don't particularly like games that do the forced hard reset anyway, it seems to go against the spirit of multi tasking. Or maybe Neko wanted a way to completely abandon a game that you'd already started? Hmm, that might be it and that would be doable. One for the list of things to do.

by Peter (November 21, 2010) ★★★☆☆
Pretty good, but needs landscape mode & speeding up; missing "attack" sound
I wonder if Peter uses an EVO 4G? Rumour has it that the frame rate is capped at 30 frames per second, which would cause Chaos to run slower than it should do. I use the frame redraw to sync the timers in the game, you see. As for the attack sound missing, I'll have to check that. Disclaimer: I often play with the sound switched off. Heh heh. The landscape mode comment is strange - just rotate your phone, the screen adjusts. Maybe I should lock the game to landscape only? The portrait mode version is not very useful as you end up with a tiny area to play on and big black borders at the top and bottom.

by Jon (November 20, 2010) ★★★★★
I now no longer need any other game. Awesome retro fun!
Thanks Jon! :-)

by Martin (November 1, 2010) ☆☆☆☆
Naja, schwaches Game. Keine gescheite Steuerung :(
Translation: Well, weak game. No intelligent control. Er, okay. I think an '80s videogame magazine tautology will do here: If you don't like games like Chaos, then this game is not for you.

by Kieron (October 31, 2010) ★★★★★
YES! 1 of my fav Spectrum games that I still play on emus, Marvin works well but the keyboard mapping isn't great for phone. This port solves it! Thanks
This is why I wrote the GBA version originally too - I could play Chaos on FooN, but the controls were unwieldy. Almost a remake of a remake then.

by darren (October 31, 2010) ★★★★★
Amazing cool sexy fun ! Hint ! Kill the warlock on level seven by using your blood diamond in his water
Right... Not sure what darren has been imbibing (blood-diamond tainted water perhaps?) but at least he rated the game 5 stars. This may have been an odd sort of spam actually, it appeared almost immediately after uploading the game to the Market. I can't see what the spam is trying to achieve though. Very strange.

So there we go. Keep the feedback coming - Chaos is in maintenance mode while I hack on my next Android game, but I'll still add features if they sound good and aren't too tricky.