Skip to content

Robin Hood – Reversing a Microcosm

The Adventures of Robin Hood is a game released in 1992, developed by Millenium. It was programmed by Steve Grand, who later went on to create the popular Creatures sim series.

Robin Hood screenshot

A scene from the introduction sequence of The Adventures of Robin Hood

Robin Hood could be considered one of the first world sims, populated by independent characters, one of which you have some control over (Robin Hood, of course). The gameplay is entirely non-linear, with multiple paths to completion.

I am investigating how to write a modern engine or interpreter for Robin Hood and its successor, Rome: Pathway to Power (aka Rome: AD92), with a path to creating new adventures.

Robin Hood is based on a rules engine/interpreter called Microcosm, which Steve Grand originally created for some educational titles many years earlier. I asked Steve on his blog if he had any source code available, and unfortunately it seemed unlikely, but he did describe Microcosm’s non-linear behaviour as follows:

… in Microcosm that simply translates into producing a DATABASE of IF/THEN statements, instead of the tree structure that would occur in normal code (normal code looks like: “IF A THEN (IF B THEN (…)) ELSE IF C…” – lots of brackets, creating a tree). So a Microcosm rulebase is a long list of completely independent IF/THEN statements, ALL of which are tested every tick of the system clock. Say one of the rules is “If A and B and C and D are true, then do E and F and G”. And say that doing G changes the external or internal environment of a character in some way. Now a different rule (which could be anywhere in the rulebase) might get triggered next tick. It doesn’t matter how the game got to that point.

Interesting stuff! It would probably be a lot easier to write it from scratch, but since we’re trying to support the existing games it’s going to tricky.

Robin Hood Sprites

Well, I’ve made a start at reverse engineering Robin Hood, starting with something a bit simpler. I’ve written a small decoder for the .VGA and .GFX files, which contain sprites and font characters. These files use a simple variation of Run Length Encoding (RLE). The image to the left shows the first five frames contained within MEN.VGA.

There are some quirks, of course. Some of the image data is hardcoded in the game’s executeable, such as a “default” palette, and the expected file sizes for each image. Most .GFX files store the image’s palette at the start of the file, except for CUBES0.GFX to CUBES3.GFX, which use the default palette. All .VGA files use the default palette.

The compressed images do not seem to contain all the pixels in the uncompressed image; all backgrounds come up one pixel short, and the sprite sheets are missing a few more pixels. I have assumed that the game just fills in missing pixels with 0×00, which seems to match the observed output (check the first screenshot – the very bottom right pixel is black, when the surrounding pixels are dark green).

Robin Hood Isometric Tiles

Here’s some boring information about the image files:

  • MEN.VGA and MEN2.VGA are 16 pixels wide, 3840 pixels tall. These files contain the character sprites.
  • IDEOGRAM.VGA is 16 pixels wide, 1600 pixels tall. This contains the action icons and UI elements.
  • ISOCHARS.VGA is 4 pixels wide, 1024 pixels tall. This contains the font used for in-game dialogue.
  • CUBES0.GFX to CUBES3.GFX are all 32 pixels wide, 1920 pixels tall, and contain the isometric tiles (cubes) for each season in the game.
  • All other .GFX files are 320×240, and are background images.

Here is my simple decoder script. It works for all Robin Hood images, and from a quick test it can decode at least the backgrounds from Rome. I have included the hardcoded “default” palette, in both VGA and RGB formats.

Robin Hood Image Decoder (Python Script) (2009-07-22)

Next task… RULES.PRG!

{ 9 } Comments

  1. bgbennyboy | 23 July 2009 at 5:50 am | Permalink

    I remember this game fondly, I’ve never seen anyone else write about it before.
    I also looked at making an interpreter for it a few years ago, I didnt get much beyond decoding the .vga files though.

    I’ll be watching your progress with interest!

  2. bgbennyboy | 24 July 2009 at 5:47 am | Permalink

    I found some of my old notes, most were rubbish but there was this regarding the rules.prg file:

    For some reason the strings in it are all missing parts – these parts are contained in the exe in a lookup table. The full notes are here.

  3. jestar_jokin | 24 July 2009 at 2:11 pm | Permalink

    Thanks for sharing your findings, bgbennyboy! I noticed the missing characters myself; it looks like some text compression is going on. However, considering the game supports not only English but also French, Italian, and Spanish, I wonder how useful the compression is, since it’s storing particles like “You are” and “going”.

  4. bgbennyboy | 25 July 2009 at 11:54 pm | Permalink

    I was bored so knocked up a quick text extractor for it.

    The lookup table seems to work ok with all 4 languages (as far as I can tell with my limited knowledge of German/French/Italian). As you say though, its not exactly the most optimal compression

  5. eschatonizer | 26 November 2009 at 1:14 pm | Permalink

    Thanks for the image decoder… I knew it was RLE and that there was a palette at the beginning of the files, but stumbled upon your write-up before I found the proper bit. Over the past week, I had the strange notion of remaking the 1991 Robin Hood game. It seems you have similar ambitions. How is your progress with reverse engineering the rules files going? Perhaps we could collaborate in some form.

  6. jestar_jokin | 3 December 2009 at 2:49 pm | Permalink

    Hi eschatonizer,

    I’m afraid I’ve made no progress since around July or August. I only got as far as finding out that large chunks of data are read in from the rules file, with the first byte or word (not sure which offhand) indicating how large each chunk is. But there’s a lot of fiddly little things I’m not sure about.

    Don’t forget to check out bgbennyboy’s text extractor code, that might be a good method for uncompressing the text in the rules file.

    I’ve already tried to contact you privately re: collaborating, I’ll try again (looks like Hotmail is blocking my normal e-mail address).

  7. Shinu | 25 April 2010 at 1:55 pm | Permalink

    How can I open those .raw files?

  8. jestar_jokin | 28 April 2010 at 5:11 pm | Permalink

    I used Photoshop 7 to view the files. When you open a .raw image, you’ll need to specify the image’s dimensions (which I’ve written in the blog post). The colours will be quite wrong, so you also need to import the colour table (I think under the Edit->Image Mode menu, make sure it’s in 8-bit/256-colour mode, then there’s a Color Table option that will let you import the palette I’ve included in the zip file).

  9. Shinu | 29 April 2010 at 1:33 am | Permalink

    Thank you, that did the trick…

Post a Comment

Your email is never published nor shared. Required fields are marked *