ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/pod/random_maps.pod
Revision: 1.1
Committed: Tue Jun 29 18:19:01 2010 UTC (13 years, 11 months ago) by root
Branch: MAIN
Log Message:
grrr

File Contents

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