1 .TH LEV_COMP 6 "25 May 2015" NETHACK
11 .ND $NHDT-Date: 1524689549 2018/04/25 20:52:29 $
12 .NB $NHDT-Branch: NetHack-3.6.0 $
13 .NR $NHDT-Revision: 1.7 $
16 lev_comp \- NetHack special levels compiler
26 If no arguments are given, it reads standard input.
30 is a special level compiler for NetHack version 3.2 and higher. It
31 takes description files as arguments and produces level files that can
32 be loaded by NetHack at runtime.
34 The purpose of this tool is to provide NetHack administrators and
35 implementors with a convenient way for adding special levels to the
36 game, or modifying existing ones, without having to recompile the
43 to perform extra checks on the level and display extra warnings, however
44 these warnings are sometimes superfluous, so they are not normally displayed.
64 maze_level : maze_def flags lev_init messages regions
67 room_level : level_def flags lev_init messages rreg_init rooms corridors_def
70 level_def : LEVEL_ID ':' string
73 lev_init : /* nothing */
74 | LEV_INIT_ID ':' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled
82 | FLAGS_ID ':' flag_list
85 flag_list : FLAG_TYPE ',' flag_list
89 messages : /* nothing */
93 message : MESSAGE_ID ':' STRING
96 rreg_init : /* nothing */
100 init_rreg : RANDOM_OBJECTS_ID ':' object_list
101 | RANDOM_MONSTERS_ID ':' monster_list
104 rooms : /* Nothing - dummy room for use with INIT_MAP */
112 corridors_def : random_corridors
116 random_corridors: RAND_CORRIDOR_ID
119 corridors : /* nothing */
123 corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec
124 | CORRIDOR_ID ':' corr_spec ',' INTEGER
127 corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')'
130 aroom : room_def room_details
131 | subroom_def room_details
134 subroom_def : SUBROOM_ID ':' room_type ',' light_state ',' subroom_pos ',' room_size ',' string roomfill
137 room_def : ROOM_ID ':' room_type ',' light_state ',' room_pos ',' room_align ',' room_size roomfill
140 roomfill : /* nothing */
144 room_pos : '(' INTEGER ',' INTEGER ')'
148 subroom_pos : '(' INTEGER ',' INTEGER ')'
152 room_align : '(' h_justif ',' v_justif ')'
156 room_size : '(' INTEGER ',' INTEGER ')'
160 room_details : /* nothing */
161 | room_details room_detail
164 room_detail : room_name
179 room_name : NAME_ID ':' string
182 room_chance : CHANCE_ID ':' INTEGER
185 room_door : DOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos
192 door_wall : DIRECTION
200 maze_def : MAZE_ID ':' string ',' filling
211 aregion : map_definition reg_init map_details
214 map_definition : NOMAP_ID
215 | map_geometry MAP_ID
218 map_geometry : GEOMETRY_ID ':' h_justif ',' v_justif
221 h_justif : LEFT_OR_RIGHT
225 v_justif : TOP_OR_BOT
229 reg_init : /* nothing */
233 init_reg : RANDOM_OBJECTS_ID ':' object_list
234 | RANDOM_PLACES_ID ':' place_list
235 | RANDOM_MONSTERS_ID ':' monster_list
239 | object ',' object_list
242 monster_list : monster
243 | monster ',' monster_list
247 | place ',' place_list
250 map_details : /* nothing */
251 | map_details map_detail
254 map_detail : monster_detail
276 monster_detail : MONSTER_ID chance ':' monster_c ',' m_name ',' coordinate
280 monster_infos : /* nothing */
281 | monster_infos monster_info
284 monster_info : ',' string
288 | ',' MON_APPEARANCE string
291 object_detail : OBJECT_ID object_desc
292 | COBJECT_ID object_desc
295 object_desc : chance ':' object_c ',' o_name ',' object_where object_infos
298 object_where : coordinate
302 object_infos : /* nothing */
303 | ',' curse_state ',' monster_id ',' enchantment optional_name
304 | ',' curse_state ',' enchantment optional_name
305 | ',' monster_id ',' enchantment optional_name
308 curse_state : RANDOM_TYPE
315 enchantment : RANDOM_TYPE
319 optional_name : /* nothing */
324 door_detail : DOOR_ID ':' door_state ',' coordinate
327 trap_detail : TRAP_ID chance ':' trap_name ',' coordinate
330 drawbridge_detail: DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state
333 mazewalk_detail : MAZEWALK_ID ':' coordinate ',' DIRECTION
336 wallify_detail : WALLIFY_ID
339 ladder_detail : LADDER_ID ':' coordinate ',' UP_OR_DOWN
342 stair_detail : STAIR_ID ':' coordinate ',' UP_OR_DOWN
345 stair_region : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN
348 portal_region : PORTAL_ID ':' lev_region ',' lev_region ',' string
351 teleprt_region : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail
354 branch_region : BRANCH_ID ':' lev_region ',' lev_region
357 teleprt_detail : /* empty */
362 | LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
365 fountain_detail : FOUNTAIN_ID ':' coordinate
368 sink_detail : SINK_ID ':' coordinate
371 pool_detail : POOL_ID ':' coordinate
374 diggable_detail : NON_DIGGABLE_ID ':' region
377 passwall_detail : NON_PASSWALL_ID ':' region
380 region_detail : REGION_ID ':' region ',' light_state ',' room_type prefilled
383 altar_detail : ALTAR_ID ':' coordinate ',' alignment ',' altar_type
386 gold_detail : GOLD_ID ':' amount ',' coordinate
389 engraving_detail: ENGRAVING_ID ':' coordinate ',' engraving_type ',' string
418 prefilled : /* empty */
420 | ',' FILLING ',' BOOLEAN
428 door_state : DOOR_STATE
432 light_state : LIGHT_STATE
436 alignment : ALIGNMENT
441 altar_type : ALTAR_TYPE
445 p_register : P_REGISTER '[' INTEGER ']'
448 o_register : O_REGISTER '[' INTEGER ']'
451 m_register : M_REGISTER '[' INTEGER ']'
454 a_register : A_REGISTER '[' INTEGER ']'
477 engraving_type : ENGRAVING_TYPE
481 coord : '(' INTEGER ',' INTEGER ')'
484 region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
490 Lines beginning with '#' are considered comments.
492 The contents of a "MAP" description of a maze is a rectangle showing the exact
493 level map that should be used for the given part of a maze.
494 Each character in the map corresponds to a location on the screen.
495 Different location types are denoted using different ASCII characters.
496 The following characters are recognized.
497 To give an idea of how these are used, see the EXAMPLE, below.
498 The maximum size of a map is normally 76 columns by 21 rows.
502 \&'-' horizontal wall
504 \&'+' a doorway (state is specified in a DOOR declaration)
506 \&'B' boundary room location (for bounding unwalled irregular regions)
510 \&'H' a secret corridor
514 \&'}' a part of a moat or other deep water
517 \&'W' water (yes, different from a pool)
521 \&'.' a normal room location (unlit unless lit in a REGION declaration)
526 Here is an example of a description file (a very simple one):
530 MAZE : "fortress", random
531 GEOMETRY : center , center
543 MONSTER: '@', "Wizard of Yendor", (4,4)
544 OBJECT: '"', "Amulet of Yendor", (4,4)
545 # a hell hound flanking the Wiz on a random side
546 RANDOM_PLACES: (4,3), (4,5), (3,4), (5,4)
547 MONSTER: 'd', "hell hound", place[0]
548 # a chest on another random side
549 OBJECT: '(', "chest", place[1]
550 # a sack on a random side, with a diamond and maybe a ruby in it
551 CONTAINER: '(', "sack", place[2]
552 OBJECT: '*', "diamond", contained
553 OBJECT[50%]: '*', "ruby", contained
554 # a random dragon somewhere
555 MONSTER: 'D', random, random
556 # 3 out of 4 chance for a random trap in the EAST end
557 TRAP[75%]: random, (6,4)
558 # an electric eel below the SOUTH end
559 MONSTER: ';', "electric eel", (4,8)
560 # make the walls non-diggable
561 NON_DIGGABLE: (0,0,8,8)
562 TELEPORT_REGION: levregion(0,0,79,20), (0,0,8,8)
565 This example will produce a file named "fortress" that can be integrated into
566 one of the numerous mazes of the game.
568 Note especially the final, TELEPORT_REGION specification. This says
569 that level teleports or other non-stairway arrivals on this level can
570 land anywhere on the level except the area of the map. This shows the
571 use of the ``levregion'' prefix allowed in certain region specifications.
572 Normally, regions apply only to the most recent MAP specification, but
573 when prefixed with ``levregion'', one can refer to any area of the
574 level, regardless of the placement of the current MAP in the level.
577 Jean-Christophe Collet, David Cohrs.
580 dgn_comp(6), nethack(6)
584 Most importantly, still needs additional bounds checking.
586 This file is Copyright (C) \*(Na and was last modified \*(Nd (version
588 NetHack may be freely redistributed. See license for details.