[Help] Map Generation


I was wondering if anyone could point me in the direction of the map gen, those sunken spots on the map annoy the living hell out of me and I want to get rid of them.


hey there @The.Vagabond, welcome tot he discourse :smile:

i won’t be of much help here, as i know very little about the terrain generation code, but i’ll page @Drotten and maybe he could help you. :slight_smile:

What sunken spots? You mean the places where there are lakes at high altitudes?

though i could be wrong, i believe that @The.Vagabond means these sunken spots,

that spawn in the plains.

First off, if you haven’t already done so, you’ll need to make sure that you have access to Stonehearth’s code and data files.

  • Navigate to where you installed Stonehearth and then into the mods folder. In there you should see at least four files, one of them named stonehearth.smod.
  • Since the smod files are just renamed zip files, simply rename that file to stonehearth.zip.
  • Extract the contents of the zip file.

The source code for the world gen is located in stonehearth/services/server/world_generation/. There are a lot script files used for this process, but (I believe) the one you’re looking for should be height_map_renderer.lua, take it with a grain of salt though as I haven’t spent a whole lot of time studying the world generation code.

Also, within stonehearth/data/biome/ you can find files that describe how biomes are to be generated. However, the dirt is not something that’s specific for a biome so I doubt you will find anything useful in there, I just thought I’d mention it since it’s connected to world generation.


8BitCrab is correct in his belief. I don’t know why, but those spots sunken into the ground of the plains just bug the crap out of me - they almost remind me of the deadscar from World of Warcraft. They are just these ugly spots on the map that seem to be positioned in all the best spots.

Drotten, thank you. Perhaps after if I figure it out I will post it as a mod if I can figure out how to do so - I’ve never shared any of the tweaks I’ve done to games before, and I am by no means a “modder”, but I like to tinker.


Edit: I believe these “depressions” are tied to terraindetailer.lua as part of a function that calls (if that is the proper term?) for “innitialize_plains_detailer”. However, I’ve never worked with lua script before - seems a quite bit more complicated than XML. I’m going to try to just comment out that whole entire function and cross my fingers…Report if I’ve blown the game up.

Maybe this is a simpler solution for now? link
it ad the colour of the ground to the construction blocks. so you can fix those holes.


Thank you for the link, that is quite interesting - I think I may use that just to have other building options. But I think for my purposes, I really think it’d be better to just “fix” the world generation so we don’t end up with these unsightly scars in the first place. I found a thread detailing how to edit out goblin camps causing a depression in the ground when they are spawned, so I may include that in my “fix”.

Thank you,

Edit: Okay. So that was an epic fail - simply getting rid of stuff blows up the game, FYI. I figured as much, but I figured It couldn’t hurt to attempt the simplest solution - Occam’s Razor just cut me. RIP.

Edit2: I managed to get rid of the offset of the plains depressions, so they are now just two block deep pits, without the “step”. I think in order to get rid of them all out I will need to get into depth_fn and height_fn and redefine them, because those are the only things in the lua code in terrain_detailer.lua that seem to correspond with what I want to do. However I can’t find where those two things are, I see mentions of classes and .json. But I don’t know what or where those are or would be. Huuurmmmm.

Hi, I was working on this, let me try to help you. Try this at each biome you want the change.

"height_base": 29,
  "__comments": {
     "valley_count": "offset of layers from base",
     "step_count": "number of layers",
     "step_size": "size of layer, for foothills and mountains this has to be multiple of 5"
  "plains": {
     "step_size": 1,
     "valley_count": 1,
     "step_count": 1

The key here is that you need to have the top layer at a multiple of 5, else the game crashes. To achieve that I used the height base at 29, cause 29 plus the 1 layer of plains will equal 30. Those 3 (step_size, valley_count and step_count) are the ones that control these things.

If I’m not mistaken, step_size is the size of each layer of plains (like each layer of a mountain has 5 or 10 blocks).
valley_count is how many layers you will have (like in foothills we have 3 or rocky mountains up to 7)
step_count is the amount of steps to reach the other layer.

I only got this working after I read the lua files and figured the math of it.
In your case I would recommend changing the lua files as it will change all biomes, not needing tuning each individually.