# dungeon.def format
dungeon.def is the file that describes how the dungeon branches and what special levels are used and where. It is compiled into a binary file by dgn_comp

Contents

1 Comments
2 DUNGEON
3 ENTRY
4 DESCRIPTION
5 ALIGNMENT
6 PROTOFILE
7 BRANCH
8 CHAINBRANCH
9 LEVEL
10 RNDLEVEL
11 LEVELDESC
12 LEVALIGN
13 CHAINLEVEL
14 RNDCHLEVEL

Comments
All lines beginning with # are comments and are ignored by the compiler.
Example:

# This is a comment.

DUNGEON
DUNGEON: "name" "bonetag" (base, range)

This is used to define a new dungeon.

"name" is the name of the dungeon
"bonetag" is the character used in file names when a bones file is created in this dungeon, or "none", in which case no bones will be created in the dungeon.
base and range define the dungeon depth.
You can also add an optional integer, which is the chance of this dungeon being generated.
Example:

DUNGEON: "The Dungeons of Doom" "D" (25, 5)

ENTRY
ENTRY: lvl

Set the entry level for this dungeon. 0 means from the top, negative number means the level from the bottom (-1 is the bottom level), greater than 0 means the level number from the top of the dungeon.
Example:

ENTRY: -1

DESCRIPTION
DESCRIPTION: flag

Sets a flag for the previously defined DUNGEON. You can use as many DESCRIPTION lines as you want.
flag is one of the following flags:

town
hellish
mazelike
roguelike
Example:

DESCRIPTION: mazelike

ALIGNMENT
ALIGNMENT: flag

Sets the alignment for the previously defined DUNGEON. Only one of these per dungeon allowed.
flag is one of the following flags:

unaligned (or its synonym noalign)
lawful
neutral
chaotic
Example:

ALIGNMENT: lawful

PROTOFILE
PROTOFILE: "str"

Sets the special level prototype filename. This is used when loading the lev-file from disk. See MAZE in Des-file format.
Example:

PROTOFILE: "tower"

BRANCH
BRANCH: "name" @ (base, range) type dir

Adds a branch to the previously defined DUNGEON.

"name" is the name of the branch. You must later define a DUNGEON with the same name.
base and range define the depth where the branch occurs.
type is optional (defaults to stair), or one of the following:
stair, a two-way stair
no_up, no up staircase
no_down, no down staircase
portal, portal connection
dir is optional (defaults to down), or is one of the following:
up
down
Example:

BRANCH: "Vlad's Tower" @ (9, 5) up

CHAINBRANCH
CHAINBRANCH: "name" "chain" + (base, range) type dir

Adds a branch to the previously defined DUNGEON. This is similar to BRANCH, except the depth depends where a LEVEL occurs in the previously defined DUNGEON.

name is the name of the branch. You must later define a DUNGEON with the same name.
chain is a name of a previously defined LEVEL in this DUNGEON.
base and range define the branch depth, relative to chain.
type and dir as in BRANCH
Example:

CHAINBRANCH: "Gehennom" "castle" + (0, 0) no_down

LEVEL
LEVEL: "name" "bonetag" @ (base, range) chance

Adds a special level to the previously defined DUNGEON. See also RNDLEVEL.

name is the name of this special level, and is used for loading the special levels from disk. You must define a special des-level with the same name.
bonetag is a single character used in a filename when this level leaves a bones, or "none", in which case no bones will be created in the level. This should be unique among all special levels in this dungeon.
base and range define the branch depth
chance is optional, gives the&nbsp;% chance of this level existing in any given game.
Example:

LEVEL: "oracle" "O" @ (5, 5)

RNDLEVEL
RNDLEVEL: "name" "bonetag" @ (base, range) chance nlevels

Adds a special level to the previously defined DUNGEON, with several variants for the des-level. See also LEVEL.

name is the name of this special level, used for loading the special levels from disk. The name format will be name-num, where num is the variant of the level to be loaded. For example, bigrm-3. See also MAZE or LEVEL in the Des-file format article.
bonetag is a single character used in a filename when this level leaves a bones, or "none", in which case no bones will be created in the dungeon. This should be unique among all special levels in this dungeon.
base and range define the branch depth
chance is optional, gives the&nbsp;% chance of this level existing in any given game.
nlevels is the number of different special level layout versions or variants for this particular level.
Example:

RNDLEVEL: "bigrm" "B" @ (10, 3) 40 5

LEVELDESC
LEVELDESC: flag

Defines flags for a previously defined LEVEL or RNDLEVEL.
flag is the same as DESCRIPTION has.
Example:

LEVELDESC: town

LEVALIGN
LEVALIGN: flag

Defines alignment of a previously defined LEVEL or RNDLEVEL.
flag is the same as ALIGNMENT has.
Example:

LEVALIGN: chaotic

CHAINLEVEL
CHAINLEVEL: "name" "bonetag" "chain" + (base, range) chance

Adds a special level to the previously defined DUNGEON. This is similar to LEVEL, except the depth depends where another LEVEL occurs in the previously defined DUNGEON.

name is the name of this special level. used for loading the special levels from disk.
bonetag is a single character used in a filename when this level leaves a bones, or "none", in which case no bones will be created in the level. This should be unique among all special levels in this dungeon.
chain is a name of a previously defined LEVEL in this DUNGEON.
base and range define the level depth, relative to chain.
chance is optional, gives the&nbsp;% chance of this level existing in any given game.
Example:

CHAINLEVEL: "wizard2" "X" "wizard1" + (1, 0)

RNDCHLEVEL
RNDCHLEVEL: "name" "bonetag" "chain" + (base, range) chance nlevels

Adds a special level to the previously defined DUNGEON, with several variants for the des-level. This is similar to CHAINLEVEL, except the depth depends where another LEVEL occurs in the previously defined DUNGEON.

name is the name of this special level. used for loading the special levels from disk. The name format will be name-num, where num is the variant of the level to be loaded. For example, bigrm-3. See also MAZE in MAZE or LEVEL in the Des-file format article.
bonetag is a single character used in a filename when this level leaves a bones, or "none", in which case no bones will be created in the level. This should be unique among all special levels in this dungeon.
chain is a name of a previously defined LEVEL in this DUNGEON.
base and range define the level depth, relative to chain.
chance is optional, gives the&nbsp;% chance of this level existing in any given game.
nlevels is the number of different special level layout version for this particular level.

This page may need to be updated for the current version of NetHack.
It may contain text specific to NetHack 3.4.3. Information on this page may be out of date.
Editors: After reviewing this page and making necessary edits, please change the {{nethack-343}} tag to the current version's tag or {{noversion}} as appropriate.