Tuesday, 18 January 2011

Reverse Engineering the Abandonware Game "Ignition"

Ignition has always been one of my favourite racing games. It had a quirky charm that was reminiscent of Micro Machines, but set in beautiful outdoor environments.

It's now one of the most prominent cases of Abandonware ever. First published by Virgin Interactive, which was acquired by Titus Software, which then became Avalon Interactive. Both Titus and Avalon no longer exist. So who owns the rights to the game (and more importantly who has the source code) is a mystery.

The other day I decided to take a look at the files that come with Ignition, I wondered if there was anything salvageable for an indie game developer. Perhaps I could knock together a level viewer or mod the game. The first thing I noticed is that Ignition uses a lot of different file formats.


There is one TGA image, but that's just of the Virgin Interactive logo, some of the sounds are WAV, but others are another mystery format. However, some of the extensions give away what they are. There are .PIC files and .MSH which I assume are images and mesh files respectively. There is also a .TEX, some other image file perhaps?

I fired up a hex editor and began work reverse engineering the .PIC file. The first thing I tried to do was to render the latter part of the data as RGB bytes. I assumed (wrongly) that it would be a 24 bit image. All I got out of it was a garbled mess, except for a couple of rows near the top of the image which were all different colours. It then occurred to me; this is a palette based image and those two rows of colour are the palette.

Now that I knew what I was looking for, things got easier. I looked at the beginning of the header and found a couple of familiar numbers; 640 and 480. Those bytes were obviously the dimensions of the image. With that in mind I could read backwards from the end of the file for 640 * 480 bytes and assume that that would be where the end of the header (and probably the palette data) was.

Finally, with a bit more experimentation, I found the start and end of the palette and some other numbers the use of which still eludes me.

To sum up, here is the header structure of the PIC image file that Ignition uses:

typedef struct PICHeader {
    INT file_size;
    SHORT magic; //Always 38144 (or 0, 149 in separate bytes)
    SHORT width;
    SHORT height;
    SHORT unknown1;
    SHORT unknown2;       
    BYTE unknown3[50];
    SHORT palette_size; //I thought this was palette size - but it's not, it's always 776
    BYTE unknown4[6]; //Always zeros, probably reserved
    BYTE palette[256*3];
    SHORT unknown5; //In one file this was the number of bytes after and including this one, but not in others (??)
    BYTE unknown6[4]; //Seen (0, 0, 1, 0), (4, 0, 1, 0) - probably orientation (e.g flipped image)
} PICHeader;

Every byte beyond the header is an index into the palette for the pixel colour. I now have a simple little program that converts from PIC to TGA. If anyone has any clue what any of the other numbers means then let me know.

Now onto the other... probably more complicated... formats.

18 comments:

  1. Hello there, sir!
    I'd love to know if you ever came back to this topic or if you plan to. I love this game sice 1997 and I'm interested in getting every single bit of information about it I can get.
    I'm not a programmer, though. Just a occasional modeler and texture artist. Therefore I'm obviously most interested in *.msh and *.tex files. Have you tried to research them?
    Do you plan to publish the converter you created?
    Thanks in advance!

    Cáno

    ReplyDelete
  2. The best solution so far would be to run Ignition in the DOSBox Debugger to see the Assembly code and understand how to open the .msh files.

    ReplyDelete
  3. @Jędrzej My enthusiasm kinda tailed off when I took a look at the MSH format. I'll probably get back to it some day.

    I can't think where I put the converter but it shouldn't take me long to create another one (the hard part was working out the format). I'll post back here if I find time to do that.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. I ripped the textures using 3D ripper DX. It rips all the textures in ram, so If you enter a track, you get all textures in dds format (I oppened them in blender 3d). This program should also rip 3d models, but there is a transparent plane in front of the camera, and it just rips a plane.

    ReplyDelete
    Replies
    1. I tried using 3DRipperDX and GLXtractor on both 3DFX and Windows verions but nothing worked at all. I'm using Windows 7 (so I used dgVoodoo and a patch to run the game). Could you please tell me how you did it?

      Delete
    2. It worked with nGlide but the effects were, as you said, a bunch of 0kb *.obj files.
      I got my hopes high with another OpenGL wrapper (OpenGLide_009rc7), because it made GLXtractor work. It also ripped the textures well (in *.png format). It even produced some kind of models but they were just a complete mess of flat triangles. So close.

      Delete
    3. In fact it resembles the opening scene (top letf viewport):
      http://s17.postimage.org/kjk97xq7h/Bez_tytu_u.png
      But it's completely flat and as a result useless. :(
      Heartbreaking.
      I tried fiddling with settings but to no avail.

      Delete
    4. This comment has been removed by the author.

      Delete
    5. This comment has been removed by the author.

      Delete
    6. I tried glxtractor, I could not scale the flat object resulting from the capture... there was another opengl extractor, I'll try to find it.

      Delete
    7. It has something to do with "z buffer", the objects are flat because the buffer is not activated.. Dgvodoo has a "w buffer" option, but it runs on directx...

      Delete
  6. If anyone is interested, I've set up a GitHub repo for tools here: https://github.com/Kazade/Ignition-Tools

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. This comment has been removed by the author.

      Delete
  7. How can I contact you? I'm interested in ripping ignition 3d models to make a PSP homebrew version of the game. Thanks!

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  8. I want to contribute to this aswell . Time has passed but I could model 3D tracks , cars and create textures . I tried to build your converter but with no success .

    ReplyDelete