Des-file format

From NetHackWiki
Revision as of 11:16, 10 September 2006 by Paxed (talk | contribs) (add some more stuff)
Jump to navigation Jump to search

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.

Language syntax

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

# 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:

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'
  • 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.

Example:

MAZE:"soko3-2",' '

FLAGS

FLAGS:flaglist

flaglist is one or more of the following flags, separated by commas

  • noteleport: Player cannot teleport within the level.
  • hardfloor: The floor is too hard to dig.
  • nommap: magic mapping does not work.
  • arboreal: supposedly an outdoor map. Basically solid walls will be trees, and corridors are not used.
  • shortsighted: Monsters cannot see you from far away.

Example:

FLAGS:noteleport,hardfloor

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.

  • 'X' is the "foreground" fill map character.
  • 'Y' is the "background" fill map character.
  • smoothed is either true or false, and denotes whether the level will be "smoothed"
  • joined is either true or false, and denoted whether the level will be "joined".
  • lighted is either lit, unlit, or random
  • walled is either true or false.

Examples:

INIT_MAP: 'L', '.', false, false, unlit, false
INIT_MAP: '.', ' ', true, true, random, true

MESSAGE

MESSAGE:"string"

You can have 0 or more of these per special level. "string" 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.

  • xadj is one of left, half-left, center, half-right, right or random
  • yadj is one of top, center, bottom or random

Example:

GEOMETRY:left,top

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.

  • 'X': a character denoting one of the object classes.
  • "name": either an object name as listed in objects.c, or random
  • place: either a coordinate, a RANDOM_PLACES place, or random

Examples:

OBJECT:'%',"food ration",random
OBJECT:'*',random,(10,10)
OBJECT:'?',"genocide",place[0]

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

MONSTER

MONSTER:'X',"name",place
  • 'X' is the monster class symbol, or random, or a RANDOM_MONSTERS index
  • "name" is the specific monster, or random
  • place is either a coordinate, a RANDOM_PLACES place, or random

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 place[N] 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 monster[N] 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 object[N] 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)

ROOM-type Levels

Common syntax

Map characters

character dungeon feature
' ' solid wall
'#' corridor
'.' room floor
'-' horizontal wall
'|' vertical wall
'+' door
'A' air
'B' crosswall
'C' cloud
'S' secret door
'H' secret corridor
'{' fountain
'\' throne
'K' sink
'}' moat
'P' pool of water
'L' lava pool
'I' ice
'W' water
'T' tree
'F' iron bars

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"