Dungeon Keeper Map Files Format Reference v1.1

Created by fans


Contents

Contents

1.0 Introduction to map files

1.1 Overview of map files

1.2 RNC compression

2.0 Map layout files

2.1 Tiles and subtiles

2.2 Slab .SLB files

2.3 Ownership .OWN files

3.0 Object lists files

3.1 Thing .TNG files

3.2 Action point .APT files

3.3 Static light .LGT files

4.0 Level graphics files

4.1 Making a world using cubes

4.2 Level style .INF files

4.3 Column .CLM files

4.4 Column position data .DAT files

4.5 Wibble .WIB files

4.6 Water/Lava Block .WLB files

5.0 Script files

5.1 Level script .TXT files

5.2 Script backup .OLD files

5.3 Adikted script .ADI files

6.0 Misellanous/unused files

6.1 Effects .EFF files

6.2 Description word .DOC files

6.3 Tile flags .FLG files

6.4 Room origin .ORI files

6.5 Version .VSN files

6.6 .TMN files

7.0 Credits

8.0 Changes log

9.0 References


1.0 Introduction to map files

Levels in Dungeon Keeper are written in multiple files. Storing a map in more than one file makes it easier to modify the map, but also may lead to problems when copying it, renaming or sharing with other people. Knowlegde of what specific files do, and how they look from inside is not crucial for mapmaker. Mapmaker only needs to know file format of the level script (.TXT file), which is explained in Dungeon Keeper Script Commands Reference.


1.1 Overview of map files

Levels are stored in .\Levels\ directory on Dungeon Keeper CD. If you want to modify them and use the modified ones, you will have to copy all the levels to your Dungeon Keeper directory. See Mapmakers Installation Instructions for details.

Level 1 (the first level), consists of the following files:

map00001.apt
map00001.clm
map00001.dat
map00001.doc
map00001.eff
map00001.flg
map00001.inf
map00001.lgt
map00001.old
map00001.ori
map00001.own
map00001.slb
map00001.tmn
map00001.tng
map00001.txt
map00001.vsn
map00001.wib
map00001.wlb

Not all of these files are required to play the map. The crucial files are listed above. If you want to save disk space, or publish the map in Internet, you only require those files:

map00001.apt
map00001.clm
map00001.dat
map00001.inf
map00001.lgt
map00001.own
map00001.slb
map00001.tng
map00001.txt
map00001.wib
map00001.wlb

Rest of the files is not used by the game. Note that if you're using ADiKtEd to modify the map files, there may be another file in the list:

map00001.adi

This file isn't used by the game, only by ADiKtEd. If you're uploading level for end users, and the uploaded version won't be edited anymore, then you may skip this file.


1.2 RNC compression

Several of the Dungeon Keeper files are compressed with Rob Northern Compression (RNC). You can tell if a file is compressed, as the first three bytes will be 'R' 'N' 'C'. The fourth byte is a 1 (as distinct from '1').

There's a compressor/decompressor available to download in many places, for example on Syndicate Series Unofficial Fan Site. Source code in C is available too. There is also version of the decompression with graphical interface in DKTools package.


2.0 Map layout files

.


2.1 Tiles and subtiles

Each map is divided into 85x85 playing tiles, as seen on the map. Each tile is sub-divided into 3x3 subtiles - look at the game carefully, examining tiles, and trying to break them into subtiles, and you'll see what I mean. I'll use the terminology above extensively, be sure you understand what I mean.


2.2 Slab .SLB files

The .SLB file is basically main file of every map. It contains information about map layout - says which subtile is places on which position. The file consist of a two-byte entry for every map tile.

Using .SLB file, the .CLM and .DAT files can be autogenerated.

Slab values used in Dungeon Keeper are:

NumberSlab NumberSlab
0Rock 22Torture room
1Gold 24Training room
2Earth 26Dungeon Heart pedestal
3Earth with torch plate 28Workshop
4Wall 30Scavenger room
5Wall 32Temple
6Wall 34Graveyard
7Wall 36Hatchery
8Wall 38Lair
9Wall 40Barracks
10Unclaimed path 42/43Wooden door
11Claimed land 44/45Braced door
12Lava 46/47Iron door
13Water 48/49Magic door
14Portal 51Bridge
16Treasure room 52Gem
18Library 53Guardpost
20Prison

2.3 Ownership .OWN files

The file has one byte corresponding to every subtile on the map. It also defines the border subtiles, which are invisible. Border subtiles are: one at start and one at end of every column/row, so they are indexed 0 and 255.

