Decoding the Map File

January 2004
Wonka

Introduction:
I will describe how the winbolo map file is decoded. The map used in this example is Baringi.map. This document is based on the Map File Format.txt document located in Winbolo\Sample Code folder. That document doesn't give an example of what a map file looks like, nor how a single row (run) is broken down.

The map file starts off with a header consisting of BMAPBOLO and the version number.
42 4D 41 50 42 4F 4C 4F BMAPBOLO
01 Version 1

The next 3 words define the number of pills, bases, and starting locations
10 10 08 16 pills, 16 bases, 8 starting points

Next is a variable length array of pill locations. The number of entries is based on the number of pills defined.
7F 6E FF 0F 32 The x-location is 7F (127), y-location is 6E (110), FF shows that it is a nuetral pill. 0F shows that the pill is at full strength. and 32 shows how angry the pill is.

Next is the array of base definitions.
6C 91 FF 5A 5A 5A The first two words are the x,y locations like the pill definitions had. FF is the owner. the next 3 words defines the Armour, Shells, and pill stocks. In this case all 3 have 5A (90).


Next are the starting point definitions.
69 69 0E 69, 69 are the x,y coordinates. 0E is the direction the tank is pointing when it is reborn.


Next is the hardest part of map decoding, and that is the run. Here is the definition from the Map File Format.txt document located in Winbolo\Sample Code folder.

The map is described by a series of horizontal 'runs' of non-deepsea squares. Any square of the map not included in any 'run' is deep sea. The data portion of each 'run' is subject to simple run-length encoding to save space.

Here is the first run from Baringi.map.
0D 67 6D 93 07 E5 17 8F 0D 01 87 E5 07
0D run length 0d (13 bytes)
67 row 67 (103)
6D column 6d (109)
93 last square, column 93 (147)
07 One square. Grass.
E5 8 trees (14 - 6 = 8)
17 8 2 squares. grass, shot building
F 0 9 buildings. (15 - 6 = 9)
D 0 7 buildings (13 - 6 = 7)
1 87 two squares. shot building, grass
E5 8 trees. (14 - 6 = 8)
07 One square, grass

So all decoded and strung together, the run looks like this:




First 233 bytes of Baringi.map
42 4D 41 50 42 4F 4C 4F 01 10 10 08 7F 6E FF 0F 32 80 6E FF 0F 32 80 91 FF 0F 
32 7F 91 FF 0F 32 6E 80 FF 0F 32 6E 7F FF 0F 32 91 7F FF 0F 32 91 80 FF 0F 32 
78 87 FF 0F 32 87 87 FF 0F 32 87 78 FF 0F 32 78 78 FF 0F 32 84 92 FF 0F 32 92 
7B FF 0F 32 7B 6D FF 0F 32 6D 84 FF 0F 32 6C 91 FF 5A 5A 5A 91 93 FF 5A 5A 5A 
91 6C FF 5A 5A 5A 6E 6C FF 5A 5A 5A 7F 93 FF 5A 5A 5A 93 80 FF 5A 5A 5A 80 6C 
FF 5A 5A 5A 6C 7F FF 5A 5A 5A 6C 6E FF 5A 5A 5A 93 6E FF 5A 5A 5A 93 91 FF 5A 
5A 5A 6E 93 FF 5A 5A 5A 79 86 FF 5A 5A 5A 79 79 FF 5A 5A 5A 86 79 FF 5A 5A 5A 
86 86 FF 5A 5A 5A 69 69 0E 96 69 0A 96 96 06 69 96 02 6A 68 0E 97 6A 0A 95 97 
06 68 95 02 0D 67 6D 93 07 E5 17 8F 0D 01 87 E5 07 0D 68 6D 93 07 E5 17 8F 0D