Decoding - Map Files



This section has information about the construction of the game files and how to edit them. If you know something about a that there is no information available about, please contribute! Provided are documents, descriptions and tools allowing you to edit the files.

The information here is based on The Peasants Rebellion, unless otherwise stated!





Contents: The MAP files contain the terrain data used by the game missions. Included with the terrain data are also trees and bushes (but no buildings or units).
Status: ~90%
Footer unknown
Contributors: The Barbarian
Jan van Kranendonk
Documents: Lewin doc.gif
Tools: Jan van Kranendonk download.png
Krom download.png
Qage download.png





Instead of just writing something random here, I think it's best to just copy over the stuff Lewin wrote in his very useful document (that can also be downloaded above).



Lewin's Descriptions of the Knights and Merchants map files


To get the values that I will be talking about in the rest of this file, you should get the ordinal value of the byte. In delphi that would be ord(); e.g. 'u' has an ordinal value of 75, and ÿ is 255


The first byte in the file is the width of the map. (The number of tiles across)
The next 3 bytes are always 0.
The fifth byte in the file is the height of the map. (The number of tiles down)
The next 3 bytes are always 0.


Then the following sequence of 23 bytes start, with the data for each tile.


Byte Number What it does Description
1 Type of terrain This tells you which tile is on this square. It is an index into the terain files that the graphics reader extracts.
2 Unknown Might be light, but has no visible affect.
3 3D Height This sets how high the top left of this tile is. From 0 to 100.
4 Rotation This tells you how many times the tile is rotated to the right. This can be more than 3 though, so 4 means rotate it 4 times, and that puts you back at 0. I don't know why they do it like this.
5 Unknown  
6 Objects This tells you what object (trees, etc.) are on this tile.
7 Whether you can walk or not. According to Jan van Kranendonk (who made the very first map editor) this is whether you can walk or not:
0 = Can’t walk, can’t build
150 = Can walk, can’t build
255 = Can walk, can build
This is also done automaticly by the game. (e.g. you can’t walk on water) This is probably for overriding that if necessary.
8 Always 255  
9 Always 255  
10 Always 255  
11 Always 255  
12 Unknown Maybe something to do with resources
13 Unknown Maybe something to do with resources
14 Always 0  
15 Unknown Might be something to do with byte 2 and light
16 Always 255  
17 Always 205  
18 Always 0  
19 Always 0  
20 Always 0  
21 Always 0  
22 Always 0  
23 Always 0  


This sequence is repeated going from the top left, one row at a time for the whole file.


After that is some infomation about where resources are, eg. Coal, stone, gold and maybe fish.
I do not understand how this works but if you do please update this file and send it to me.


If you correct any mistakes or add anything, please send it to me.



Copyright 2007 Lewin Hodgman.



Email: REMOVED (Download document to see)


This file can be publicly published for free only, so long as my name is on it.
This file can be edited/fixed/changed to make it more relevent as needed, as long as I am notified.



If you have any further questions, I recommend that you send an e-mail to lewin. His e-mail can be found from the document above. New discoveries about the unknown bytes are also more than welcome!