ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/doc/Developers/random-maps
Revision: 1.1.1.2 (vendor branch)
Committed: Wed Feb 22 18:01:48 2006 UTC (18 years, 4 months ago) by elmex
Branch: UPSTREAM
CVS Tags: UPSTREAM_2006_03_15, LAST_C_VERSION, STABLE, UPSTREAM_2006_02_22, difficulty_fix_merge_060810_2300
Branch point for: difficulty_fix
Changes since 1.1.1.1: +10 -5 lines
Log Message:
cvs -z7 -d:ext:elmex@cvs.schmorp.de:/schmorpforge import cf.schmorp.de UPSTREAM UPSTREAM_2006_02_22

File Contents

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