King's Bounty Saved game Format
This format is used to save the whole game state for King's Bounty.
As the save files do not require re-insertion into group files, nor are compressed, yet maintain their own full copies of the game world, they provide good opportunity to distribute custom levels or maps.
A save always takes exactly 20421 bytes.
0x000 - 0x00A | name 0x00B | class 0x00C | rank 0x00D | spell power 0x00E | max # of spells 0x00F - 0x01F | is villain N caught 0x020 - 0x027 | is artifact N found 0x028 - 0x02B | is continent N available 0x02C - 0x02F | is orb N found 0x030 - 0x03D | number of spells N 0x03E | knows magic 0x03F | siege weapons 0x040 | current contract 0x041 - 0x045 | hero army 0x046 | Option: Delay (0-9) 0x047 | difficulty 0x048 | Option: Sounds 0x049 | Option: Walk Beep 0x04A | Option: Animation 0x04B | Option: Show Army Size 0x04C | hero continent 0x04D | hero X 0x04E | hero Y 0x04F | last X 0x050 | last Y 0x051 | boat X 0x052 | boat Y 0x053 | boat continent (0xFF - no boat) 0x054 | mount mode (0x00 - boat, 0x04 - fly, 0x08 - horse) 0x055 | Option: CGA palette 0x056 - 0x069 | spell sold in town N 0x070 - 0x074 | contract cycle (5 villains) 0x075 | last contract (starts as 0x04 to flip to 0x00 on first run) 0x076 | max contract (starts as 0x05) 0x077 | steps left (until end of day) 0x078 - 0x092 | castle owned by... (0x7F = no one, 0xFF = you, LOW 5 bits = villain) 0x093 - 0x0AC | visited castle N 0x0AD - 0x0C6 | visited town N 0x0C7 | scepter continent ('encrypted') 0x0C8 | scepter X ('encrypted') 0x0C9 | scepter Y ('encrypted') 0x0CA - 0x8C9 | fog of war (1bpp) 0x8CA - 0x94B | garrison troops 0x94C - 0x973 | followerF coords (2 bytes each, 5 per continent) 0x974 - 0x979 | map chests coords (2 bytes each, 1 per continent) 0x97a - 0x981 | orb chests coords (2 bytes each, 1 per continent) 0x982 - 0x991 | teleporter coords (2 bytes each, 2 per continent) 0x992 - 0x9E9 | dwelling coords (2 bytes each, 11 per continent) 0x9EA - 0xB01 | followerH coords (2 bytes each, 35 per continent) 0xB02 - 0xCA5 | followerH troops (3 bytes each) 0xCA6 - 0xE49 | followerH numbers (3 bytes each) 0xE4A - 0xE75 | creature of dwelling N 0xE76 - 0xEA1 | population of dwelling N 0xEA2 | scepter key (to XOR scepter coords with) 0xEA3 - 0xEA4 | base leadership 0xEA5 - 0xEA6 | leadership 0xEA7 - 0xEA8 | commission 0xEA9 - 0xEAA | followers killed 0xEAB - 0xEB4 | hero army numbers 0xEB5 - 0xFB8 | garrison numbers 0xFB9 - 0xFBA | time stop ("free" steps left) 0xFBB - 0xFBC | days left 0xFBD - 0xFBE | score (never actually used) 0xFBF | ? // unknown1, always "00" 0xFC0 | ? // unknown2, always "00" 0xFC1 - 0xFC4 | gold 0xFC5 - END | map dump
- Player name is padded with spaces
- There are 26 castles, 26 towns, 17 villains, 25 troops, 14 spells and 4 continents in the game.
- Coordinates always take 2 bytes and always go in X, Y order.
- Scepter coordinates are XORed with scepter key upon load/save.
- Troop and villain indexes are in production order (as seen in .CC files).
- Dwelling populations are kept in BYTEs, 250 being maximum possible value.
- Hero and castle army numbers are kept in UINT16LEs, 5 per army.
- Hostile followers only have 3 troops and their numbers are kept in BYTEs.
- The mount mode is also an offset into hero's sprite-sheet.
- The map is a complete dump in King's Bounty Map Format.
The game is consistent with it's map coordinate system, which goes in the bottom-to-top, left-to-right order. That means top left corner has coordinate X=0, Y=63.
Originally devised by the openkb project, with best regards to the modding community.