1LEV_COMP(6)                      Games Manual                      LEV_COMP(6)
2
3
4

NAME

6       lev_comp - NetHack special levels compiler
7

SYNOPSIS

9       lev_comp [ -w ] [ files ]
10
11       If no arguments are given, it reads standard input.
12

DESCRIPTION

14       Lev_comp  is  a  special  level  compiler  for  NetHack version 3.2 and
15       higher.  It takes description files as  arguments  and  produces  level
16       files that can be loaded by NetHack at runtime.
17
18       The  purpose  of  this  tool  is  to provide NetHack administrators and
19       implementors with a convenient way for adding  special  levels  to  the
20       game,  or  modifying  existing  ones,  without  having to recompile the
21       entire world.
22
23       The -w option causes lev_comp to perform extra checks on the level  and
24       display  extra warnings, however these warnings are sometimes superflu‐
25       ous, so they are not normally displayed.
26
27

GRAMMAR

29       file            : /* nothing */
30                       | levels
31                       ;
32
33       levels          : level
34                       | level levels
35                       ;
36
37       level           : maze_level
38                       | room_level
39                       ;
40
41       maze_level      : maze_def flags lev_init messages regions
42                       ;
43
44       room_level      : level_def flags lev_init messages rreg_init rooms corridors_def
45                       ;
46
47       level_def       : LEVEL_ID ':' string
48                       ;
49
50       lev_init        : /* nothing */
51                       | LEV_INIT_ID ':' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled
52                       ;
53
54       walled          : BOOLEAN
55                       | RANDOM_TYPE
56                       ;
57
58       flags           : /* nothing */
59                       | FLAGS_ID ':' flag_list
60                       ;
61
62       flag_list       : FLAG_TYPE ',' flag_list
63                       | FLAG_TYPE
64                       ;
65
66       messages        : /* nothing */
67                       | message messages
68                       ;
69
70       message         : MESSAGE_ID ':' STRING
71                       ;
72
73       rreg_init       : /* nothing */
74                       | rreg_init init_rreg
75                       ;
76
77       init_rreg       : RANDOM_OBJECTS_ID ':' object_list
78                       | RANDOM_MONSTERS_ID ':' monster_list
79                       ;
80
81       rooms           : /* Nothing  -  dummy room for use with INIT_MAP */
82                       | roomlist
83                       ;
84
85       roomlist        : aroom
86                       | aroom roomlist
87                       ;
88
89       corridors_def   : random_corridors
90                       | corridors
91                       ;
92
93       random_corridors: RAND_CORRIDOR_ID
94                       ;
95
96       corridors       : /* nothing */
97                       | corridors corridor
98                       ;
99
100       corridor        : CORRIDOR_ID ':' corr_spec ',' corr_spec
101                       | CORRIDOR_ID ':' corr_spec ',' INTEGER
102                       ;
103
104       corr_spec       : '(' INTEGER ',' DIRECTION ',' door_pos ')'
105                       ;
106
107       aroom           : room_def room_details
108                       | subroom_def room_details
109                       ;
110
111       subroom_def     : SUBROOM_ID ':' room_type ',' light_state ',' subroom_pos ',' room_size ',' string roomfill
112                       ;
113
114       room_def        : ROOM_ID ':' room_type ',' light_state ',' room_pos ',' room_align ',' room_size roomfill
115                       ;
116
117       roomfill        : /* nothing */
118                       | ',' BOOLEAN
119                       ;
120
121       room_pos        : '(' INTEGER ',' INTEGER ')'
122                       | RANDOM_TYPE
123                       ;
124
125       subroom_pos     : '(' INTEGER ',' INTEGER ')'
126                       | RANDOM_TYPE
127                       ;
128
129       room_align      : '(' h_justif ',' v_justif ')'
130                       | RANDOM_TYPE
131                       ;
132
133       room_size       : '(' INTEGER ',' INTEGER ')'
134                       | RANDOM_TYPE
135                       ;
136
137       room_details    : /* nothing */
138                       | room_details room_detail
139                       ;
140
141       room_detail     : room_name
142                       | room_chance
143                       | room_door
144                       | monster_detail
145                       | object_detail
146                       | trap_detail
147                       | altar_detail
148                       | fountain_detail
149                       | sink_detail
150                       | pool_detail
151                       | gold_detail
152                       | engraving_detail
153                       | stair_detail
154                       ;
155
156       room_name       : NAME_ID ':' string
157                       ;
158
159       room_chance     : CHANCE_ID ':' INTEGER
160                       ;
161
162       room_door       : DOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos
163                       ;
164
165       secret          : BOOLEAN
166                       | RANDOM_TYPE
167                       ;
168
169       door_wall       : DIRECTION
170                       | RANDOM_TYPE
171                       ;
172
173       door_pos        : INTEGER
174                       | RANDOM_TYPE
175                       ;
176
177       maze_def        : MAZE_ID ':' string ',' filling
178                       ;
179
180       filling         : CHAR
181                       | RANDOM_TYPE
182                       ;
183
184       regions         : aregion
185                       | aregion regions
186                       ;
187
188       aregion         : map_definition reg_init map_details
189                       ;
190
191       map_definition  : NOMAP_ID
192                       | map_geometry MAP_ID
193                       ;
194
195       map_geometry    : GEOMETRY_ID ':' h_justif ',' v_justif
196                       ;
197
198       h_justif        : LEFT_OR_RIGHT
199                       | CENTER
200                       ;
201
202       v_justif        : TOP_OR_BOT
203                       | CENTER
204                       ;
205
206       reg_init        : /* nothing */
207                       | reg_init init_reg
208                       ;
209
210       init_reg        : RANDOM_OBJECTS_ID ':' object_list
211                       | RANDOM_PLACES_ID ':' place_list
212                       | RANDOM_MONSTERS_ID ':' monster_list
213                       ;
214
215       object_list     : object
216                       | object ',' object_list
217                       ;
218
219       monster_list    : monster
220                       | monster ',' monster_list
221                       ;
222
223       place_list      : place
224                       | place ',' place_list
225                       ;
226
227       map_details     : /* nothing */
228                       | map_details map_detail
229                       ;
230
231       map_detail      : monster_detail
232                       | object_detail
233                       | door_detail
234                       | trap_detail
235                       | drawbridge_detail
236                       | region_detail
237                       | stair_region
238                       | portal_region
239                       | teleprt_region
240                       | branch_region
241                       | altar_detail
242                       | fountain_detail
243                       | mazewalk_detail
244                       | wallify_detail
245                       | ladder_detail
246                       | stair_detail
247                       | gold_detail
248                       | engraving_detail
249                       | diggable_detail
250                       | passwall_detail
251                       ;
252
253       monster_detail  : MONSTER_ID chance ':' monster_c ',' m_name ',' coordinate
254                        monster_infos
255                       ;
256
257       monster_infos   : /* nothing */
258                       | monster_infos monster_info
259                       ;
260
261       monster_info    : ',' string
262                       | ',' MON_ATTITUDE
263                       | ',' MON_ALERTNESS
264                       | ',' alignment
265                       | ',' MON_APPEARANCE string
266                       ;
267
268       object_detail   : OBJECT_ID object_desc
269                       | COBJECT_ID object_desc
270                       ;
271
272       object_desc     : chance ':' object_c ',' o_name ',' object_where object_infos
273                       ;
274
275       object_where    : coordinate
276                       | CONTAINED
277                       ;
278
279       object_infos    : /* nothing */
280                       | ',' curse_state ',' monster_id ',' enchantment optional_name
281                       | ',' curse_state ',' enchantment optional_name
282                       | ',' monster_id ',' enchantment optional_name
283                       ;
284
285       curse_state     : RANDOM_TYPE
286                       | CURSE_TYPE
287                       ;
288
289       monster_id      : STRING
290                       ;
291
292       enchantment     : RANDOM_TYPE
293                       | INTEGER
294                       ;
295
296       optional_name   : /* nothing */
297                       | ',' NONE
298                       | ',' STRING
299                       ;
300
301       door_detail     : DOOR_ID ':' door_state ',' coordinate
302                       ;
303
304       trap_detail     : TRAP_ID chance ':' trap_name ',' coordinate
305                       ;
306
307       drawbridge_detail: DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state
308                       ;
309
310       mazewalk_detail : MAZEWALK_ID ':' coordinate ',' DIRECTION
311                       ;
312
313       wallify_detail  : WALLIFY_ID
314                       ;
315
316       ladder_detail   : LADDER_ID ':' coordinate ',' UP_OR_DOWN
317                       ;
318
319       stair_detail    : STAIR_ID ':' coordinate ',' UP_OR_DOWN
320                       ;
321
322       stair_region    : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN
323                       ;
324
325       portal_region   : PORTAL_ID ':' lev_region ',' lev_region ',' string
326                       ;
327
328       teleprt_region  : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail
329                       ;
330
331       branch_region   : BRANCH_ID ':' lev_region ',' lev_region
332                       ;
333
334       teleprt_detail  : /* empty */
335                       | ',' UP_OR_DOWN
336                       ;
337
338       lev_region      : region
339                       | LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
340                       ;
341
342       fountain_detail : FOUNTAIN_ID ':' coordinate
343                       ;
344
345       sink_detail : SINK_ID ':' coordinate
346                       ;
347
348       pool_detail : POOL_ID ':' coordinate
349                       ;
350
351       diggable_detail : NON_DIGGABLE_ID ':' region
352                       ;
353
354       passwall_detail : NON_PASSWALL_ID ':' region
355                       ;
356
357       region_detail   : REGION_ID ':' region ',' light_state ',' room_type prefilled
358                       ;
359
360       altar_detail    : ALTAR_ID ':' coordinate ',' alignment ',' altar_type
361                       ;
362
363       gold_detail     : GOLD_ID ':' amount ',' coordinate
364                       ;
365
366       engraving_detail: ENGRAVING_ID ':' coordinate ',' engraving_type ',' string
367                       ;
368
369       monster_c       : monster
370                       | RANDOM_TYPE
371                       | m_register
372                       ;
373
374       object_c        : object
375                       | RANDOM_TYPE
376                       | o_register
377                       ;
378
379       m_name          : string
380                       | RANDOM_TYPE
381                       ;
382
383       o_name          : string
384                       | RANDOM_TYPE
385                       ;
386
387       trap_name       : string
388                       | RANDOM_TYPE
389                       ;
390
391       room_type       : string
392                       | RANDOM_TYPE
393                       ;
394
395       prefilled       : /* empty */
396                       | ',' FILLING
397                       | ',' FILLING ',' BOOLEAN
398                       ;
399
400       coordinate      : coord
401                       | p_register
402                       | RANDOM_TYPE
403                       ;
404
405       door_state      : DOOR_STATE
406                       | RANDOM_TYPE
407                       ;
408
409       light_state     : LIGHT_STATE
410                       | RANDOM_TYPE
411                       ;
412
413       alignment       : ALIGNMENT
414                       | a_register
415                       | RANDOM_TYPE
416                       ;
417
418       altar_type      : ALTAR_TYPE
419                       | RANDOM_TYPE
420                       ;
421
422       p_register      : P_REGISTER '[' INTEGER ']'
423                       ;
424
425       o_register      : O_REGISTER '[' INTEGER ']'
426                       ;
427
428       m_register      : M_REGISTER '[' INTEGER ']'
429                       ;
430
431       a_register      : A_REGISTER '[' INTEGER ']'
432                       ;
433
434       place           : coord
435                       ;
436
437       monster         : CHAR
438                       ;
439
440       object          : CHAR
441                       ;
442
443       string          : STRING
444                       ;
445
446       amount          : INTEGER
447                       | RANDOM_TYPE
448                       ;
449
450       chance          : /* empty */
451                       | PERCENT
452                       ;
453
454       engraving_type  : ENGRAVING_TYPE
455                       | RANDOM_TYPE
456                       ;
457
458       coord           : '(' INTEGER ',' INTEGER ')'
459                       ;
460
461       region          : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'
462                       ;
463
464       NOTE:
465       Lines beginning with '#' are considered comments.
466
467       The contents of a "MAP" description of a maze is  a  rectangle  showing
468       the  exact  level map that should be used for the given part of a maze.
469       Each character in the map corresponds to  a  location  on  the  screen.
470       Different  location types are denoted using different ASCII characters.
471       The following characters are recognized.  To give an idea of how  these
472       are  used,  see  the EXAMPLE, below.  The maximum size of a map is nor‐
473       mally 76 columns by 21 rows.
474
475       '-'     horizontal wall
476       '|'     vertical wall
477       '+'     a doorway (state is specified in a DOOR declaration)
478       'A'     open air
479       'B'     boundary room location (for bounding unwalled irregular regions)
480       'C'     cloudy air
481       'I'     ice
482       'S'     a secret door
483       'H'     a secret corridor
484       '{'     a fountain
485       '\'     a throne
486       'K'     a sink
487       '}'     a part of a moat or other deep water
488       'P'     a pool
489       'L'     lava
490       'W'     water (yes, different from a pool)
491       'T'     a tree
492       'F'     iron bars
493       '#'     a corridor
494       '.'     a normal room location (unlit unless lit in a REGION declaration)
495       ' '     stone
496