Here is the list of proper values as C defines:

#define PLAYER0                0x00
#define PLAYER1                0x01
#define PLAYER2                0x02
#define PLAYER3                0x03
#define PLAYER_GOOD            0x04
#define PLAYER_UNSET           0x05

Note: All nine subtiles of every tile should be owned by the same player.


3.0 Object lists files

These files consists of number of entries followed by the list of entries. Every entry in such file has identical length.

For objects which are placed on map, entries contain coordinates where the object is. Those coordinates are always stored in same form:


3.1 Thing .TNG files

Notes: A table of known values is below.

Most of objects in Dungeon Keeper are things. These are all objects which generate graphics effects with bitmap (2D) images.

Things can have various "types". Each thing type has different features. Here is a list of known types as C defines:

#define THING_TYPE_NONE        0x00
#define THING_TYPE_ITEM        0x01
#define THING_TYPE_CREATURE    0x05
#define THING_TYPE_ROOMEFFECT  0x07
#define THING_TYPE_TRAP        0x08
#define THING_TYPE_DOOR        0x09

For every thing type, the meaning of some data is different:

Item/decoration subtype values (numbers are decimal):

NumItemNumItemNumItem
1Barrel 46Chicken spell 91Increase level
2Torch 47Destroy walls spell92Make safe
3Gold Chest (500) 48Time bomb spell93Reveal hiddn world
4Temple statue 49Hero gate 94Boulder trap box
5Dungeon heart 50Spinning key 2 95Alarm trap box
6Gold Pot (250) 51Armour 96Poison gas trapbx
7Unlit torch 52Gold Hoarde 1 97Lightning trap bx
8Statue w/o flame 53Gold Hoarde 2 98Word of Pwr trpbx
9Growing Chicken 54Gold Hoarde 3 99Lava trap box
10Chicken 55Gold Hoarde 4 100Trap Dummy 2
11Hand of evil spell56Gold Hoarde 5 101Trap Dummy 3
12Create imp spell 57Wizard Lair 102Trap Dummy 4
13Must obey spell 58Barbarian Lair 103Trap Dummy 5
14Slap spell 59Archer Lair 104Trap Dummy 6
15Sight of evil spell60Monk Lair 105Trap Dummy 7
16Call to arms spell61Dwarfa Lair 106Door Wood box
17Cave in spell 62Knight Lair 107Door Brace box
18Heal creature spell63Avatar Lair 108Door Steel box
19Hold audience spell64Tunneller Lair 109Door Magic box
20Lightning spell 65Witch Lair 110Workshop Item
21Speed creature spell66Giant Lair 111Heart flame(red)
22Protect creatr spell67Fairy Lair 112Disease
23Conceal creatr spell68Thief Lair 113Scavenger eye
24Null1 69Samurai Lair 114Workshop machine
25Null2 70Horny Lair 115Guard Flag(red)
26Anvil 71Skeleton Lair 116Guard Flag(blue)
27Prison bar 72Goblin Lair 117Guard Flag(green)
28Candlestick 73Dragon Lair 118Guard Flag(yellow)
29Gravestone 74Demonspawn Lair119Flagpost
30Horny Statue 75Fly Lair 120Heart flame(blue)
31Training post 76Dark Mistress Lair121Heart flame(green)
32Torture spike 77Sorceror Lair 122Heart flame(yellw)
33Temple Spangle 78Bile Demon Lair123Power Sight
34Potion1 79Imp Lair 124Power Lightning
35Potion2 80Bug Lair 125Torturer
36Potion3 81Vampire Lair 126Orc Lair
37Power hand 82Spider Lair 127Power Hand Gold
38Power hand grab 83Hell Hound Lair128Spinning Coin
39Power hand whip 84Ghost Lair 129Statue 2
40Chicken stable 85Tentacle Lair 130Statue 3
41Chicken wobble 86Reveal map 131Statue 4
42Chicken crack 87Resurrect creatre132Statue 5
43Gold (200) 88Transfer creature133Statue 6
44Spinning key 89Steal hero 134Armageddon Spell
45Disease spell 90Multiply creatres

Creature subtype values (numbers are hexadecimal):

Number (hex)Creature Number (hex)Creature
1Wizard 11Dragon
2Barbarian 12Demon spawn
3Archer 13Fly
4Monk 14Dark Mistress
5Dwarf 15Warlock
6Knight 16Bile demon
7Avatar 17Imp
8Tunneller 18Beetle
9Witch 19Vampire
aGiant 1aSpider
bFairy 1bHell hound
cThief 1cGhost
dSamurai 1dTentacle
eHorned Reaper 1eOrc
fSkeleton 1fFloating spirit
10Troll

