ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/doc/Developers/random-maps
Revision: 1.2
Committed: Thu Sep 7 21:42:50 2006 UTC (17 years, 8 months ago) by pippijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
Moved documents to doc/historic

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