Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upFirst draft of json-augmentation of labs #24114
Conversation
BrianLefler
added some commits
Jun 27, 2018
ZhilkinSerg
added
[JSON]
Mapgen
[C++]
labels
Jun 27, 2018
This comment has been minimized.
This comment has been minimized.
|
That is something we were all waiting for a long time - see #10958. I will take a look asap. |
This comment has been minimized.
This comment has been minimized.
|
Cool, well the json runs alongside rather than replacing. The thought would be as content came in, a greater portion of labs could become json-driven, until it becomes almost entirely json (leaving just stairs, cold, and ant/slime adjacency effects to be handled in code). The 1sided rooms adjust naturally, the 4sided rooms require a tiny cpp change to make it more common. I heavily used the nested json functionality to have variation--that feature's amazing and thank you I think to @Coolthulhu for doing it. Right now it does not support rotation, seem to set traps, or allow non-square maps; all of which would make life a little easier if added and I'd like to dig into later. I put rotation settings in nested json objects right now, which should just increase the observed variation whenever it gets implemented. |
BrianLefler
added some commits
Jun 27, 2018
This comment has been minimized.
This comment has been minimized.
|
Ok, I have cleaned up the adjacency json to ensure walls in all 4 directions (walls north&west, remove doors south&east). It is a bit brutal in that it completely clobbers whatever's there, but it works. I am a bit suspicious of the drop rates, which I suspect I've set a little high. Any idea if it's possible / desirable to consolidate loot generation into a palette? Then it could be reused through lab json and tweaked in one place to get the right level of loot. |
ZhilkinSerg
reviewed
Jun 28, 2018
| "object": { | ||
| "mapgensize": [ 24, 24 ], | ||
| "place_terrain": [ | ||
| { "ter": "t_concrete_wall", "x": 0, "y": 0 }, |
This comment has been minimized.
This comment has been minimized.
ZhilkinSerg
Jun 28, 2018
Contributor
I believe you can draw lines of terrain:
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/MAPGEN.md#22-set
This comment has been minimized.
This comment has been minimized.
BrianLefler
Jun 28, 2018
Author
Contributor
Cool, that is really nice except that set-line turns out to not trigger the removal of furniture when walls are placed over them, so it leaves counters etc floating in the wall. I will update the json if I can figure out how to add that feature.
This comment has been minimized.
This comment has been minimized.
AMurkin
Jun 28, 2018
Contributor
Am i wrong that there is an error in the example of "line" in MAPGEN.md?
Example: { "point": "terrain", "id": "t_lava", "x:" 5, "y": 5, "x2": 20, "y2": 20 }
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
If I have time over the next week I can separate the json out into files (24x24 floorplans, 7x7/9x9 subrooms, palettes) and add more content. I could also start migrating hardcoded content to json if people want. Most useful for me is direction on what people want to see done here, or whether it should go in as a pull now and be added to later. |
This comment has been minimized.
This comment has been minimized.
Great job so far! Will try to mergetest it during weekend and give some feedback. |
BrianLefler
added some commits
Jun 30, 2018
Night-Pryanik
referenced this pull request
Jul 1, 2018
Closed
What to do with manual installation of bionics? #24113
BrianLefler
added some commits
Jul 1, 2018
This comment has been minimized.
This comment has been minimized.
|
Ok, added. It's a little unoriginal, but the operating theatre is basically a 180 rotation of the existing alien containment, with the option of a hard hack (security 6) to unlock to the autodoc room, or an easy hack (security 2) to unlock all doors and fight your way through four cyborgs. |
This comment has been minimized.
This comment has been minimized.
|
Cool, thank you so much. |
BrianLefler
added some commits
Jul 4, 2018
This comment has been minimized.
This comment has been minimized.
|
The hard-coded barracks and prisoner containment areas should now be in json, with the hardcoded versions removed. This is the first time I've removed content instead of adding it, so it should be very obvious in testing. Differences:
Also, while I'm at it, in the barracks, shouldn't the magazine access control room have the doors reversed--so the locked door goes to the magazine and the unlocked door goes to the general barracks? I have always smashed the window in and ignored the console, which seems like a mistake by whomever originally made the map. |
This comment has been minimized.
This comment has been minimized.
|
Sorry, I didn't have time to look at this yet. Please inform when you think it will be ready to go and I will start testing. You could always add more changes in later PRs. |
BrianLefler
added some commits
Jul 5, 2018
This comment has been minimized.
This comment has been minimized.
|
Ok. I am at a great stopping point. The big hardcoded rooms for the lab have now all been converted to json. It now does have a merge conflict, should I pull from master and resolve it or is that something you want to do? Summary of big changes a player will notice:
|
BrianLefler
added some commits
Jul 5, 2018
This comment has been minimized.
This comment has been minimized.
|
Ok, I have merged in master. Should be good to review and I'm not planning any additional changes at this time. |
ZhilkinSerg
self-assigned this
Jul 10, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Yeah, I know! I couldn't figure out a clean way to avoid this but it should not be visible to the user unless they take a jackhammer and start blasting through wall. What's happening is that applying a submap with rows doesn't overwrite furniture. So there's a room w/ furniture there in the normal cross-layout, then we decide to replace it with rocks & close the door (because it borders rocks). The submap replaces the terrain w/ rocks, but not the furniture. I think I can get rid of the furniture that by replacing the 9x9 submap with 81 individual place_terrain calls. Will do that in a few days (as part of this PR or another). |
This comment has been minimized.
This comment has been minimized.
I guess that will be fine to fix in another PR. |
BrianLefler
added some commits
Jul 13, 2018
This comment has been minimized.
This comment has been minimized.
|
Ok, I think the furniture floating is now fixed and I found a way to keep the json required relatively small. |

BrianLefler commentedJun 27, 2018
Would love feedback on this. It adds two json map names with special treatment: lab_1side and lab_4side.
Any map which is added under those names will go into the mix to be randomly selected when creating labs. They use the standard json generation, but add on proper handling for stairs and ice_lab settings.
They are mixed in with existing content in this way:
The maps that have been created use nested submaps extensively to populate a lot of smaller rooms, similar to the existing cross and tic-tac-toe boards. But they aren't great and I'm not very good with json, so if anyone wants to make suggestions or changes, I'd love to see more. I just wanted to get the ball rollling.