Room effect subtype values

Number (hex)Effect
2Dripping water
4Dry ice

Trap values

Number (hex)Trap
1Boulder
2Alarm
3Poison gas
4Lightning
5Word of Power
6Lava

Door subtype values

Number (hex)Door
1Wooden
2Braced
3Iron
4Magic

3.2 Action point .APT files

This file defines action points. After the four-byte header, there comes a list of 8-byte action points.


3.3 Static light .LGT files

The LGT file defines lights which, unlike torches, cannot be destroyed. It should be put in centre of large rooms and on lava.


4.0 Level graphics files

.


4.1 Making a world using cubes

Graphic on every subtile can be called column. Every column consists of textured cubes, put one on another. Typically, the tall columns (like rock, gems, earth...) are built using 5 cubes and a base block (which is the lowest cube).


4.2 Level style .INF files

The single byte defines texture number. Short description of available textures:

NumberTexture
1 Standard texture
Used in most of original campaign maps.
2 Ancient texture
This one has brighter walls than the first. Walls have Aztec drawings on these testures.
3 Winter texture
Walls with snow and ice drawings representing snow drops.
4 Snake Key texture
Walls with key of life and snake. The wall brick is brown in this texture, not red like on standard one.
5 Stone Face texture
Rough walls with red eyed face on. The walls are bright on this texture, nearly yellow.
6 Big Breasts texture
The woman reliefs on these textures have bigger breasts than standard.
7 Rough Ancient texture
Texture with ancient relief theme and rougher earth.
8 Skull Relief texture
On this texture walls are brighter than standard, and reliefs are representing skulls of various size.

4.3 Column .CLM files

Cube values:

Number (hex)Description
1-3Earth
4Unknown
5Earth
6-cUnknown
d-fPillar for portal
10-17Lair wall bits (main+corner)
18Earth torch plate
19Wall bottom section
1aPath
1e-25Lair border floor
26-2aUnknown
2bRock
2cRock
2dRock
2e-30Unknown
31Gold
32Gold
33Gold
34-38Unknown
39-3aTreasure room pillar
3b-3dUnknown
3eTreasure room pillar
3f-40Unknown
41Treasure room pillar
42Unknown
43-47Wall centres (players 0-4)
48Wall torch plate
49-4aDungeon heart pedestal pillar
4b-4cUnknown
4d-4eTop of blank wall
4f-50Stone wall bits
51Training wall main (bottom right)
52Brick
53Training wall main (bottom left)
54-5fWoman wall (4 layers)
60-68Twin wall (top 3 layers)
69-74Shagging wall (4 layers)
75-76Unknown
77Torch plate
78-7fUnknown
80Claimed non-centre
81-88Unknown
89-91Round portal centre
95-98Wall corner
99-9eTreasure wall main
9fTreasure room floor
a0-a2Drapes (player 0)
a3Unknown
a4Dungeon heart pedestal edge
a5-a7Unknown
a8-adLibrary wall main (2 layers)
aeLibrary floor
afLibrary floor (why two different?)
b0-b5Library bookcase
b6-bbUnknown
bc-bdPrison wall corner centre
be-bfUnknown
c0Claimed player 0 centre
c1Claimed player 1 centre
c2Claimed player 2 centre
c3Claimed player 3 centre
c7Claimed player 4 centre
c8-d0Prison floor/borders
d1-dbUnknown
dcDungeon heart pedestal centre
dd-e0Unknown
e1-e6Prison wall main (2 layers)
e8-f0Torture wall main (2 layers)
f2-f7Training wall main (top 2 layers)
f8Unknown
f9-faTraining wall pillar
fbTraining wall main (bottom middle)
fcTraining wall pillar
fdUnknown
feTraining border
ff-104Workshop wall main (2 layers)
105-106Unknown
107-109Workshop non-centre
10a-10bUnknown
10c-10eWorkshop wall corner centre
10f-114Scavenger wall main (2 layers)
115Unknown
116-118Scavenger wall corner
119-11dUnknown
11eTemple wall corner
11fUnknown
120Temple wall corner
121Dungeon heart part
122Temple wall corner
123Temple pool
124-125Unknown
126-12eTemple pool/magic door
12f-13aTemple wall main
14b-14eLibrary bookcase (ends)
14f-156Hatchery wall main
157Unknown
158Hatchery wall corner centre
159Hatchery pillar
15aHatchery border
15bHatchery wall corner centre
15c-162Unknown
163-16bWooden door
16c-174Braced door
175-17dIron door
17e-18dUnknown
185-18dBarracks main wall
18e-18fAxe for barracks pillar
190Centre of barracks corner column
191-1a8Unknown
1a9Centre of portal
1aa-1b1Unknown
1b2Graveyard wall right/left (middle layer)
1b3Graveyard wall right/left (bottom layer)
1b4-1b8Unknown
1b9Gems
1baGems
1bbGems
1bcGems
195-197Twin wall (bottom layer of picture)
19a-1a5Drapes (players 1-4)

