Let’s Make: Traffic Department 2192 – Part 11

Assets - Analyzing Map Files

Maps are the first asset from the original Traffic Department 2192 archive that we don't be converting in to another form. But we still have to understand how they work so that we can exploit these data in our engine. We're interested in these five files: INTRO.MAP, TD.MAP, TD2.MAP, TD3.MAP, and TD4.MAP. We're only going to focus on TD.MAP since that covers the first episode. All of the files

Map File Format

All TD?.MAP files are exactly the same size of 40,401 so were likely dealing with a fixed file format. There is no file header and no indication that this is a structured archive. You may have noticed that 40,401 is a perfect square for 201. The map files represent the 201 x 201 background map sprites drawn by referencing the frames from the BLK sprite file. Another caveat is that these data are stored in column major sequence meaning that the graphics shown in the file versus those drawn in game appear flipped with respect to the diagonal of the square. (Watch the video for a more detailed explanation).

Map File Usage

We'll load map files as-is in to GameMaker for the prototype. Theese data accurately reference the sprite frame numbers we'll draw with the BLK sprite strip. We'll have to do some extra work to determine which sprites represent a barrier or building and which ones are passable areas such as roads and desert. Bottom Line: The MAP files tell us which sprites to draw from which we can infer which sprites are passable or not.

The following graphic represents the connection between the BLK and Map byte data. Most of these are buildings and barriers but some are open spaces (ex. 0x0F, 0x10, 0x31-0x33, and more):

The relationship between BLK files and MAP files

 

Map Loader in Python

In the video, we analyzed the map file by loading it with the following script executed in the same directory with TD.MAP: