King's Bounty Map Format

From ModdingWiki
Jump to: navigation, search
King's Bounty Map Format
There is no image of a map in this format — upload one!
Format typeMap/level
Map type2D tile-based
Layer countUnknown
Viewport (pixels)Unknown

This format is used to store the world map for King's Bounty in both it's initial state (LAND.ORG file) and in modified, randomized state (in the *.DAT save files at offset 0xFC5). Consequently, there are minor format differences, described below.

File format

The map always takes exactly 16384 bytes. As there are 4 continents 64 x 64 tiles each, and each tile takes 1 byte, all continents start at a convenient offset - 0x0000, 0x1000, 0x2000 or 0x3000.

Data type Description
BYTE map[4][64][64] Map data


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.


When a new game is first created, the initial map data is read and then the following values are replaced:

0xFF - continent start           -> 0x20 - sea tile
0x8B - put something random here -> 0x8B - 0x93 , but not 0x90
0x8E - archmage's alcove         -> 0x00 (for mages) / 0x8E (for rest)

Note, that the 0x8B index is used in both initial and salted data with different meanings - it stands for random object in LAND.ORG, and a treasure chest in the save files.


The tileset is kept inside the tileseta.* and tilesetb.* graphic files. Each file contains 36 tiles, making 72 in total. Additionally, tilesalt.* contains replacements graphics for tiles 0x11-0x13 for continents 2-4. Each level byte with it's most significant bit cleared maps directly into that range (0x00-0x47). The high bit signifies if the tile is interactive, and those high-bit versions are always used instead of the regular indexes:

0x80 - magic barrier (blocks followers)
0x85 - castle gate
0x8A - town
0x8B - treasure chest
0x8C - plains dwelling
0x8D - forest dwelling
0x8E - cave dwelling (multiple purposes)
0x8F - dungeon dwelling
0x90 - sign
0x91 - follower
0x92 - artifact 1
0x93 - artifact 2

Constant Locations

Those locations are hard-coded into the game and can not be changed from within the map:

X=11 Y=7  - King's Castle
X=11 Y=6  - Retreat location
X=11 Y=5  - Starting Location
X=11 Y=3  - Continent 1 starting location
X=1  Y=37 - Continent 2 starting location
X=14 Y=62 - Continent 3 starting location
X=9  Y=1  - Continent 4 starting location
X=11 Y=19 - Archmage's Alcove


Originally devised by the openkb project, with best regards to the modding community. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)