Debian Codegraph @

doc/Developers/random-maps

raw
1 Random Map Deployment Guide
2
3 Using random maps:
4
5 Any exit with "/!" as the destination map will generate a random map.
6 To specify random map parameters, you put parameters in the message field
7 for the exit.
8 To use the standalone random map generator, you do this:
9 random_map inputfile <map path>
10 where "inputfile" is a plaintext file containing the map parameters, andthat
11 <map path> is the destination of the generated map, relative to
12 LIBDIR/maps.
13
14 How styles work:
15
16 A "style" is usually a small map which contains only objects which
17 define the "style". For example, a monsterstyle "orc" might be a map
18 generated with Gridarta which has six orcs, a kobold, and a troll in it.
19 When monsters are placed, the generator will randomly choose monsters from the
20 "orc" style, and for this example, on average, it will generate 6 orcs/troll
21 and 1 kobold/troll. So orcs will be very common, and there'll be occasional
22 trolls and kobolds.
23
24
25 In principle, you may put any object in any style map. However, the map
26 generator will do special things with the object depending on which directory
27 it is in. Style maps are located in
28 maps/styles/*,
29 you may use Gridarta to modify the style maps, or create new ones.
30
31
32 Style Parameters::
33
34 layoutstyle <style> (special!) Pick the layout style for the map. Currently,
35 "rogue", "spiral", "maze", "snake", "onion",
36 and "squarespiral" are allowed.
37 See below for more detail.
38
39 floorstyle <style> Load /styles/floorstyles/<style> and pick a random
40 floortype from that style map for the random map.
41 The entire map will be tiled with the floortype.
42
43 multiple_floors <0/1> If set to 1, different rooms of the map will have
44 different floors (from the same map style though).
45 This only works if there are doors, as the filling
46 uses them to find rooms.
47
48 wallstyle <style> Load /styles/wallstyles/<style> and pick a random
49 walltype from that style for the random map. All
50 the walls in the map will be of this type. The walls
51 are modified on insertion so that players cannot go
52 through them: this is expected for walls, but
53 the random map generator makes sure of it. A <style>
54 of "none" causes no walls or doors to be generated.
55
56 doorstyle <style> Load /styles/doorstyles/<style> and pick a random
57 doortype from that style for the random map. A <style>
58 of "none" causes no doors to generated.
59
60 exitstyle <style> Put one or two exits in the map, one leading back
61 to the map where we entered from (origin_map,
62 origin_x, origin_y), and, if appropriate, one leading
63 to another, harder, random map. A style of "none"
64 causes no exits to be generated.
65
66 decorstyle <style> Load /styles/decorstyles/<style> and pick the decor
67 objects from that style to insert in the map. Decor
68 objects are modified on insertion so that they do
69 NOT block movement, regardless of the archetype.
70 They are placed randomly. A style of "none" causes no
71 decor objects to be generated.
72
73 monsterstyle <style> Load /styles/monsterstyles/<style>, if it exists.
74 If it doesn't exist, then it will look for a directory
75 of that name. If it finds a directory, it will choose
76 a style based on dungeon_level. It will pick the style
77 with the name <name>_# with the # closest to the
78 dungeon_level. Monster objects are copied from the
79 style map, so you may form style maps with modified
80 monsters which are weaker or stronger than the default
81 archetype.A style of "none" causes no monsters to be
82 generated.
83
84 treasurestyle <style> (Special) If the style name chosen is contained in
85 the lib/treasures file, it will use that for making
86 treasures. If it is NOT in the lib/treasures file,
87 it will look up /styles/treasurestyle/<style>, and
88 pick random treasures from there. If <style> matches
89 neither of these, it will generate treasures
90 using the "chest" treasurelist. A style of "none"
91 causes no treasures to be placed.
92
93
94
95 Layout Parameters::
96
97
98 'xsize' size of the map: if not set, random from 10 to 70
99
100
101 'ysize' size of the map: if not set, random from 10 to 70
102
103
104 'expand2x' Do we double the size of the layout? This has
105 the effect of increasing the corridor widths by about
106 2x. Set it to a non-zero integer if this is desired.
107
108
109 'symmetry <sym>' symmetry of the layout: You can cause the map generator
110 to generate a symmetrical layout by using this flag.
111 symmetry 0 random symmetry
112 symmetry 1 no symmetry
113 symmetry 2 symmetry about the vertical centerline
114 symmetry 3 symmetry about the horizontal centerline
115 symmetry 4 both 2 and 3 symmetry
116
117
118 Layout Style: Parameter: Effect:
119
120
121 maze layoutoptions1 0 (default) Sparse maze: a maze with
122 "rooms" will be made
123
124
125 maze layoutoptions1 1 Full maze: a maze with
126 no "open" spaces will be made.
127
128
129 50% of the time a maze layout will be "doorified", meaning that doors
130 will be placed at random in the maze.
131
132
133 onion layoutoptions1 0 (default) Pick random options
134 See "Onion Rooms" below for
135 the rest of the options.
136
137 onion layoutoptions2 0 (default) Pick a random number of
138 "onion layers"
139
140
141 Map generation parameters:
142
143
144 'difficulty' Set the map difficulty. Has no relation to the
145 "difficulty" defined in common/*.c.
146 If nonzero, this map and its descendants will
147 have the same difficulty. If zero, it'll be set
148 to the value of dungeon_level and incremented with
149 each recursive map.
150
151 'difficulty_increase' Sets how fast the difficulty increases. This value
152 is a float - the default value is 1.0. Reducing
153 This only applies to map without a default
154 difficulty set (but that could change in the
155 future). For each level of a map, the difficulty
156 is set to depth * difficulty_increase. Setting
157 this parameter to 0.5 (or other values between 0
158 and 1) is a way to have deep dungeons that do not
159 increase in difficulty all that rapidly.
160
161
162 'dungeon_level' Another way of setting the map difficulty. This
163 has no relation to the "difficulty" defined in
164 the common/*.c source code. The effect is to pick
165 which monsters to use: for example, if the
166 monsterstyle
167 is "humanoid" and the dungeonlevel is 9, the style
168 map /styles/monsterstyles/humanoid/humanoid_9 will be
169 the style from which monsters are chosen. After the
170 monsters are placed, the map
171 difficulty is set according
172 to the server's rule, for treasure purposes.
173
174 'dungeon_depth' The map generated will have an exit to another
175 random map of the same style if
176 dungeon_level < dungeon_depth. The next random map
177 will have dungeon_level incremented. If dungeon_level
178 >= dungeon_depth, no exit to a more difficult map
179 will be made.
180
181 'orientation' How the exits look:
182 0 random "orientation"
183 1 player arrives in the map at
184 a "stairs up", he goes to harder
185 levels by finding a "stairs down"
186 2 reverse of 1
187 3-6 exits are horizontal. In the future
188 these will be made to make exits to
189 rightward, leftward, north and south.
190
191 'origin_x' <You shouldn't need to set this> The exit which
192 leads back from this map will go to this x.
193
194 'origin_y' Like origin_x
195
196 'random_seed' Set the random seed number used. This number
197 completely determines the random numbers: a map
198 with the same random seed and other parameters
199 will always produce exactly the same map.
200
201 'final_map' When dungeon_level >= dungeon_depth, another exit
202 isn't usually made. However, if final_map is set
203 to a map's name, then an exit to this map will
204 be made.
205
206 'exit_on_final_map' The default action is to place an exit on
207 the final map. When explicitly set to 'no' this will
208 not place a return exit on the final_map.
209 If you use this setting YOU MUST PROVIDE A WAY BACK IN THE FINAL MAP!
210
211
212 Misc. Parameters:
213
214
215 'decoroptions' <option> Currently, ignored. Possibly in the future it
216 will cause the decor to be patterned in some way,
217 such as <put decor along walls> or <put decor
218 in center of rooms>
219
220
221 'treasureoptions' <opt> Parameterizes how the treasure is placed and protected.
222 0 choose random treasure options
223 1 concentrate the treasure on the map in a few locations
224 2 hide the treasure behind hidden doors
225 4 put the treasure in a chest which must be unlocked.
226 (a key will be placed somewhere in the map, probably
227 in a monster.)
228 8 Put locked doors around the treasure (a key to each
229 door will be placed in a monster or somewhere reachable
230 by the player: one key on each side of the door.)
231 In onion maps, the treasure is co-located with the
232 exit to harder levels, so this makes the exit harder
233 to get to.
234 16 Trap the treasure. A trap from /styles/trapstyles/traps
235 is selected and inserted into the treasure chest.
236 32 sparse treasure. 1/2 as much treasure is generated.
237 64 rich treasure. 2x as much treasure is generated.
238
239 If option 1 is not set, options 2-16 are ignored. Options
240 may be added together: treasureoptions 3 means treasure
241 optons 1 and 2 are set.
242
243 Map Layout styles:
244
245
246 Onion Maps:
247
248 Onion rooms are like this::
249
250 regular random
251 centered, linear onion: bottom/right centered, nonlinear:
252
253 ######################### #########################
254 # # # #
255 # ######## ########## # # #####################
256 # # # # # # #
257 # # ###### ######## # # # # #
258 # # # # # # # # ######## ########
259 # # # #### ###### # # # # # # #
260 # # # # # # # # # # # #
261 # # # ############ # # # # # # ########### ##
262 # # # # # # # # # # #
263 # # ################ # # # # # # #########
264 # # # # # # # # #
265 # #################### # # # # # #
266 # # # # # # # #
267 ######################### #########################
268
269 options:
270 0 Pick random options below
271 1 "centered"
272 2 linear doors (default is nonlinear)
273 4 bottom "centered"
274 8 bottom-right centered
275 16 outer wall off: i.e., no outer wall.
276 32 irregularly/randomly spaced layers (default: regular)
277
278
279 Maze Maps:
280
281 Maze maps are like this:
282
283 A "sparse" maze::
284
285 ########################################
286 # # # # # # # # # # # # # #
287 # # # # # # # # # # # #
288 #### ## ## # # ### # ## # # # ##
289 # ##### # ## # # # ## ### ## ### #
290 ## ### # # # #
291 # ### # # #### ### #
292 # # ## ## ## # # ###
293 # ###### # ### # # ## # #
294 # # ## #### ## # # # # #
295 # # ## ## ## ### ## # # # # #
296 #### ## ## ## ## ### # ### ###
297 # # ## ##### # ### #
298 ## ## # ### # ## ##
299 # ## ## ## # ## # ### #
300 ## # # # # # # # ## #
301 # ### ### ## # ## ## #### ## # #
302 ## # # # # # # # #### # ###
303 # ### ## ## # ## ## ## # ### #
304 ## # ## # # # # # # ## # ##
305 # ##### ## ## #### ## # # # ## #
306 ## # # # # ## # ### #
307 # # # # # # # # # # # # # #
308 ########################################
309
310 A "full" maze::
311
312 ########################################
313 # # # # # # #
314 # # # # # # # # # # # # # # #
315 ### ## ## ######## ### ### ### # #
316 # # # ## # ### ### # ### ##
317 # ##### ### ##### ## ## ## # #
318 # # # ## # # ## #### # # # ##
319 # #### ## ### #### # ## ## ### # # #
320 # # # # # ### # # # #
321 # ### ## ## ### #### #### ## # ###
322 # # # # # # #### ## # # ## # #
323 # # ## #### ## # ## # ## # #
324 # #### ## # ### #### # ### # #### #
325 # # # # # # # # ## #### # #
326 # ##### #### ## ### # # ## #
327 # ## ## # ## ## ## ##### # # #
328 # # # # ## # # # ## # # ### # #
329 ## ### # ## # # #### ### # # # ## #
330 # # # # ## # # # ## ### # #
331 ## # #### ## # # ###### # # #### #
332 # # #### # ###### ## ### # #
333 ### # ## ## # # # ## #
334 # # # # # # # # # # # # #
335 ########################################
336
337
338 Spiral Maps:
339
340 A Spiral Map::
341
342 ###########################
343 ###########################
344 ########### D ##########
345 ######### #### ########
346 ######## ######## #######
347 ####### ########## ######
348 ###### ############ #####
349 ###### #### #####D#####
350 ##### ### ### #### ####
351 ##### #### ##### #### ####
352 #####D#### ###### ####D####
353 ##### ### #C### #### ####
354 ###### #### >###D#### ####
355 ######D########## ####D####
356 ###### ######## ### ####
357 ####### ###### #### #####
358 ######## D D D #### #####
359 #################### ######
360 ################### ######
361 ################# #######
362 ################# <########
363 ###########################
364 ###########################
365
366 layoutoptions1:
367
368 0 pick random options
369 1 Regular spiral: distance increases constantly with angle
370 2 Fine spiral: most coils possible are fit in
371 4 Fit Spiral: scale spiral to fit rectangular region
372 (i.e., the spiral will look elliptical)
373
374
375 Rogue-like Maps:
376
377 A Rogue-like Map::
378
379 ###############################
380 ############# ###########
381 # ## ###########
382 # DD ###########
383 # ## ###########
384 # ## #### ##
385 # #####D####### ##
386 # D D ##
387 ###D######D##### ####### ##
388 ### ## ### ## ##
389 ###D D ### ###D####
390 ### ## D D < ### ####
391 ### ######D##### ### ####
392 ###D###### ##### #### ####
393 ## #### ##### # ##### ####
394 ## #### ##### ######### ####
395 ## ####D##### ######### ####
396 ## ## ### # ### ####
397 ## ## ### # ###D####
398 ## ## ### # ### ##
399 ######## ### # ### #
400 ######## D D D ### > #
401 ######## ##### ### #
402 ######## ##### ### ##
403 ######## ##### ########
404 ################## ########
405 ###############################
406
407 layoutoptions1:
408
409 0 pick random room shapes (i.e., mix it up)
410 1 Always use rectangular rooms
411 2 Always use "circular" rooms
412
413
414 Snake layouts:
415
416 No options are available for snake layouts.
417 A player must touch every room to descend deeper in a snake.
418
419 This is a basic snake layout::
420
421 ############################
422 #> #
423 # #
424 # #
425 ##########################D#
426 # #
427 # #
428 # #
429 #D##########################
430 # #
431 # #
432 # #
433 ##########################D#
434 # #
435 # #
436 # #
437 #D##########################
438 # #
439 # #
440 # #
441 # #
442 # <#
443 ############################
444
445 This is a roomified, xy-symmetric snake layout::
446
447 ###################################
448 #> # # # # >#
449 # # # # # #
450 ##D####### D D #######D##
451 # # # # # #
452 # # # # # #
453 # D # < # D #
454 # # # # # #
455 # # # # # #
456 ##D####### D D #######D##
457 # # # # # #
458 #> # # # # >#
459 ###################################
460
461
462 Square spirals
463
464 No options are available for square spirals
465 A player must touch every room to descend in a square spiral.
466
467 This is a basic square spiral layout::
468
469 ###############################
470 # # #
471 # D #
472 # #####################D#####
473 # # # # #
474 # # # # #
475 # # D # #
476 # # #############D### #
477 # # # # # # #
478 # # # # # # #
479 # # # D # # #
480 # # # #####D### # #
481 # # # # > # # # #
482 # # # D # # # #
483 # # ######### # # #
484 # # # D # # #
485 # # # # # # #
486 # # D # # # #
487 # ################# # #
488 # # D # #
489 # # # # #
490 # D # # #
491 ######################### #
492 # D #
493 # # #
494 # # #
495 #< # #
496 ###############################
497
498 This is an xy-symmetric square spiral layout::
499
500 #####################################
501 # # < # #
502 ##D##########D# #D##########D##
503 # # # ####D#### # # #
504 # ###DD### # # ###DD### #
505 # # #> # ##D###D## # ># # #
506 # # ####D### ###D#### # #
507 # # D # # D # #
508 # ############D#####D############ #
509 # D D #
510 # # # #
511 # D D #
512 # ############D#####D############ #
513 # # D # # D # #
514 # # ####D### ###D#### # #
515 # # #> # ##D###D## # ># # #
516 # ###DD### # # ###DD### #
517 # # # ####D#### # # #
518 ##D##########D# #D##########D##
519 # # < # #
520 #####################################
521
522
523 An example input file::
524
525 layoutstyle onion
526 monsterstyle humanoid
527 dungeon_depth 3
528 xsize 15
529 ysize 15
530 exitstyle cstair
531 orientation 1
532 decorstyle furniture
533 floorstyle dirt
534 wallstyle wooden
535 symmetry 1
536
537
538 Below is the original proposal:
539
540 Random Maps
541
542 The major thing still missing from Gridarta, I think, is a good facility
543 for generating random maps:
544
545 1. They can be used by map creators to create a basic layout for his
546 quest or whatever, so that he need not start from a blank canvas.
547
548 2. Buildings with nothing else in them can have a random map in them.
549 In fact, we could have the same random map generated every time someone
550 enters a particular building (pick the seed off of the parent map name
551 and the entrance location!) This would transform the world from finite
552 to infinite.
553
554 Needed Features:
555
556 Styles:
557
558 Random maps would need to be "styled": walls, doors, monsters, and other
559 decor should be picked from certain subsets of the total object set. An inn
560 has a very different style than a castle, and from a dungeon, in both walls,
561 decor, and monsters.
562
563 Ubiquity: (map configurable: unspecified==no random maps)
564
565 Any exit which does not have a destination specified should lead to
566 a random map, but WITH a sign saying "this is a random map".
567
568 Identifiability: (configurable)
569
570 Random maps includes a sign
571 which states that the map is random.
572
573 Recursion:
574
575 Random maps should optionally have another entrance to a random map of
576 the same style. The depth of recursion should be specifiable.
577
578 Difficulty:
579
580 Difficulty should be specifiable. Also, whether the map advances in
581 difficult with recursion should be specified.
582
583 Quests:
584
585 It would be cool if random quests could be implemented, too. I won't
586 put this in immediately.
587
588 Standalone operation:
589
590 It'd be cool if the random map generator operated standalone, so that
591 map designers could use it easily as well as the server could at exits.
592
593 Size:
594
595 Random maps should be sized. A big, multi-square exit should have a bigger
596 random map to it, while a small house should have a small interior.
597
598 Inheritance:
599
600 The type and location of the exit should imply something about its random
601 interior. A shop exit should have a shop interior, a house should have a
602 home interior, etc, a difficult map should have difficult sub-maps.
603
604 Directedness:
605
606 Buildings should have random maps with stairs up to the next random map,
607 dungeons with stairs down, etc.
608
609 What does everyone think? Anyone willing to help? Has anyone already
610 made so much progress on this that I should just help them instead of
611 starting one myself?
612
613
614 Algorithms:
615
616 Maze algorithm: start from a wall point, move forward left or right
617 or start from a new wall point, at random, recursively. If blocked,
618 pop the stack until you can walk again. If you return all the way,
619 a maze is generated.
620
621
622 Specs for a room algorithm:
623 Can you write for a function:
624
625 char **room_gen_corridored(int xsize, int ysize, int option);
626
627 which allocates and returns a char[xsize][ysize], with # being a wall
628 and a char value of 0 indicating nothing.
629 like::
630
631 ######################
632 # # # #
633 # # # #
634 # #
635 # # # #
636 ######### ##########
637 # # # #
638 # #
639 # # # #
640 # # # #
641 ######### ##########
642 # # # #
643 # #
644 # # # #
645 ######################
646
647 Some suggested options:
648 option:
649 0 random choice of one of the other options below *
650 1 vertical centered corridor *
651 2 horizontal centered corridor *
652 4 vertical corridor on the right-hand wall *
653 8 vertical corridor on the left-hand wall
654 16 horizontal corridor on the bottom wall *
655 32 horizontal corridor on the top wall
656
657 The *'d ones are the important ones.
658
659 Options 4 and 16 are important so I can easily create reasonable
660 bilaterally and 4-way symmetric maps, as in a castle.
661
662 If you're really ambitious, you could make it so you could ADD the
663 options to get something like 10: centered vertical corridor and right-hand
664 corridor.
665
666 One restriction you must satisfy, however, is that every place on the map
667 be accessible from everywhere else.
668
669 Feel free to contact me with any questons.
670
671 [email protected]