CoAB code now on Google Code

I have decided to host my coab SVN repositry on Google Code, as it provides off-site backup, and I don’t feel the code has any trade secrets.

While there are parts of the code that shame me deeply, I am not too concerned as this is a work in progress. I would prefer to get the project further along, so feel this will help that goal.

The project is coab – Curse of the Azure Bonds, you can browse the code, or download it.

Also of interest is the Wikipedia Curse of the Azure Bonds page.

CotAB progress report

I have spent quite some time over the last week working on ‘Curse’ as my other project may have a conflict of interest, so I’m giving that the time it needs to unfold.

Reviewing my subversion log since my 22nd of March post, the following progress has been made.

  • Copied large chunks of static data from the data section of the .exe and put it in the global section of the game engine. I had an idea of using reflection to dynamically load this from a bin file, but it was simpler to copy the data as it was required.
  • Add EGA emulation, with correct write plan support, and colour palette swapping.
  • Display mono colored text correctly, and positioned correctly.
  • Inserted ~9000 throw new System.NotSupportedException(); in front of non-translated assembly, so I could translate code as it was hit. Edit-and-Continue is a blessing for this. You just have to remember to write the new code below the line that triggers the exception, so when you delete the exception, the instruction pointer (or what ever it’s called in the CLR) is now pointing at your new code not after it.
  • Added keyboard input process, so System.Windows.Forms.Keys are converted to IBM keyboard scan codes, as expected by the game code.
  • Started working on the Copy Protection code wheel icon display code. (This turned out later to be the generic icon display cache)
  • Put a lock region around the access of the display bitmap, so avoid exceptions from the engine thread, and the main UI thread.
  • Added more keyboard input support, once I worked out how the Word was been used (high word control code, low word ASCI code).
  • Started working on the character generation code path. Translation of large amounts of assembly or big data tables.
  • Completed the character generation, modification and leveling code.
  • Finally worked out how the combat icons where stored in RAM and recoded all the access code to use new understanding.
  • Recoded how the display stuff worked. Discovered locking bitmaps, and using System.Runtime.InteropServices.Marshal.Copy to do memory copies. This was such a huge speed improvement over SetPixel (which does a lock/unlock per pixel). It also allowed me to have yet another copy of the display picture. One for the EGA colour codes (to allow colour palette remapping), and a copy of the Windows video ram for direct coping. Besides the speed of the memory copy, this removed the odd multi-thread issue I was having.
  • Completed the icon display cache, now that I had more examples of how it was used. Did a lot of refactoring (renaming) at this point, was there are three units of measurement, titles (24×24 pixels), cells(8×8 pixels) and pixels. Lots of this was confusing as there where 7 tables used to manage the icon display cache. All sorted now though.
  • Rolled my on serialisation module, to allow for my classes based of original data structures, that have a lot of things that now use an int, when a byte was used, but to maintain compatibility, need to be saved/loaded as a byte. It was really learning how to use reflection.
  • Translated ~4000 lines of assembly, about 5700 left.
  • Fixed up quite a few memory location address name issues, cause by arrays have values index directly, so have unique names for both, but needing to point to the same location. This is where emulating the memory, and having it managed would have been nice. It would have also allowed me to put an layer, to find out what ranges array indices are index by, for overlaying purposes. There are a lot of places that Pascal non-zero based arrays have caused pain.

I’m currently working through the byte code engine in the game, trying to find my errors. So far they have mainly been of the last bullet point type. Gosh it is really fun working these things out though…

It’s alive – Curse of the Azure Bonds project notes

Well, after 10 months of logged work, with 169 check-ins to Subversion. I have 91% of the assembly translated (or deleted) and ZERO errors. Which means I can start running the program and debug the issues that where assumed, or unknown.

Lots of unassigned memory issues so far. Things that where stack based in the C/C++ (original code as Pascal) sense, that now need to be constructed to allocate heap memory. At this point the project would have been heaps easier if I’d used C++ as the target language. But I didn’t.

Now the actually useful parts, like learn DirectX to do the graphic and keyboard IO. The other option is to go GDI+ and buttons and/or menus. I’ll mostly try the second option first. :-)

Forgotten Realms: Azure Bonds

I read the book Forgotten Realms: Azure Bonds a few weeks ago. I found the story fun. It was not complex. There was plenty of plot development in the beginning, but it was all wrapped up quite quickly at the end.

As with most books it is interesting to find out that the cover work armor is only worn at the end as part of a ceremony. Nice to know the sword sell did not consider this normal armor. Bless cover artists.

Curse of the Azure Bonds Cheats

Here is a list of the cheats I’ve found so far in Curse of the Azure Bonds.

Adding STING to the command line (first parameter) will:

  • Skip the Title screen
  • Allow toggling debug mode, press CTRL+D. Output is put in the DEBUG.txt file. While in debug mode:
    • Each executed Byte Code is logged to the debug file
    • Press CTRL+Z to dump the affects that each party member has
    • Press CTRL+C to exit the game straight away

Adding Wooden to the command line (second parameter) will allow you to:

  • Display the area map in all areas
  • Skip the copy protection, so you don’t need the code wheel, not that it matters as most abandon ware sites have the cracked version.
  • Turn on “Free Training” when in a trainer, press J. This means:
    • You don’t pay the 1000 gold pieces
    • You don’t need to have the required EXP to train
    • Your character doesn’t need to be conscious
    • Training centers will train all classes
    • You will be given the required EXP to be the level you have just trained for
  • Pressing Alt-x or ‘-‘ (minus) in combat will cause “The Gods intervene!” and kill all enemies

Thus you would type “start.exe STING Wooden” at the DOS prompt.

I hope this helps someone may be stuck in the game.

Edit: Here’s a video showing these cheats in action.