EXAMPLE

498       Here is an example of a description file (a very simple one):
499
500       MAZE : "fortress", random
501       GEOMETRY : center , center
502       MAP
503       }}}}}}}}}
504       }}}|-|}}}
505       }}|-.-|}}
506       }|-...-|}
507       }|.....|}
508       }|-...-|}
509       }}|-.-|}}
510       }}}|-|}}}
511       }}}}}}}}}
512       ENDMAP
513       MONSTER: '@', "Wizard of Yendor", (4,4)
514       OBJECT: '"', "Amulet of Yendor", (4,4)
515       # a hell hound flanking the Wiz on a random side
516       RANDOM_PLACES: (4,3), (4,5), (3,4), (5,4)
517       MONSTER: 'd', "hell hound", place[0]
518       # a chest on another random side
519       OBJECT: '(', "chest", place[1]
520       # a sack on a random side, with a diamond and maybe a ruby in it
521       CONTAINER: '(', "sack", place[2]
522       OBJECT: '*', "diamond", contained
523       OBJECT[50%]: '*', "ruby", contained
524       # a random dragon somewhere
525       MONSTER: 'D', random, random
526       # 3 out of 4 chance for a random trap in the EAST end
527       TRAP[75%]: random, (6,4)
528       # an electric eel below the SOUTH end
529       MONSTER: ';', "electric eel", (4,8)
530       # make the walls non-diggable
531       NON_DIGGABLE: (0,0,8,8)
532       TELEPORT_REGION: levregion(0,0,79,20), (0,0,8,8)
533
534       This example will produce a file named "fortress"  that  can  be  inte‐
535       grated into one of the numerous mazes of the game.
536
537       Note  especially  the  final, TELEPORT_REGION specification.  This says
538       that level teleports or other non-stairway arrivals on this  level  can
539       land  anywhere on the level except the area of the map.  This shows the
540       use of the ``levregion'' prefix allowed in  certain  region  specifica‐
541       tions.   Normally, regions apply only to the most recent MAP specifica‐
542       tion, but when prefixed with ``levregion'', one can refer to  any  area
543       of  the  level,  regardless  of the placement of the current MAP in the
544       level.
545

AUTHOR

547       Jean-Christophe Collet, David Cohrs.
548

SEE ALSO

550       dgn_comp(6), nethack(6)
551

BUGS

553       Probably infinite.  Most importantly,  still  needs  additional  bounds
554       checking.
555
557       This  file  is  Copyright  (C)  Kenneth  Lorber  and  was last modified
558       2018/04/25 (version NetHack-3.6.0:1.7).  NetHack may be  freely  redis‐
559       tributed.  See license for details.
560
561
562
563NETHACK                           25 May 2015                      LEV_COMP(6)
Impressum