-
Notifications
You must be signed in to change notification settings - Fork 23
Map file
Julian Offenhäuser edited this page Sep 1, 2019
·
15 revisions
The map file format is currently unknown (at least mostly). Parts of the map file are compressed using the PKWARE algorithm, a good resource to check out how it works is https://github.com/madler/zlib/blob/master/contrib/blast/. Here's some stuff I found out, assuming 160x160 map size and no scenario description is given:
- uint32_t: Magic number (always 0xFFFFFFFF)
- uint32_t: Unknown (probably a counter of some sort)
- uint32_t: Unknown (always 0x409E0000)
- uint32_t: Length of the map preview in pixels
- The file is composed of multiple sections, some of which are compressed. They start with a 12-byte header (3 x uint32_t?), where bytes 4-8 specify the size of the following block of compressed data
- The mission description is stored right after the map preview, look for a 0x00 followed by 0x04-0x06 to find the start of the compressed text, the uncompressed text is padded to 1000 byte length
- At the very end of the file, the filename is encoded for campaign missions, every other defaults to "mission9.map"
- The map data is stored in two halves, i.e. top-right edge and bottom-left edge
- After the header and some data (presumably the map preview or description), there's the byte
5D
, maybe some marker or ID. 8 bytes after that, there's one byte which seems to be the map type (invasion, etc). 4 bytes after that, there appears to be some kind of locking mechanism (4 bytes), as changing any of them to nonzero will cause the map to be hidden in the loading menu. I presume the structure looks something like this:
struct SomeInfo {
uint32_t ID; // 0x5D
uint32_t u1; // 0x02
uint32_t u2; // 0x03
uint32_t lock;
enum MapType : uint8_t {
SIEGE,
INVASION,
ECONOMIC,
LANDSCAPE
} type;
}
Since the file changes around in a (so far) seemingly random way, the following offsets are wrong but can be used to calculate the relative offsets.
- 0x43A77: Popularity (1 byte, 0x00 - 0x64)
- 0x439C7: Year (2 bytes)
- 0x439CB: Month (1 byte, January = 0x00)
- 0x439D7: Starting goods (4 bytes each, signed). Order (incomplete):
- Wood
- Hops
- Stone
- ?
- ?
- Iron
- ?
- Tar
- Grain
- Bread
- Cheese
- Meat
- Apples
- Beer
- Gold
- ?
- Bows
- Crossbows
- Spears
- Pikes
- Maces
- Swords
- Leather armor
- Armor