Underground map generation, how does it work?

Disclaimer: No, I’m not asking to add ores and such to the game. I know that’s not in the cards.

I was looking into the possibility of adding patches underground dirt to the upper Z levels, so we don’t just have an endless expanse of solid rock as a basis for our underground. Problem is, I’m very new to modding the game, and my knowledge of coding is basically nonexistent. I’ve seen DangerNoodle’s mining mod, and used it before, and so I know it’s possible to use the overmap generation as a workaround for generating stuff underground.

My questions are:
-MINEABLE tag - how difficult would it be to make a variant of this flag for terrain to denote materials soft enough to dig through with a shovel? Would it be better to just make it soft enough to bash down?
-item_action PICKAXE - If the above seems doable, how would I get started on making a new flag for shovel type items to allow you to actually do it?
-Would adding a new underground terrain type break the existing underground features, like basements, etc, that use “fill_ter”: “t_rock”?
-Is there any way to make terrain like this form clusters without it being vanishingly rare in a sea of stone? Soil shouldn’t be particularly rare on Z-1, what with New England’s glacial deposits.

Any help would be greatly appreciated :slight_smile:

There was talk about adding this recently on Discord, but nobody could find good sources for soil depth in the new England area, and it was just kind of dropped.

  1. You add the new flag to the terrains, then you add the appropriate C++ code checking for that flag and if you have an item with digging quality of a certain level in an appropriate iuse action.

  2. You would make a new item action, which is defined in C++ (the pickaxe one is here). This would be a little more complicated for shovels because they have multiple use actions.

  3. Yes, and you would need to adjust those.

  4. Yes, but adding soil spawning in general, and particularly realistic spawning would require some decently complex C++ code.

Right, well, I’m outie. I could at least look into #1, and if that goes well, #2, but my knowledge of C++ is basically nonexistent. Maybe I could learn a bit from this, but I’m not holding out hope to be honest. There’s a site on soil in the area at http://nesoil.com/ but it really depends where the game is set in New England. There’s basically areas of really thin soil, and then relatively thick silt, due to the glaciation in the area relatively recently (geologically speaking). Definitely deep enough for someone to dig a supported hole and walk around underneath the topsoil, but probably not ‘Vietcong multilevel dungeon of hell’ deep.

I’m working on a pr right now to make mining times depend on tool quality and the terrain’s bash values. If that gets merged you could make soil faster to mine than rock by giving it lower bash values, and mineable with a shovel by giving shovels a low mining quality.

1 Like

If you want to make this happen, I encourage you to make a GitHub issue, or join the Discord (or both) and the ask about it, or ask someone to help guide you through how to do it. I’d encourage you to join the Discord anyway, as there is a fair amount of dev discussion there.

Awesome, that’d be a great addition to the game. Look forward to seeing it in action, and wish I could help, but as I said, I have no experience with C++. Best of luck with your pr!