Sunday, August 3, 2014

Android keyboard for Civilization 1

So I've recently purchased DosBox Turbo, the best (as far as I can find) implementation of DosBox for Android, and have been playing through old DOS games on my phone. It's been pretty awesome -- I've been currently playing Civilization 1, which is one of the best games ever, in my opinion.

The only problem is that for Civ, you need a keyboard with arrows and diagonals, as well as a number of regular keyboard commands. I've used the awesome Hacker's Keyboard for other games, but for Civ, I end up having to toggle back and forth between the "normal" and "alternate characters" modes repeatedly. And I'm using PgUp, PgDn, Home, and End keys for the diagonals, which aren't arranged intuitively on that keyboard. So it's a bit of a hassle.

So the other day, I thought, "how hard can it be to write a new keyboard layout to make this game easier to play?" Turns out the answer is "not very hard."  The android sdk distribution contains sample code for a simple keyboard, and it didn't take much beyond changing an xml layout file, and removing a bunch of unneeded code, to make my Civ 1 keyboard.

It's still not quite perfect -- there's still a bunch of unneeded code (left over from the sample code) that I haven't pruned out, and a few tweaks I'd like to make. But it sure makes playing civ easier.  If I ever get around to cleaning it up, I'll post the source and possibly put it up on the Play Store. Until then, feel free to download the apk file from me and try it out. I won't make any promises about the quality or anything at this point. But let me know if you happen to try it.



(and yes, I'm still slogging away slowly at Robo-Ninja)

Optimization and C

Starting this next game in C, I've known there will be places where C isn't fast enough, and I'd have to drop to assembly to ...