Des-file format

des-file format is the language which is used to describe the special levels for NetHack. It is compiled into a binary file by lev_comp.

There are two types of levels you can create: mazes and rooms. For MAZE-type levels you "draw" one or more maps with ASCII characters and then describe the monsters, objects and so on that are in the map. For ROOM-type levels, you describe rooms and their contents. The maze-levels are easier to make and understand, and room-type levels do not offer as much control over the level.

Language syntax
All lines beginning with # are comments and are ignored by the level compiler, except between MAP and ENDMAP.

Example:
 * 1) This is a comment.

MAZE-type levels
Maze-type levels begin with MAZE, followed with optional FLAGS, optional INIT_MAP, 0 or more MESSAGEs and up to 9 maze-parts, each of which consists either of NOMAP or GEOMETRY and MAP, followed by zero or more the random register initializers, one of each (RANDOM_MONSTERS, RANDOM_OBJECTS, RANDOM_PLACES), followed by zero or more of the map details (everything else, eg. MONSTER, OBJECT, TRAP, etc.)

That is:


 * MAZE
 * FLAGS, optional
 * INIT_MAP, optional
 * MESSAGE, 0 or more
 * up to 9 map-parts, which consist of:
 * NOMAP or GEOMETRY and MAP
 * RANDOM_MONSTERS, optional
 * RANDOM_OBJECTS, optional
 * RANDOM_PLACES, optional
 * The rest of the definitions of this map-part

Example: MAZE:"test",' ' FLAGS:noteleport MESSAGE:"Welcome!" GEOMETRY:center,center MAP ..... .L.L. ..... .L.L. ..... ENDMAP MONSTER:random,random,random OBJECT:'%',random,random

MAZE
MAZE:"foo",'X' Example: MAZE:"soko3-2",' '
 * foo is the unique file name which will be used for this special level, up to 8 characters. For example: soko3-2.
 * 'X' is the fill map character. The map will be filled with this dungeon feature before anything else is done.

FLAGS
FLAGS:flaglist flaglist is one or more of the following flags, separated by commas Example: FLAGS:noteleport,hardfloor
 * noteleport: Player cannot teleport within the level.
 * hardfloor: The floor is too hard to dig.
 * nommap: magic mapping does not work.
 * arboreal</tt>: supposedly an outdoor map. Basically solid walls will be trees, and corridors are not used.
 * shortsighted</tt>: Monsters cannot see you from far away.

INIT_MAP
INIT_MAP:'X', 'Y', smoothed, joined, lighted, walled This causes the level map to be initialized with a random map generator, similar to how the random Gnomish Mines look like. Each MAZE-level can contain only 0 or 1 of these definitions. Examples: INIT_MAP: 'L', '.', false, false, unlit, false INIT_MAP: '.', ' ', true, true, random, true
 * 'X'</tt> is the "foreground" fill map character.
 * 'Y'</tt> is the "background" fill map character.
 * smoothed</tt> is either true</tt> or false</tt>, and denotes whether the level will be "smoothed"
 * joined</tt> is either true</tt> or false</tt>, and denoted whether the level will be "joined".
 * lighted</tt> is either lit</tt>, unlit</tt>, or random</tt>
 * walled</tt> is either true</tt> or <tt>false</tt>.

MESSAGE
MESSAGE:"string" You can have 0 or more of these per special level. <tt>"string"</tt> is any message you want player to see when entering the level. Example: MESSAGE: "Well done, mortal!"

NOMAP
NOMAP Instead of GEOMETRY and MAP, you use this if you think that INIT_MAP creates a good enough random map and you don't want to use any fixed map-parts.

GEOMETRY
GEOMETRY:xadj,yadj This must be followed by a MAP definition, and tells the approximate position of the following MAP-part on the level. Example: GEOMETRY:left,top
 * <tt>xadj</tt> is one of <tt>left</tt>, <tt>half-left</tt>, <tt>center</tt>, <tt>half-right</tt>, <tt>right</tt> or <tt>random</tt>
 * <tt>yadj</tt> is one of <tt>top</tt>, <tt>center</tt>, <tt>bottom</tt> or <tt>random</tt>

MAP
MAP ... ... ... ENDMAP

This must be preceded by GEOMETRY definition. You define a map-part by "drawing" with map characters between the MAP and ENDMAP. The map can be up to 21 lines high and and each line can be up to 76 chars long. Each line must also be the same length.

OBJECT
OBJECT:'X',"name",place Each map-part can contain any number of object definitions. Examples: OBJECT:'%',"food ration",random OBJECT:'*',random,(10,10) OBJECT:'?',"genocide",place[0]
 * <tt>'X'</tt>: a character denoting one of the object classes.
 * <tt>"name"</tt>: either an object name as listed in objects.c, or <tt>random</tt>
 * <tt>place</tt>: either a coordinate, a RANDOM_PLACES place, or <tt>random</tt>

NON_DIGGABLE
NON_DIGGABLE:region Sets the walls inside the region as non-diggable. Example: NON_DIGGABLE:(00,00,13,12)

