1**Intermediate Mapgen Guide:**
2
3This guide assumes you are comfortable with basic mapgen elements and adding regular mapgen.  It is meant as a supplement to the mapgen.md and overmap.md documents.
4
5**This guide will cover:**
6
7* When to use nested mapgen vs. regular mapgen variants.
8* How to make and spawn a nested map.
9* Some nested map possibilities.
10* NPC spawning.
11* Leveraging existing nested maps for modders.
12* Basic update_mapgen using traps.
13* Merged maps for large buildings.
14
15
16**Files you’ll use:**
17* a new or existing file to hold your nested map entries (there is a sub folder in mapgen for nested map files).
18* the mapgen file you want your nests to spawn in
19* palette (optional)
20* the files used in the beginner's tutorial (a mapgen file, overmap_terrain, and specials.json or multitile_city_buildings.json/regional_map_settings.json.)
21
22**Nested maps vs. variant maps:**
23
24Variant maps are mapgen files that completely replace another map variant by using the same `om_terrain name` and applying a `weight` entry to each variant for spawning in relation to each other.
25
26Nested maps are a new layer of map applied to an existing mapgen file.  They can overwrite existing terrain, furniture, add spawns for loot, monsters, vehicles, etc.  They can contain anything that a regular mapgen contains within the object entry.  Nested maps are spawned by adding an entry into the main mapgen’s object entry.  They can be any size from a single tile to the entire 24x24 overmap terrain.
27
28Both approaches offer advantages and disadvantages to adding variety to maps.
29
30Variants are good for large structural changes or complete overhauls.
31
32* For example, I may do a portion of a farm with a barn and another with a set of farm plots.
33* If I want clearly different variants for an entire map, like the same house as empty, abandoned, and furnished.
34* Before we added json roofs (and other linked z levels) to our mapgen, most buildings utilized variants for spawning, most have now been renamed but some variants still exist, especially in older specials.
35
36Nested maps are good for adding more targeted variety and randomness to maps.  In addition to what the variant offers, nested maps can let you do things like:
37
38* rearrange the furniture in a room, or in every room on a case by case basis.
39* add smaller targeted thematic content like set pieces, additional monsters, hidden rooms, rare spawns.
40* Have different sets of loot and room themes that randomly spawn across multiple buildings.
41
42
43**Update_mapgen:**
44
45Update mapgen is triggered during game play instead of being initialized during worldgen.  I’ll cover some of the update_mapgen uses in this document but it deserves its own guide.
46
47 * Traps can trigger mapgen changes.
48 * Allows missions to trigger mapgen changes.
49 * Used by the faction camp building system for blueprints along with nested maps.
50 * Used by map_extras.
51
52update mapgen maps are similar to nested maps but are applied to an existing map, not to the mapgen file.  Like nested maps, they can overwrite existing terrain, furniture, add spawns for loot, monsters, vehicles, etc.  They can contain anything that a regular mapgen contains within the object entry.  They can be any size from a single tile to the entire 24x24 overmap terrain, and can even included nested mapgen objects.
53
54**Merged Maps**
55
56Merged maps are when you combine the mapgen entries for several OMTs into a single mapgen entry.  The `rows` are combined for a group the maps.  This is usually used for improved readability for the json and a more compact file size.  They are generally handled the same as a single OMT mapgen, with a few exceptions included in this document.  Like any mapgen option, there are tradeoffs, a notable limitation is the single fill_ter entry for multiple OMTs.
57
58**Creating Nested Maps:**
59
60You’ll want to make some choices before adding nested maps.
61
62* Their purpose, where are they spawning, multiple locations?
63* If it is within a larger building, will you include doors/walls?
64* What size map do you need to make.
65
66A nested map gives you the ability to overwrite or fill in a portion of an existing mapgen.  The contents of the nested map entry can contain any entry within mapgen objects (excepting fill_ter).  This includes adding nested maps inside your nested map for extra variability.
67
68Example json entry for the nested map:
69
70```
71  {
72    "type": "mapgen",
73    "method": "json",
74    "nested_mapgen_id": "room_9x9_recroom_E",
75    "//": "an entertainment area for various recreations",
76    "object": {
77      "mapgensize": [ 9, 9 ],
78      "rotation": [ 0, 3 ],
79      "rows": [
80        "|||||||||",
81        "|HHH...=|",
82        "|Hl....x|",
83        "|%.....=|",
84        "|.A.A..&|",
85        "|JJ5JJ  +",
86        "|       |",
87        "|mVJ14 T|",
88        "|||||||||"
89      ],
90      "palettes": [ "standard_domestic_palette" ],
91      "terrain": {
92        ".": "t_carpet_green",
93        "H": "t_carpet_green",
94        "l": "t_carpet_green",
95        "A": "t_carpet_green",
96        "=": "t_carpet_green",
97        "x": "t_carpet_green",
98        "%": "t_carpet_green",
99        "&": "t_carpet_green"
100      },
101      "furniture": { "%": "f_arcade_machine", "=": "f_speaker_cabinet", "&": "f_pinball_machine" },
102      "place_loot": [ { "item": "stereo", "x": 7, "y": 2, "chance": 100 }, { "item": "laptop", "x": 5, "y": 5, "chance": 60 } ]
103    }
104  }
105  ```
106
107This should feel pretty familiar since it looks like the `object` entry in mapgen and shares the same `type`.
108Note the ID is now `nested_mapgen_id` and the object uses a new entry `mapgensize`
109
110* `nested_mapgen_id`:  Your ID should provide useful information about the nest.  Multiple nests can share the same ID.
111
112* `weight`:  This value is new and most nested maps don't have it yet.  It allows you to weight the spawns of nests that share the same `nested_mapgen_id` (aka variants of nests).
113
114* `mapgensize`:  Nested mapgen can be any size from 1x1 to 24x24 but it must be square.  You don't have to use every row or column of the `rows` entry.  Any unused portions will fall back to the main mapgen.
115
116* `terrain` & `furniture`:   Without `fill_ter`, you need to define every floor terrain under furniture.  If you don't it will fall back to the main mapgen's `fill_ter`.  In the above example, there's a green carpet in 1/2 the map and the rest picks up the floor of the mapgen (indoor concrete).  If you need to overwrite existing furniture in the main mapgen you can use a combination of `t_null` and `f_null` to override preexisting mapgen.
117
118_Tips:_
119If you're doing interior spaces, pay attention to door placement and access pathways.
120
121* For walled nests, I generally keep the doors in the center of the walls.
122* For open floor plan nests, I try to preserve the corner spaces for doors in the regular mapgen (if I can design the mapgen with the nests).
123
124example: note the corner tiles are all empty.
125```
126      "rows": [
127        " CR ",
128        "O   ",
129        " EE ",
130        " EE "
131      ],
132```
133
134example room outline with possible door placements.  The `+` denotes any valid door placement for the above nest.  This approach gives you the maximum number of possibilities for fitting this nest into enclosed rooms without blocking the doorway.  I toss some indoor plants or other small furniture into the unused corners in the main mapgen as well, to fill out the rooms.
135
136```
137      "rows": [
138        "|+||+|",
139        "+ CR +",
140        "|O   |",
141        "| EE |",
142        "+ EE +",
143        "|+||+|"
144      ],
145```
146
147Fitting nests into existing foundations/building outlines can be a bit of a puzzle, especially as you add variations that share the same ID or are used over many maps.  So having your doors in predictable places in all your nests will aid in their re-use for future maps.
148
149We use a naming convention that includes the nested map size and some indication of its orientation or we add a comment with extra context in the json entry.
150
151Some ID's:
152* room_9x9_recroom_N
153* room_9x9_recroom_S
154* 7x7_band_practice_open
155
156
157by using room and a compass direction, it quickly identifies the nest as having walls/door and the door's orientation.  The band practice one is an open space, no walls included.  Including the map size will make searching, debug spawning and re-using nests easier as well.
158
159
160**Debug testing:**
161
162So many nests, so hard to find ones to use!
163
164We've recently gotten the ability to spawn nested maps via debug in game and this is a huge help for making sure nests fit, don't conflict with elements in the existing maps and are oriented well without adjusting spawn weights to force the nest to spawn naturally.
165
166This is also a good way to "shop around" for existing nests to re-use in your maps.
167
168To debug spawn a nested map in game:
169* Open debug menu (you will need to add a key bind)
170* Choose `map` [m]
171* Choose `spawn nested map` [n]
172* Search list by using [/]
173* Use your selector to place the nested map.  The indicator is 0,0 coordinate of the nest.
174
175You'll quickly see why it's good to use a coherent name format.
176
177**Mini nests:**
178
179Nests can be as small as one tile which is very useful if you want special or rare spawns for items, monsters, vehicles, NPCs or other elements.
180
181An example of a spawn for a particular loot group:
182These nests were used in a larger nest of a basement study.  I didn't want the study to offer all the magiclysm class books at once.  I made nests for each spell class item_group:
183
1843 1x1 nested maps that only include loot placement.  They feed into a larger nest.
185
186```
187  {
188    "type": "mapgen",
189    "method": "json",
190    "nested_mapgen_id": "animist_loot_spawn",
191    "object": { "mapgensize": [ 1, 1 ], "place_loot": [ { "group": "animist_items", "x": 0, "y": 0, "chance": 70 } ] }
192  },
193  {
194    "type": "mapgen",
195    "method": "json",
196    "nested_mapgen_id": "magus_loot_spawn",
197    "object": { "mapgensize": [ 1, 1 ], "place_loot": [ { "group": "magus_items", "x": 0, "y": 0, "chance": 70 } ] }
198  },
199  {
200    "type": "mapgen",
201    "method": "json",
202    "nested_mapgen_id": "stormshaper_loot_spawn",
203    "object": { "mapgensize": [ 1, 1 ], "place_loot": [ { "group": "stormshaper_items", "x": 0, "y": 0, "chance": 70 } ] }
204  }
205  ```
206
207**NPC spawning:**
208
209If you use `place_npc` on the main mapgen, the NPC will spawn 100% of the time.  NPC's like the refugee center ones get placed like this.
210
211However, many NPCs should be closer to random encounters.  The below example creates a nest that spawns an NPC (and only the NPC):
212
213```
214  {
215    "type": "mapgen",
216    "method": "json",
217    "nested_mapgen_id": "SEER_Brigitte_LaCroix_spawn",
218    "object": { "mapgensize": [ 1, 1 ], "place_npcs": [ { "class": "SEER_Brigitte_LaCroix", "x": 0, "y": 0 } ] }
219  }
220```
221
222You can also customize the surroundings in which the NPC spawns.  For the Chef NPC that spawns in one restaurant, they get their survivor themed setting included:
223Note the use of `t_null` in the majority of the map.  A lot of the map is unused and relies on the main mapgen.  It rearranges furniture to blockade the entrance and adds a little survivor's den flavor.
224```
225  {
226    "type": "mapgen",
227    "method": "json",
228    "nested_mapgen_id": "chef_s_restaurant",
229    "object": {
230      "mapgensize": [ 13, 13 ],
231      "rows": [
232        "mt_________#t",
233        "____________r",
234        "__________ffr",
235        "___________W_",
236        "_____________",
237        "_____________",
238        "_____________",
239        "_____________",
240        "_____________",
241        "_____________",
242        "_____________",
243        "_____________",
244        "_____________"
245      ],
246      "terrain": { "_": "t_null", "-": "t_wall", "W": "t_window_boarded" },
247      "furniture": { "r": "f_rack", "f": "f_fridge", "t": "f_table", "#": "f_counter", "m": "f_makeshift_bed" },
248      "place_npcs": [ { "class": "survivor_chef", "x": 5, "y": 1 } ],
249      "place_loot": [
250        { "group": "produce", "x": [ 10, 11 ], "y": 2, "chance": 70, "repeat": [ 2, 3 ] },
251        { "group": "groce_meat", "x": [ 10, 11 ], "y": 2, "chance": 70, "repeat": [ 2, 3 ] },
252        { "group": "groce_dairyegg", "x": [ 10, 11 ], "y": 2, "chance": 70, "repeat": [ 2, 3 ] },
253        { "group": "bar_food", "x": [ 10, 11 ], "y": 2, "chance": 70, "repeat": [ 2, 3 ] },
254        { "group": "bar_fridge", "x": [ 10, 11 ], "y": 2, "chance": 70, "repeat": [ 2, 3 ] },
255        { "group": "jackets", "x": 0, "y": 0, "chance": 70, "repeat": [ 2, 3 ] },
256        { "group": "alcohol_bottled_canned", "x": 1, "y": 0, "chance": 80 },
257        { "group": "baked_goods", "x": [ 2, 4 ], "y": 2, "chance": 50, "repeat": [ 2, 3 ] },
258        { "group": "groce_bread", "x": [ 2, 4 ], "y": 2, "chance": 50, "repeat": [ 2, 3 ] },
259        { "group": "cannedfood", "x": [ 5, 6 ], "y": 0, "chance": 50, "repeat": [ 2, 3 ] },
260        { "group": "cannedfood", "x": [ 9, 11 ], "y": 0, "chance": 50, "repeat": [ 2, 3 ] }
261      ]
262    }
263  }
264```
265
266  **Spawning the nested maps**
267
268  You can spawn nests in the usual two methods, using explicit symbol placement or x,y coordinates.  I've encountered rare instances where one style works and the other doesn't but haven't pinned down the cause yet.
269
270
271  **x,y coordinate placement:**
272
273This adds some nice variability if you want the nest's spawn location to shift a bit around the map.  I used this extensively on roofs since they are open spaces and I wanted to decrease how static they would feel otherwise.
274
275
276  In the main mapgen's `object` you enter the following entry:
277```
278  "place_nested": [
279        {
280          "chunks": [ [ "null", 30 ], [ "roof_6x6_utility", 30 ], [ "roof_4x4_utility_1", 40 ] ],
281          "x": [ 5, 14 ],
282          "y": [ 14, 16 ]
283        }
284      ]
285```
286
287A NPC example:
288
289```
290"place_nested": [ { "chunks": [ [ "SEER_Brigitte_LaCroix_spawn", 20 ], [ "null", 80 ] ], "x": 18, "y": 6 } ]
291```
292
293The `chunks` are the `nested_mapgen_id` of the nests and each includes their spawn weight in relation to each other.  Adding a `null` entry allows for the nest to have a chance to not spawn anything.  `Null` also ensures your NPC related nest spawns as a chance instead of being guaranteed.
294
295**Explicit symbol placement:**
296
297In the main mapgen's `object` you add the following entry:
298Wherever on the main mapgen's `rows` I place a `1` the first set of chunks will spawn.  The other set will spawn wherever I place a `2`.  The symbol should be placed wherever you want the 0,0 coordinate of your nested map placed.
299
300```
301"nested": {
302        "1": {
303          "chunks": [ [ "null", 60 ], [ "room_10x10_woodworker_E", 30 ], [ "room_10x10_guns_E", 10 ], [ "room_10x10_guns_N", 10 ] ]
304        },
305        "2": {
306          "chunks": [
307            [ "null", 50 ],
308            [ "room_6x6_brewer_N", 10 ],
309            [ "room_6x6_junk", 30 ],
310            [ "room_6x6_office_N", 30 ],
311            [ "6x6_sewing_open", 20 ],
312            [ "6x6_electronics_open", 10 ],
313            [ "room_6x6_brewer_W", 10 ],
314            [ "room_6x6_junk_W", 30 ],
315            [ "room_6x6_office_W", 30 ]
316          ]
317        }
318      }
319```
320
321The main mapgen `rows` with symbols:
322```
323      "rows": [
324        "                        ",
325        "                        ",
326        "                        ",
327        "                        ",
328        "        ||||||||||||||  ",
329        "        |.g...JJJWZ.U|  ",
330        "        |F..........<|  ",
331        "        |............|  ",
332        "        |............|  ",
333        "        |......2.....|  ",
334        "  |||||||............|  ",
335        "  |1.................|  ",
336        "  |..................|  ",
337        "  |..................|  ",
338        "  |..................|  ",
339        "  |..........|||||||||  ",
340        "  |..........|          ",
341        "  |..........|          ",
342        "  |..........|          ",
343        "  |..........|          ",
344        "  |..........|          ",
345        "  ||||||||||||          ",
346        "                        ",
347        "                        "
348      ],
349```
350
351**Nested maps and z levels:**
352
353Currently, nested maps do not support z level linking, so any nested map you make will rely on the main mapgen's roof or attempt to generate the c++ roofs.  This works with varying degrees of success.  Mostly I find it annoying when I can't put a glass roof on greenhouses.
354
355**Leveraging existing nested maps for modders.**
356
357As the nested maps used in vanilla increase, modders can make use of these existing entries to incorporate their mod maps into existing buildings.  This should greatly expand the mod's ability to add its content into vanilla maps.  By using the same `nested mapgen id` and assigning a `weight` to both your new nest and existing nests (as needed).
358
359I recommend the modder take a look through existing maps and see if there is one that fits the same overall size, orientation, and spawning rarity that they would like their modded nest to have.
360You can search for the nested mapgen ids in the github to make sure its representation meets your needs.
361
362
363**Update_mapgen:**
364
365As mentioned before, Update_mapgen is applied to existing maps due to events that occur during game play.
366
367Update mapgen will be covered more in advanced guides that address its uses in faction bases and NPC missions.
368
369For this guide, the most likely use will be for trap triggered update_mapgen.  This is a very new feature and currently is used in the microlab and the magiclysm mod's magic basement.
370
371Since it is still a new feature, it hasn't been expanded upon much.  Currently the following limitation applies:
372*  Traps can only be triggered by a Player or NPC moving on to the trap tile.
373
374We are going to use the simpler implementation found in the Magiclysm basement over the micro_lab but I'd recommend looking at the micro lab's multi-trap system as well.
375
376You will need a trap entry (or use an existing one)
377
378Trap example:
379```
380  {
381    "type": "trap",
382    "id": "tr_magic_door",
383    "name": "magic door",
384    "color": "brown",
385    "symbol": "+",
386    "visibility": 99,
387    "avoidance": 99,
388    "difficulty": 99,
389    "action": "map_regen",
390    "map_regen": "magic_door_appear",
391    "benign": false
392  }
393  ```
394
395  All the trap specific entries can be learned about in other documentation.  What concerns us here are the `action` and `map_regen` entries.  We want this trap to trigger a `map_regen` action and the `map_regen` references our `update_mapgen_id`.
396
397  update_magen similarities to nested maps:
398
399  * it can target a smaller map chunk.
400  * it uses the `object` data.
401
402  differences from nested maps:
403
404  * Coordinates used refer to the main mapgen it is updating.
405
406  update_mapgen sample:
407
408  ```
409    {
410    "type": "mapgen",
411    "update_mapgen_id": "magic_door_appear",
412    "method": "json",
413    "object": {
414      "place_terrain": [ { "ter": "t_carpet_green", "x": 12, "y": 6 } ],
415      "place_furniture": [ { "furn": "f_beaded_door", "x": 12, "y": 6 } ]
416    }
417  }
418  ```
419In this example, instead of making rows and assigning symbols, I used a condensed alternative with `place_terrain` and `place_furniture`.  The x,y coordinates refer to the main mapgen this is altering.  This could have used the typical rows coding we normally use in mapgen as well.
420
421The main mapgen and spawning your trap:
422
423```
424  {
425    "type": "mapgen",
426    "method": "json",
427    "om_terrain": [ "magic_basement" ],
428    "weight": 100,
429    "object": {
430      "fill_ter": "t_carpet_green",
431      "rows": [
432        "                        ",
433        "        ||||||||||||||| ",
434        "        |gUU|yRRRRRRET| ",
435        "   ||||||~~~%........E| ",
436        "  ||????|||||........L| ",
437        " ||.......E!|...E....|| ",
438        " |&.........|.yrrr...<| ",
439        " ||...$...Py||||||/|||| ",
440        "  ||TIII|||||RRR......| ",
441        "   ||||||88S|.....H..x| ",
442        "        |~~~/.....H..x| ",
443        "        |B~~|.....s..x| ",
444        "        |BYt|RRRR.....| ",
445        "        ||||||||||||||| ",
446        "                        ",
447        "                        ",
448        "                        ",
449        "                        ",
450        "                        ",
451        "                        ",
452        "                        ",
453        "                        ",
454        "                        ",
455        "                        "
456      ],
457      "palettes": [ "standard_domestic_palette" ],
458      "place_traps": [ { "trap": "tr_magic_door", "x": 21, "y": 4 } ]
459    }
460  }
461  ```
462
463  I've placed the trap under a coat rack to dissuade casual triggering.  Note: when triggered, the trap will update the wall across the room with a beaded door entrance.
464
465
466**Merged maps**
467
468A merged map is json that has grouped several OMTs together within one mapgen entry.  There is no size limit but you should do your best to keep the json readable, so break it up into manageable segments.  3 OMTs together left to right is 72 tiles, and fits easily inside CDDA's preference for no more than 100 columns per line, but some people do as many as 5 OMTs together.  More than 5 OMTs together left to right can be hard to read on smaller screens and should be avoided.  The same logic applies for vertical grouping: 2-3 OMTs fit easily on most screens, but more than that can be hard to read.
469
470You can insert existing OMT's into your merged map including forest, field, swamp and water tiles.  Generic tiles like forests don't need to be added in your mapgen file, they will be called in the specials.json or multitile_city_buildings entry.
471
472For the most part, merged maps use the exact same rules and entries as regular mapgen files with a few notable exceptions:
473
474om_terrain value:
475  This example is for a map that is 4 OMTs wide and 3 OMTs long (4x3) on the overmap.  Each row of OMT's are grouped into an array.
476
477```
478"om_terrain": [
479      [ "farm_stills_4", "farm_stills_3", "farm_stills_2", "farm_stills_1" ],
480      [ "farm_stills_8", "farm_stills_7", "farm_stills_6", "farm_stills_5" ],
481      [ "farm_stills_12", "farm_stills_11", "farm_stills_10", "farm_stills_9" ]
482    ]
483```
484
485Each OMT's coordinates will continue the row and column numbers, they do not reset to 0,0 at each map boundary.
486
487For our farm the coordinates will be:
488* x sets:
489  *  first OMT: 0,23
490  * second OMT: 24,47
491  * third OMT: 48,71
492  * fourth OMT: 72,95
493
494* y sets:
495  * first row: 0,23
496  * second row: 24,47
497  * third row: 48,71
498
499
500The object entries rows reflect all the OMTs together and all the other object entries are shared across all the OMTs:
501
502```
503      "rows": [
504        " IFFFFFFFI,,,,IFFFFFFFIffffffffffffffff ,,,, ffffIFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFI ",
505        " F        ,,,,        F   ????  ????   P,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,        ,           F ",
506        " F $$$$$$$,,,,$$$$$$$ F   -ww-  -ww-    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,DDDDDDDDDDDDDDDDDDD F ",
507        " F        ,,,,        F ---..----..---  ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   ,                F ",
508        " F        ,,,,        F -x..........x-   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,DDDDDDDDDDDDDDDDDDD F ",
509        " F $$$$$$$,,,,$$$$$$$ F -....hhhh....w   ?,?     I                    ,,,,                    F ",
510        " F        ,,,,        F w....tttt....-????,?     F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD,F ",
511        " F        ,,,,        F w....tttt....+,,,,,?     F     ,           Q  ,,,,    ,          ,    F ",
512        " F $$$$$$$,,,,$$$$$$$ F w....tttt...Y-??????     F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
513        " F        ,,,,        F -....hhhh....w           F,                   ,,,,           ,        F ",
514        " F        ,,,,        F -x..........x-   -ww-    F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
515        " F $$$$$$$,,,,$$$$$$$ F ----......--------HH---- F           ,        ,,,,                    F ",
516        " F        ,,,,        F -......................- F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
517        " F        ,,,,Q       F w.;;;;;;;;;;;;;;;;;;;;.w F                    ,,,,       ,        Q   F ",
518        " F $$$$$$$,,,,$$$$$$$ F -.....................x- F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
519        " F        ,,,,        F ---+-----+-----+-----+-- F     ,        ,     ,,,,                  , F ",
520        " F        ,,,,        F -iiiiu-H...-BB...kk-TiS- F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
521        " F $$$$$$$,,,,$$$$$$$ F -Siiiu-t...-.....h.-iii- F    ,               ,,,,            ,       F ",
522        " F        ,,,,        F woiiiu-H...-BB.....-iii- F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
523        " F        ,,,,        F -eiiiu-.BB.-.....h.-bbb- F                    ,,,,    ,               F ",
524        " F $$$$$$$,,,,$$$$$$$ F -iiiiu-.BBd-BBdddkk-bbb- F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
525        " F        ,,,,        F ---+----ww----ww-------- F,              ,    ,,,,                   ,F ",
526        " F        ,,,,        F    ,                     F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
527        " F $$$$$$$,,,,$$$$$$$ Iffff,fffffffffffffffffffffI        ,           ,,,,      ,             F ",
528        " F        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,DDDDDDDDDDDDDDDDDDD F ",
529        " F        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   ,        Q       F ",
530        " F $$$$$$$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,DDDDDDDDDDDDDDDDDDD F ",
531        " F        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,           ,        F ",
532        " F        ,,,,        I          ,,     ,,,,,O   I DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
533        " F $$$$$$$,,,,$$$$$$$ F #==#==#  ,,   ##MMMMM##  F         Q          ,,,,    ,              ,F ",
534        " F        ,,,,        F #L_q__#  ,, ? #E_____O#  F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
535        " F        ,,,,        F #L_q__# ,,,   #E______#  F                    ,,,,                    F ",
536        " F $$$$$$$,,,,$$$$$$$ F #L____# ,,   &#E______W  F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
537        " F        ,,,,        F #L_c__# ,,,,,,+_______#  F       ,            ,,,,          ,         F ",
538        " F        ,,,,        F ####### ,,   ?#l______#  F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
539        " F $$$$$$$,,,,$$$$$$$ F  ?      ,,    #l______W  F,             ,     ,,,,                    F ",
540        " F        ,,,,        F         ,,,   #l______#  F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
541        " F        ,,,,        F     ?    ,,   #_______#  F     ,              ,,,,   ,        ,       F ",
542        " F $$$$$$$,,,,$$$$$$$ F ?        ,,?  #########  F DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
543        " F        ,,,,        F          ,,              F         ,          ,,,,                    F ",
544        " F        ,,,,        IFFFFFFFFFI,,IFFFFFFFFFFFFFI DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
545        " F $$$$$$$,,,,$$$$$$$ f       ?  ,,     ?        f    ,           ,   ,,,,       ,            F ",
546        " F  Q     ,,,,        f  7   7   7,,  7   7   7  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
547        " F        ,,,,        f ?       ? ,,        ?    f         ,          ,,,,                    F ",
548        " F $$$$$$$,,,,$$$$$$$ f  ,,,,,,,,,,,,,,,,,,,,,,  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
549        " F        ,,,,        f           ,,             f           ,        ,,,,           Q        F ",
550        " F        ,,,,        f  7   7   7,,  7   7?  7  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
551        " F $$$$$$$,,,,$$$$$$$ f      ?   ,,,   ?         f,                   ,,,,  ,           ,     F ",
552        " F        ,,,,        f  ,,,,,,,,,,,,,,,,,,,,,,  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
553        " F        ,,,,        f   ?    ,,,             ? f         ,          ,,,,       ,           ,F ",
554        " F $$$$$$$,,,,$$$$$$$ f  7   7 ,,7 ?  7   7   7  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
555        " F        ,,,,        f?     ? ,,          ?     f                    ,,,,                    F ",
556        " F        ,,,,        f  ,,,,,,,,,,,,,,,,,,,,,,  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
557        " F $$$$$$$,,,,$$$$$$$ f        ,,       ?        f   ,           ,    ,,,,  ,          ,      F ",
558        " F        ,,,,        f  7   7 ,,7  ? 7   7   7  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
559        " F        ,,,,        f        ,,              ? f                 ,  ,,,,                    F ",
560        " F $$$$$$$,,,,$$$$$$$ f  ,,,,,,,,,,,,,,,,,,,,,,  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
561        " F        ,,,,        f    ?   ,,  ?             f,                   ,,,,    ,               F ",
562        " F        ,,,,        f  7   7 ,,7    7   7   7  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
563        " F $$$$$$$,,,,$$$$$$$ f        ,,       ?        f   ,      ,         ,,,,  ,         ,       F ",
564        " F        ,,,,        f  ,,,,,,,,,,,,,,,,,,,,,,  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
565        " F        ,,,,        f ?      ,,           ?    f        Q           ,,,,                    F ",
566        " F $$$$$$$,,,,$$$$$$$ f  7   7 ,,7    7   7   7  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
567        " F        ,,,,        f        ,,,  ?           ?f                ,   ,,,,          ,        ,F ",
568        " F        ,,,,     Q  f  ,,,,,,,,,,,,,,,,,,,,,,  f DDDDDDDDDDDDDDDDDDD,,,,DDDDDDDDDDDDDDDDDDD F ",
569        " F $$$$$$$,,,,$$$$$$$ f    ?     ,,,         ?   f     ,       ,      ,,,,                    F ",
570        " F        ,,,,        f  7   7   7,,  7   7   7  f,DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD F ",
571        " F        ,,,,        f       ?  ,,,     ?       f                 ,     ,        ,     Q     F ",
572        " F $$$$$$$,,,,$$$$$$$ f  ,,,,,,,,,,,,,,,,,,,,,,  f DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD F ",
573        " F        ,,,,        f  ?       ,,              f             ,              ,           ,   F ",
574        " F                    f  7   7   7  ? 7   7   7  f DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD F ",
575        " IFFFFFFFFFFFFFFFFFFFFIFFFFFFFFFFFFFFFFFFFFFFFFFFIFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFI "
576      ],
577```
578
579Important note about spawning items, vehicles and monsters:
580
581While these maps are merged for the benefit of readability, this isn't automatically recognized by our mapgen processes.  When you add spawns using x,y coordinates you can't cross OMT boundaries.  Make multiple entries if you want those spawns to occur across more than one OMT.  This applies for both x and y coordinates.
582
583An example:  each x coordinate encompasses one OMT from a segment of the mall.
584```
585"place_monsters": [
586        { "monster": "GROUP_MALL", "x": [ 2, 23 ], "y": [ 2, 23 ], "density": 0.15 },
587        { "monster": "GROUP_MALL", "x": [ 26, 47 ], "y": [ 2, 23 ], "density": 0.3 },
588        { "monster": "GROUP_MALL", "x": [ 49, 71 ], "y": [ 2, 10 ], "density": 0.2 },
589        { "monster": "GROUP_MALL", "x": [ 56, 68 ], "y": [ 17, 21 ], "density": 0.1 },
590        { "monster": "GROUP_MALL", "x": [ 73, 95 ], "y": [ 2, 10 ], "density": 0.2 },
591        { "monster": "GROUP_MALL", "x": [ 73, 95 ], "y": [ 17, 19 ], "density": 0.1 },
592        { "monster": "GROUP_MALL", "x": [ 98, 119 ], "y": [ 0, 11 ], "density": 0.2 },
593        { "monster": "GROUP_MALL", "x": [ 96, 105 ], "y": [ 16, 21 ], "density": 0.1 },
594        { "monster": "GROUP_MALL", "x": [ 170, 191 ], "y": [ 2, 23 ], "density": 0.1 },
595        { "monster": "GROUP_MALL", "x": [ 194, 215 ], "y": [ 2, 23 ], "density": 0.05 }
596      ]
597```
598
599* You can mostly get around this by using explicit symbol placement instead, which will apply to all the OMT's within your `rows`.  This can get a little messy for monster and vehicle spawns, so I usually keep those to x,y coordinates.
600
601* Vehicles that spawn across 2 OMT's won't spawn at all.  So if you can't get your vehicle to spawn, adjust its placement.  Vehicle's 0,0 coordinate can vary depending on the vehicle's own json entry so this usually will take some trial and error to get them spawning nicely.
602
603* Nested maps of all sorts can be used in a merged map, but they can't cross boundary lines (the nested map will be cut off at the boundary).
604
605* More information about monster spawning can be found in [doc/MAPGEN.md](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/MAPGEN.md#spawn-item-or-monster-groups-with-place_groups)
606
607Note: set point type entries (see the example below) don't work well with merged maps and the issue has been reported.  If you use this entry, the points will be repeated in every OMT in your merged map.
608
609sample:
610```
611"set": [
612        { "point": "trap", "id": "tr_funnel", "x": [ 2, 9 ], "y": 19, "repeat": [ 1, 2 ] },
613        { "point": "trap", "id": "tr_cot", "x": [ 2, 9 ], "y": [ 15, 17 ], "repeat": [ 1, 2 ] }
614      ]
615```
616I wanted to place this cot and funnel in the first OMT but it is repeated every time it encounters a new OMT boundary.
617