Wednesday, February 22, 2012

On Doomdark's Revenge

According to my records today marks 8 years to the day since I released my GBA remake of Doomdark's Revenge. A few people have asked me "are you going to release an Android port of your remake?" - to mark the anniversary the answer is yes! and here it is! [Edit - or rather, there it was. I have removed these remakes at the request of Mike Singleton himself, who is working on his own Android versions]

"Is that Don Quijote?" asked my wife

In addition to an Android port, I've gone back and fixed several show-stopping bugs that were in the GBA remake. The updated GBA version is on my remakes site.
  • Lords artificial intelligence is no longer completely broken
  • Several crash bugs fixed
  • The game is faster (and smaller) thanks to using the right compiler flags
In the Android version I've changed the controls slightly compared to the original LOM remake. In particular, Google has now deprecated the Android menu button. I don't think this means they'll send someone round with a screwdriver to pry it off your old HTC Desire or whatever, but that we developers should stop using it. Up until now I'd always used Menu like the GBA Start button, but seeing this trend I didn't use it here and I've gone back to my LOM remake and removed the use of Menu there too. I don't think anyone will really miss my poor use of the Menu button, it was always a bit of a mystery what it was going to do.

While working on this, I spotted a bug in The War of the Solstice that caused it to crash on versions of Android prior to 2.1. Both remakes share a lot of common Android Java code, so fixing this in one remake also fixed the other. The lazy loading technique described in this blog post makes supporting older versions much less hassle.

In the near future, I am going to update the source code downloads on my GBA remakes site so it reflects the latest versions of everything. One thing at a time.

Back to that AI bug... A keen gamer brought it to my attention back in 2009, but I was busy doing other stuff at the time. Here's what he had to say:
However the AI seems not to work correctly. Using the Spectrum version thelords would usually catch up with their liege or head for their foe or weapon. Using your version there is no Anvildrak, Imgorarg or Kahudrarg heading for Luxor and I have yet to see any pair or group of lords. Instead I've seen several single lords right next to the Frozen Wastes.
At the time I wrote back saying that the bug was probably in the code that decided which way a CPU-controlled lord moves, but I didn't investigate further. Now I fired up GDB and stepped through the AI code. At the same time I also stepped through a suspiciously similar looking bit of Z80 assembly in the original game using fuse's built-in debugger. After comparing notes I immediately saw what the problem was - instead of going towards their targets, my code was sending the lords away from them! What a mess-up, but the fix was simple.

Another "bug" in my remake was a kind of meta-bug. Instead of compiling the code with optimizations on, I had compiled with gcc's defaults. This meant the 2004 remake was much larger and slower than it should have been. The binary came in at over 100kb! This new version is 77kb big - still over twice as much as would have fit in the Speccy's RAM you'll notice - and noticeably faster.