NON_PASSWALL
NON_PASSWALL:region Players and monsters cannot phase through the walls inside the region Example: NON_PASSWALL:(00,00,13,12)

TRAP
TRAP:"name",place Examples: TRAP:"hole",(12,10) TRAP:"anti magic",random TRAP:random,random
 * <tt>"name"</tt> is the trap's name, or <tt>random</tt>
 * <tt>place</tt> is either a coordinate, a RANDOM_PLACES place, or <tt>random</tt>

MONSTER
MONSTER:'X',"name",place
 * <tt>'X'</tt> is the monster class symbol, or <tt>random</tt>, or a RANDOM_MONSTERS index
 * <tt>"name"</tt> is the specific monster, or <tt>random</tt>
 * <tt>place</tt> is either a coordinate, a RANDOM_PLACES place, or <tt>random</tt>

You can also put some other things in there to further define the monster. See the examples below.

Examples: MONSTER:'v',"dust vortex",(42,05) MONSTER:'E',"earth elemental",(39,06),peaceful MONSTER:'&',"Pestilence",place[0],hostile MONSTER:random,random,random MONSTER:random,random,(01,01), asleep MONSTER:monster[0],random,(27,05) MONSTER:'m',"giant mimic",place[1],m_feature "fountain" MONSTER:'m',random,place[0], m_object "luckstone" MONSTER:'@',"rogue",(35,06),peaceful,"Pug"

RANDOM_PLACES
RANDOM_PLACES:place,... With this command you can set up to 10 coordinate registers, which you can access by using <tt>place[N]</tt> instead of a coordinate in any other command. The registers are shuffled at level creation time.

Example: RANDOM_PLACES:(23,9),(37,14),(51,9) OBJECT:'?',"genocide",place[0]

RANDOM_MONSTERS
RANDOM_MONSTERS:'X',... With this command you can set up 10 monster symbol registers, which you can access by using <tt>monster[N]</tt> instead of a monster symbol in any other command. The registers are shuffled at level creation time.

Example: RANDOM_MONSTERS: 'E', 'X' MONSTER:monster[0],random,(27,05)

RANDOM_OBJECTS
RANDOM_OBJECTS:'X',... With this command you can set up 10 object class symbol registers, which you can access by using <tt>object[N]</tt> instead of a object class symbol in any other command. The registers are shuffled at level creation time.

Example: RANDOM_OBJECTS:'[',')','*','%' OBJECT:object[0],random,(39,05)

DOOR
DOOR:state,place Puts a door on the map.
 * <tt>state</tt> is one of the following: <tt>nodoor</tt>, <tt>locked</tt>, <tt>closed</tt>, <tt>open</tt> or <tt>random</tt>
 * <tt>place</tt> is either a coordinate, a RANDOM_PLACES place, or <tt>random</tt>

Example: DOOR:locked,(10,5)

DRAWBRIDGE
DRAWBRIDGE:place,dir,state
 * <tt>place</tt> is either a coordinate, a RANDOM_PLACES place, or <tt>random</tt>
 * <tt>dir</tt> is one of the following: <tt>north</tt>, <tt>east</tt>, <tt>south</tt> or <tt>west</tt>
 * <tt>state</tt> is one of the following: <tt>nodoor</tt>, <tt>locked</tt>, <tt>closed</tt>, <tt>open</tt> or <tt>random</tt>

Note that the drawbridge placement is different from door placement; the coordinate must be a place where the drawbridge would be when it's open, and from that place towards the direction there should be a wall, where the portcullis will be.

Example: DRAWBRIDGE:(25,18), north, closed

REGION
REGION:(x1,y1,x2,y2), lighted, "type" Define a region on the map with certain light-state and type.
 * <tt>lighted</tt> is either <tt>lit</tt> or <tt>unlit</tt>.
 * <tt>"type"</tt> is one of the room types.

You can add <tt>filled</tt> or <tt>unfilled</tt>, it will denote whether the room will get stocked with the normal monster or objects it would get. After that you can add <tt>true</tt> or <tt>false</tt> to denote whether the room is irregularly shaped. If the room is irregular, only the first coordinate (x1,y1) must be inside the room, and the room must be closed off from other areas with non-floor map characters. Use the boundary symbol <tt>'B'</tt> in the MAP to enclose an irregular room.

Examples: REGION:(43,12,49,16),unlit,"ordinary" REGION:(12,01,20,09),unlit,"morgue",unfilled REGION:(11,03,29,10),lit,"temple",filled,true

Trap names
"anti magic", "arrow", "bear", "board", "dart", "falling rock", "fire", "hole", "land mine", "level teleport", "magic portal", "magic", "pit", "polymorph", "rolling boulder", "rust", "sleep gas", "spiked pit", "statue", "teleport", "trap door", "web"

Room types
"ordinary", "throne", "swamp", "vault", "beehive", "morgue", "barracks", "zoo", "delphi", "temple", "anthole", "cocknest", "leprehall", "shop", "armor shop", "scroll shop", "potion shop", "weapon shop", "food shop", "ring shop", "wand shop", "tool shop", "book shop", "candle shop"