1 .TH LEV_COMP 6 "16 May 1996"
2 .\" NetHack 3.6 lev_comp.6 $NHDT-Date: 1432512786 2015/05/25 00:13:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $
5 lev_comp \- NetHack special levels compiler
15 If no arguments are given, it reads standard input.
19 is a special level compiler for NetHack version 3.2 and higher. It
20 takes description files as arguments and produces level files that can
21 be loaded by NetHack at runtime.
23 The purpose of this tool is to provide NetHack administrators and
24 implementors with a convenient way for adding special levels to the
25 game, or modifying existing ones, without having to recompile the
32 to perform extra checks on the level and display extra warnings, however
33 these warnings are sometimes superfluous, so they are not normally displayed.
53 maze_level : maze_def flags lev_init messages regions
56 room_level : level_def flags lev_init messages rreg_init rooms corridors_def
59 level_def : LEVEL_ID ':' string
62 lev_init : /* nothing */
63 | LEV_INIT_ID ':' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled
71 | FLAGS_ID ':' flag_list
74 flag_list : FLAG_TYPE ',' flag_list
78 messages : /* nothing */
82 message : MESSAGE_ID ':' STRING
85 rreg_init : /* nothing */
89 init_rreg : RANDOM_OBJECTS_ID ':' object_list
90 | RANDOM_MONSTERS_ID ':' monster_list
93 rooms : /* Nothing - dummy room for use with INIT_MAP */
101 corridors_def : random_corridors
105 random_corridors: RAND_CORRIDOR_ID
108 corridors : /* nothing */
112 corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec
113 | CORRIDOR_ID ':' corr_spec ',' INTEGER
116 corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')'
119 aroom : room_def room_details
120 | subroom_def room_details
123 subroom_def : SUBROOM_ID ':' room_type ',' light_state ',' subroom_pos ',' room_size ',' string roomfill
126 room_def : ROOM_ID ':' room_type ',' light_state ',' room_pos ',' room_align ',' room_size roomfill
129 roomfill : /* nothing */
133 room_pos : '(' INTEGER ',' INTEGER ')'
137 subroom_pos : '(' INTEGER ',' INTEGER ')'
141 room_align : '(' h_justif ',' v_justif ')'
145 room_size : '(' INTEGER ',' INTEGER ')'
149 room_details : /* nothing */
150 | room_details room_detail
153 room_detail : room_name
168 room_name : NAME_ID ':' string
171 room_chance : CHANCE_ID ':' INTEGER
174 room_door : DOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos
181 door_wall : DIRECTION
189 maze_def : MAZE_ID ':' string ',' filling
200 aregion : map_definition reg_init map_details
203 map_definition : NOMAP_ID
204 | map_geometry MAP_ID
207 map_geometry : GEOMETRY_ID ':' h_justif ',' v_justif
210 h_justif : LEFT_OR_RIGHT
214 v_justif : TOP_OR_BOT
218 reg_init : /* nothing */
222 init_reg : RANDOM_OBJECTS_ID ':' object_list
223 | RANDOM_PLACES_ID ':' place_list
224 | RANDOM_MONSTERS_ID ':' monster_list
228 | object ',' object_list
231 monster_list : monster
232 | monster ',' monster_list
236 | place ',' place_list
239 map_details : /* nothing */
240 | map_details map_detail
243 map_detail : monster_detail
265 monster_detail : MONSTER_ID chance ':' monster_c ',' m_name ',' coordinate
269 monster_infos : /* nothing */
270 | monster_infos monster_info
273 monster_info : ',' string
277 | ',' MON_APPEARANCE string
280 object_detail : OBJECT_ID object_desc
281 | COBJECT_ID object_desc
284 object_desc : chance ':' object_c ',' o_name ',' object_where object_infos
287 object_where : coordinate
291 object_infos : /* nothing */
292 | ',' curse_state ',' monster_id ',' enchantment optional_name
293 | ',' curse_state ',' enchantment optional_name
294 | ',' monster_id ',' enchantment optional_name
297 curse_state : RANDOM_TYPE
304 enchantment : RANDOM_TYPE
308 optional_name : /* nothing */
313 door_detail : DOOR_ID ':' door_state ',' coordinate
316 trap_detail : TRAP_ID chance ':' trap_name ',' coordinate
319 drawbridge_detail: DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state
322 mazewalk_detail : MAZEWALK_ID ':' coordinate ',' DIRECTION
325 wallify_detail : WALLIFY_ID
328 ladder_detail : LADDER_ID ':' coordinate ',' UP_OR_DOWN
331 stair_detail : STAIR_ID ':' coordinate ',' UP_OR_DOWN
334 stair_region : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN
337 portal_region : PORTAL_ID ':' lev_region ',' lev_region ',' string
340 teleprt_region : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail
343 branch_region : BRANCH_ID ':' lev_region ',' lev_region
346 teleprt_detail : /* empty */
351 | LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
354 fountain_detail : FOUNTAIN_ID ':' coordinate
357 sink_detail : SINK_ID ':' coordinate
360 pool_detail : POOL_ID ':' coordinate
363 diggable_detail : NON_DIGGABLE_ID ':' region
366 passwall_detail : NON_PASSWALL_ID ':' region
369 region_detail : REGION_ID ':' region ',' light_state ',' room_type prefilled
372 altar_detail : ALTAR_ID ':' coordinate ',' alignment ',' altar_type
375 gold_detail : GOLD_ID ':' amount ',' coordinate
378 engraving_detail: ENGRAVING_ID ':' coordinate ',' engraving_type ',' string
407 prefilled : /* empty */
409 | ',' FILLING ',' BOOLEAN
417 door_state : DOOR_STATE
421 light_state : LIGHT_STATE
425 alignment : ALIGNMENT
430 altar_type : ALTAR_TYPE
434 p_register : P_REGISTER '[' INTEGER ']'
437 o_register : O_REGISTER '[' INTEGER ']'
440 m_register : M_REGISTER '[' INTEGER ']'
443 a_register : A_REGISTER '[' INTEGER ']'
466 engraving_type : ENGRAVING_TYPE
470 coord : '(' INTEGER ',' INTEGER ')'
473 region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
479 Lines beginning with '#' are considered comments.
481 The contents of a "MAP" description of a maze is a rectangle showing the exact
482 level map that should be used for the given part of a maze.
483 Each character in the map corresponds to a location on the screen.
484 Different location types are denoted using different ASCII characters.
485 The following characters are recognized.
486 To give an idea of how these are used, see the EXAMPLE, below.
487 The maximum size of a map is normally 76 columns by 21 rows.
491 \&'-' horizontal wall
493 \&'+' a doorway (state is specified in a DOOR declaration)
495 \&'B' boundary room location (for bounding unwalled irregular regions)
499 \&'H' a secret corridor
503 \&'}' a part of a moat or other deep water
506 \&'W' water (yes, different from a pool)
510 \&'.' a normal room location (unlit unless lit in a REGION declaration)
515 Here is an example of a description file (a very simple one):
519 MAZE : "fortress", random
520 GEOMETRY : center , center
532 MONSTER: '@', "Wizard of Yendor", (4,4)
533 OBJECT: '"', "Amulet of Yendor", (4,4)
534 # a hell hound flanking the Wiz on a random side
535 RANDOM_PLACES: (4,3), (4,5), (3,4), (5,4)
536 MONSTER: 'd', "hell hound", place[0]
537 # a chest on another random side
538 OBJECT: '(', "chest", place[1]
539 # a sack on a random side, with a diamond and maybe a ruby in it
540 CONTAINER: '(', "sack", place[2]
541 OBJECT: '*', "diamond", contained
542 OBJECT[50%]: '*', "ruby", contained
543 # a random dragon somewhere
544 MONSTER: 'D', random, random
545 # 3 out of 4 chance for a random trap in the EAST end
546 TRAP[75%]: random, (6,4)
547 # an electric eel below the SOUTH end
548 MONSTER: ';', "electric eel", (4,8)
549 # make the walls non-diggable
550 NON_DIGGABLE: (0,0,8,8)
551 TELEPORT_REGION: levregion(0,0,79,20), (0,0,8,8)
554 This example will produce a file named "fortress" that can be integrated into
555 one of the numerous mazes of the game.
557 Note especially the final, TELEPORT_REGION specification. This says
558 that level teleports or other non-stairway arrivals on this level can
559 land anywhere on the level except the area of the map. This shows the
560 use of the ``levregion'' prefix allowed in certain region specifications.
561 Normally, regions apply only to the most recent MAP specification, but
562 when prefixed with ``levregion'', one can refer to any area of the
563 level, regardless of the placement of the current MAP in the level.
566 Jean-Christophe Collet, David Cohrs.
569 dgn_comp(6), nethack(6)
573 Most importantly, still needs additional bounds checking.