1 .TH LEV_COMP 6 "16 May 1996"
4 lev_comp \- NetHack special levels compiler
14 If no arguments are given, it reads standard input.
18 is a special level compiler for NetHack version 3.2 and higher. It
19 takes description files as arguments and produces level files that can
20 be loaded by NetHack at runtime.
22 The purpose of this tool is to provide NetHack administrators and
23 implementors with a convenient way for adding special levels to the
24 game, or modifying existing ones, without having to recompile the
31 to perform extra checks on the level and display extra warnings, however
32 these warnings are sometimes superfluous, so they are not normally displayed.
52 maze_level : maze_def flags lev_init messages regions
55 room_level : level_def flags lev_init messages rreg_init rooms corridors_def
58 level_def : LEVEL_ID ':' string
61 lev_init : /* nothing */
62 | LEV_INIT_ID ':' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled
70 | FLAGS_ID ':' flag_list
73 flag_list : FLAG_TYPE ',' flag_list
77 messages : /* nothing */
81 message : MESSAGE_ID ':' STRING
84 rreg_init : /* nothing */
88 init_rreg : RANDOM_OBJECTS_ID ':' object_list
89 | RANDOM_MONSTERS_ID ':' monster_list
92 rooms : /* Nothing - dummy room for use with INIT_MAP */
100 corridors_def : random_corridors
104 random_corridors: RAND_CORRIDOR_ID
107 corridors : /* nothing */
111 corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec
112 | CORRIDOR_ID ':' corr_spec ',' INTEGER
115 corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')'
118 aroom : room_def room_details
119 | subroom_def room_details
122 subroom_def : SUBROOM_ID ':' room_type ',' light_state ',' subroom_pos ',' room_size ',' string roomfill
125 room_def : ROOM_ID ':' room_type ',' light_state ',' room_pos ',' room_align ',' room_size roomfill
128 roomfill : /* nothing */
132 room_pos : '(' INTEGER ',' INTEGER ')'
136 subroom_pos : '(' INTEGER ',' INTEGER ')'
140 room_align : '(' h_justif ',' v_justif ')'
144 room_size : '(' INTEGER ',' INTEGER ')'
148 room_details : /* nothing */
149 | room_details room_detail
152 room_detail : room_name
167 room_name : NAME_ID ':' string
170 room_chance : CHANCE_ID ':' INTEGER
173 room_door : DOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos
180 door_wall : DIRECTION
188 maze_def : MAZE_ID ':' string ',' filling
199 aregion : map_definition reg_init map_details
202 map_definition : NOMAP_ID
203 | map_geometry MAP_ID
206 map_geometry : GEOMETRY_ID ':' h_justif ',' v_justif
209 h_justif : LEFT_OR_RIGHT
213 v_justif : TOP_OR_BOT
217 reg_init : /* nothing */
221 init_reg : RANDOM_OBJECTS_ID ':' object_list
222 | RANDOM_PLACES_ID ':' place_list
223 | RANDOM_MONSTERS_ID ':' monster_list
227 | object ',' object_list
230 monster_list : monster
231 | monster ',' monster_list
235 | place ',' place_list
238 map_details : /* nothing */
239 | map_details map_detail
242 map_detail : monster_detail
264 monster_detail : MONSTER_ID chance ':' monster_c ',' m_name ',' coordinate
268 monster_infos : /* nothing */
269 | monster_infos monster_info
272 monster_info : ',' string
276 | ',' MON_APPEARANCE string
279 object_detail : OBJECT_ID object_desc
280 | COBJECT_ID object_desc
283 object_desc : chance ':' object_c ',' o_name ',' object_where object_infos
286 object_where : coordinate
290 object_infos : /* nothing */
291 | ',' curse_state ',' monster_id ',' enchantment optional_name
292 | ',' curse_state ',' enchantment optional_name
293 | ',' monster_id ',' enchantment optional_name
296 curse_state : RANDOM_TYPE
303 enchantment : RANDOM_TYPE
307 optional_name : /* nothing */
312 door_detail : DOOR_ID ':' door_state ',' coordinate
315 trap_detail : TRAP_ID chance ':' trap_name ',' coordinate
318 drawbridge_detail: DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state
321 mazewalk_detail : MAZEWALK_ID ':' coordinate ',' DIRECTION
324 wallify_detail : WALLIFY_ID
327 ladder_detail : LADDER_ID ':' coordinate ',' UP_OR_DOWN
330 stair_detail : STAIR_ID ':' coordinate ',' UP_OR_DOWN
333 stair_region : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN
336 portal_region : PORTAL_ID ':' lev_region ',' lev_region ',' string
339 teleprt_region : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail
342 branch_region : BRANCH_ID ':' lev_region ',' lev_region
345 teleprt_detail : /* empty */
350 | LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
353 fountain_detail : FOUNTAIN_ID ':' coordinate
356 sink_detail : SINK_ID ':' coordinate
359 pool_detail : POOL_ID ':' coordinate
362 diggable_detail : NON_DIGGABLE_ID ':' region
365 passwall_detail : NON_PASSWALL_ID ':' region
368 region_detail : REGION_ID ':' region ',' light_state ',' room_type prefilled
371 altar_detail : ALTAR_ID ':' coordinate ',' alignment ',' altar_type
374 gold_detail : GOLD_ID ':' amount ',' coordinate
377 engraving_detail: ENGRAVING_ID ':' coordinate ',' engraving_type ',' string
406 prefilled : /* empty */
408 | ',' FILLING ',' BOOLEAN
416 door_state : DOOR_STATE
420 light_state : LIGHT_STATE
424 alignment : ALIGNMENT
429 altar_type : ALTAR_TYPE
433 p_register : P_REGISTER '[' INTEGER ']'
436 o_register : O_REGISTER '[' INTEGER ']'
439 m_register : M_REGISTER '[' INTEGER ']'
442 a_register : A_REGISTER '[' INTEGER ']'
465 engraving_type : ENGRAVING_TYPE
469 coord : '(' INTEGER ',' INTEGER ')'
472 region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
478 Lines beginning with '#' are considered comments.
480 The contents of a "MAP" description of a maze is a rectangle showing the exact
481 level map that should be used for the given part of a maze.
482 Each character in the map corresponds to a location on the screen.
483 Different location types are denoted using different ASCII characters.
484 The following characters are recognized.
485 To give an idea of how these are used, see the EXAMPLE, below.
486 The maximum size of a map is normally 76 columns by 21 rows.
490 \&'-' horizontal wall
492 \&'+' a doorway (state is specified in a DOOR declaration)
494 \&'B' boundary room location (for bounding unwalled irregular regions)
498 \&'H' a secret corridor
501 \&'K' a sink (if SINKS is defined, else a room location)
502 \&'}' a part of a moat or other deep water
505 \&'W' water (yes, different from a pool)
509 \&'.' a normal room location (unlit unless lit in a REGION declaration)
514 Here is an example of a description file (a very simple one):
518 MAZE : "fortress", random
519 GEOMETRY : center , center
531 MONSTER: '@', "Wizard of Yendor", (4,4)
532 OBJECT: '"', "Amulet of Yendor", (4,4)
533 # a hell hound flanking the Wiz on a random side
534 RANDOM_PLACES: (4,3), (4,5), (3,4), (5,4)
535 MONSTER: 'd', "hell hound", place[0]
536 # a chest on another random side
537 OBJECT: '(', "chest", place[1]
538 # a sack on a random side, with a diamond and maybe a ruby in it
539 CONTAINER: '(', "sack", place[2]
540 OBJECT: '*', "diamond", contained
541 OBJECT[50%]: '*', "ruby", contained
542 # a random dragon somewhere
543 MONSTER: 'D', random, random
544 # 3 out of 4 chance for a random trap in the EAST end
545 TRAP[75%]: random, (6,4)
546 # an electric eel below the SOUTH end
547 MONSTER: ';', "electric eel", (4,8)
548 # make the walls non-diggable
549 NON_DIGGABLE: (0,0,8,8)
550 TELEPORT_REGION: levregion(0,0,79,20), (0,0,8,8)
553 This example will produce a file named "fortress" that can be integrated into
554 one of the numerous mazes of the game.
556 Note especially the final, TELEPORT_REGION specification. This says
557 that level teleports or other non-stairway arrivals on this level can
558 land anywhere on the level except the area of the map. This shows the
559 use of the ``levregion'' prefix allowed in certain region specifications.
560 Normally, regions apply only to the most recent MAP specification, but
561 when prefixed with ``levregion'', one can refer to any area of the
562 level, regardless of the placement of the current MAP in the level.
565 Jean-Christophe Collet, David Cohrs.
568 dgn_comp(6), nethack(6)
572 Most importantly, still needs additional bounds checking.