Skip to content

Map file

Julian Offenhäuser edited this page Jul 1, 2019 · 15 revisions

The map file format is currently unknown (at least mostly). Here's some stuff I found out, assuming 160x160 map size and no scenario description is given:

Header:

  1. uint32_t: Magic number (always 0xFFFFFFFF)
  2. uint32_t: Unknown (probably a counter of some sort)
  3. uint32_t: Unknown (always 0x409E0000)
  4. uint32_t: Length of the map preview in pixels

Random stuff (TODO)

  • The second header entry seems to be related to the shifting around of bytes
  • From 0xCD to 0x139, there's some block of data
  • The byte pattern C0 0F E0 07 F0 03 F8 01 FC 00 7E 00 3F 80 1F (or a variation of it) repeats a lot
  • At least two blocks of data always start with C0 D4 01 00
  • The map data is stored in two halves, i.e. top-right edge and bottom-left edge
  • The tile data is stored as such: After the header, description etc. is a block of zero's, then the word 0xF407, then the data for the first map part, followed by 0xF407 and the second part. Changing some of these bytes around will mess up the corresponding map part.
  • 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
Clone this wiki locally