In the original levels (and Unded ones, IIRC), only used subtiles have non-zero .clm entries. Adikted generates a standard .clm file, as this is much easier and has very few drawbacks as far as I can see. The table below gives (most of!) the values I know about. I haven't been particularly rigorous generating this table, but I'll add to it when I find some time. I've taken this entirely from my own source code (which in turn took most values from observations of original DK levels). Some cubes are used in several places; I've usually only put one use below. In the future, I hope to be able to show a picture of what each cube looks like (only one face is used, it's just rotated).


4.4 Column position data .DAT files

The file has two bytes corresponding to every subtile on the map. It also defines the border subtiles, which are invisible. Border subtiles are: one at start and one at end of every column/row, so they are indexed 0 and 255.

If you treat the value for a subtile as a signed integer, and take the absolute value (or rather, just reverse the sign - I've never seen a positive one), you get the entry number in the .clm file.

How visibility is calculated:
At the start of the game, a square is visible to a player if either it is owned by them or it is possible to reach that square from the dungeon heart without going through walls.


4.5 Wibble .WIB files

The file has one byte corresponding to every subtile on the map. It also defines the border subtiles, which are invisible. Border subtiles are: one at start and one at end of every column/row, so they are indexed 0 and 255.


4.6 Water/Lava Block .WLB files

Water and Lava Block files are used to mark where on the map the water and lava is located. Normally, liquid blocks are defined in SLB file. But if you will put a bridge over the water or lava, the information about what it really was is stored here.


5.0 Script files

.


5.1 Level script .TXT files

This is a pretty simple scripting language. There are no loops or jumps, and condition testing is very basic. There are only three statement forms - conditions, commands, and condition terminators. Conditions are naturally nested, but that's about as complicated as it gets.

Each line contains a single instruction. Whitespace in the form of spaces and tabs is ignored. Comments begin with REM. All unconditional commands (ie ones outside any condition statements) are executed at the beginning of the game, then ignored. All conditions are checked at regular intervals.


5.2 Script backup .OLD files

This file contains just a previous version of the level script (.TXT file). The .OLD files are created by some text editors as a backup.


5.3 Adikted script .ADI files

This is a text file which contains ADiKtEd script for levels which were edited using ADiKtEd. The script stores commands which are specific to ADiKtEd and cannot be used by the game or any other editor. Using this file, ADiKtEd can support some special functions, which were originally not supported by the game, such as Graffiti or Custom Columns.


6.0 Misellanous/unused files

Here you can find description of files which are unused because of various reasons.


6.1 Effects .EFF files

These were planned to be one of Object lists files. Unfortunately, they were never finished. The game never even tries to load the .EFF files. They are completely unused.


6.2 Description word .DOC files

These files are Microsoft Word documents, which were made as a text description of the map. Using a commercial program to write map descriptions wasn't very good idea, so the descriptions were abandoned.

Descriptions of the original maps in DOC files are inaccurate, incomplete and sometimes they are only templates without any information.

If you wish to create description of your map, you should use text files (ie. call it .NFO), HTML documents (.HTM), or Rich Text Format (.RTF). Using Ms Word format is not recommended.


6.3 Tile flags .FLG files

.


6.4 Room origin .ORI files

.


6.5 Version .VSN files

These files were supposed to create versioning system. The file contains one byte, which is always 01 in original maps.

The game engine isn't loading these files, neither any of the level editors.


6.6 .TMN files

These files, similar to INF, consists on only one byte. But it is not certain if they always have size of 1 - maybe the first byte defines number of entries.


7.0 Credits

Documentation creator: Tomasz Lis

Used information provided by: Jon Skeet


8.0 Changes log

Version 1.1

Version 1.0


9.0 References

  1. Dungeon Keeper Mapmaker's Documentation
  2. Dungeon Keeper Script Commands Reference