Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional nesting in mapgen - by overmap neighbor adjacency #22131

Merged
merged 5 commits into from
Nov 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/json/mapgen/house/house_suicide.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
{ "group": "bedroom", "x": [ 14, 20 ], "y": [ 17, 20 ], "chance": 80, "repeat": [ 1, 4 ] }
],
"place_nested": [
{ "entries": [ [ "bathroom_suicide", 100 ] ], "x": 18, "y": 13 }
{ "chunks": [ [ "bathroom_suicide", 100 ] ], "x": 18, "y": 13 }
]
}
},
Expand Down
97 changes: 68 additions & 29 deletions data/json/mapgen/swamp_shack.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
[
{
"type": "palette",
"id": "swamp_background",
"furniture": {
"i": "f_cattails"
},
"terrain": {
" ": [ "t_swater_dp", "t_swater_sh", "t_swater_sh", "t_dirt", "t_dirt", "t_dirt", "t_dirt", "t_grass", "t_grass", "t_grass", "t_grass", "t_grass", "t_grass", "t_underbrush", "t_tree", "t_tree_young" ],
"i": "t_water_sh"
}
},
{
"type": "mapgen",
"method": "json",
Expand All @@ -7,30 +18,33 @@
"object": {
"fill_ter": "t_floor",
"rows": [
" i ",
" i i i i ",
" i i i i ii ",
" i i ii ",
" i ii i ",
" i i i ",
" i ii ",
"ii i -----------iii ",
"i i -CSn.....d- i ",
" i -....---+-- ",
" i i [email protected] ",
" [email protected] i ",
" i i -bbTc-s.ss- i ",
" i i ---o---+--- ",
" i i i=V,,^,,,,, i ",
" i ,,,,,,,,X= i ",
" i ,=&&,xxXX=i i ",
" ii i ========= i ",
" i i i ii",
" i i i i",
" i i i ii ",
" ii i i i i ",
" i ii i i i ",
" i i "
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ----------- ",
" -CSn.....d- ",
" -....---+-- ",
" [email protected] ",
" [email protected] ",
" -bbTc-s.ss- ",
" ---o---+--- ",
" =V,,^,,,,, ",
" ,,,,,,,,X= ",
" ,=&&,xxXX= ",
" ========= ",
" ",
" ",
" ",
" ",
" ",
" "
],
"palettes": [
"swamp_background"
],
"mapping": {
"B": {
Expand Down Expand Up @@ -83,7 +97,6 @@
}
},
"terrain": {
" ": [ "t_swater_dp", "t_swater_sh", "t_swater_sh", "t_dirt", "t_dirt", "t_dirt", "t_dirt", "t_grass", "t_grass", "t_grass", "t_grass", "t_grass", "t_grass", "t_underbrush", "t_tree", "t_tree_young" ],
"&": "t_dirt",
"+": "t_door_c",
",": [ "t_dirt", "t_dirt", "t_dirt", "t_dirt", "t_dirt", "t_dirt", "t_grass" ],
Expand All @@ -93,7 +106,6 @@
"V": "t_dirt",
"X": "t_dirt",
"^": "t_dirt",
"i": [ "t_swater_dp", "t_swater_sh", "t_swater_sh", "t_dirt", "t_dirt", "t_dirt", "t_grass", "t_grass", "t_grass", "t_underbrush" ],
"o": "t_window_domestic",
"x": "t_dirt"
},
Expand All @@ -112,11 +124,36 @@
"b": "f_makeshift_bed",
"c": "f_chair",
"d": "f_rack",
"i": [ "f_null", "f_null", "f_null", "f_null", "f_null", "f_null", "f_null", "f_cattails", "f_cattails", "f_cattails", "f_cattails" ],
"n": "f_counter",
"s": "f_counter",
"x": "f_crate_o"
}
},
"place_nested": [
{ "chunks": [ "cattail", "null" ], "x": [ 0, 6 ], "y": [ 0, 6 ], "neighbors": { "north": "forest_water" } },
Copy link
Member

@John-Candlebury John-Candlebury Oct 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the null mean in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the null is rolled, nothing is nested. They have equal weights. So 50% chance for cattail.
This is to pad the chances a bit, to make it somewhat more like the surrounding forest. Doing this whole "x rolls for cattail, 50% chance" makes it more like the math in forest cattail placement than just rolling "1 to 4 cattails" and placing those.

{ "chunks": [ "cattail", "null" ], "x": [ 7, 17 ], "y": [ 0, 6 ], "neighbors": { "north": "forest_water" }, "repeat": 4 },
{ "chunks": [ "cattail", "null" ], "x": [ 18, 23 ], "y": [ 0, 6 ], "neighbors": { "north": "forest_water" } },
{ "chunks": [ "cattail", "null" ], "x": [ 18, 23 ], "y": [ 0, 6 ], "neighbors": { "east": "forest_water" } },
{ "chunks": [ "cattail", "null" ], "x": [ 18, 23 ], "y": [ 7, 17 ], "neighbors": { "east": "forest_water" }, "repeat": 4 },
{ "chunks": [ "cattail", "null" ], "x": [ 18, 23 ], "y": [ 18, 23 ], "neighbors": { "east": "forest_water" } },
{ "chunks": [ "cattail", "null" ], "x": [ 0, 6 ], "y": [ 18, 23 ], "neighbors": { "south": "forest_water" } },
{ "chunks": [ "cattail", "null" ], "x": [ 7, 17 ], "y": [ 18, 23 ], "neighbors": { "south": "forest_water" }, "repeat": 4 },
{ "chunks": [ "cattail", "null" ], "x": [ 18, 23 ], "y": [ 18, 23 ], "neighbors": { "south": "forest_water" } },
{ "chunks": [ "cattail", "null" ], "x": [ 0, 6 ], "y": [ 0, 6 ], "neighbors": { "west": "forest_water" } },
{ "chunks": [ "cattail", "null" ], "x": [ 0, 6 ], "y": [ 7, 17 ], "neighbors": { "west": "forest_water" }, "repeat": 4 },
{ "chunks": [ "cattail", "null" ], "x": [ 0, 6 ], "y": [ 18, 23 ], "neighbors": { "west": "forest_water" } }
]
}
},
{
"type": "mapgen",
"method": "json",
"nested_mapgen_id": "cattail",
"object": {
"rows": [ "i" ],
"palettes": [
"swamp_background"
],
"mapgensize": [ 1, 1 ]
}
},
{
Expand Down Expand Up @@ -152,6 +189,9 @@
" ;;;;;;;;;;;",
" ;;;;;;;;;;"
],
"palettes": [
"swamp_background"
],
"mapping": {
"B": {
"items": [
Expand Down Expand Up @@ -227,7 +267,6 @@
}
},
"terrain": {
" ": [ "t_swater_dp", "t_swater_sh", "t_swater_sh", "t_dirt", "t_dirt", "t_dirt", "t_dirt", "t_grass", "t_grass", "t_grass", "t_grass", "t_grass", "t_grass", "t_underbrush", "t_tree", "t_tree_young" ],
"#": "t_dirtmound",
"&": "t_dirt",
"+": "t_door_c",
Expand Down
Loading