BIOME: I could really need some help with biome coding


#1

Hi! :relaxed:

-I am trying to make a biome that generates a world with a single giant mountain somewhere near the middle of the map, and surrounded only by small hills/mini-mountains, and vast planes.

I’d appreciate the help (=

Anorien biome .Json: anorien.zip (2.6 KB)

I mostly get this pattern, though I change the parameters/variables :sweat:

A biome generating a high mountain like the one below would be fine! (=
I have come so far as getting the mountains high, but I just can’t seem
to make the terrain around it low, and with less mountains…


{
   "alias": "stonehearth:biome:anorien",
   "display_name": "i18n(don_mod:data.biome.anorien.display_name)",
   "description": "i18n(don_mod:data.biome.anorien.description)",
   "random_location_names": [
      "i18n(don_mod:data.biome.anorien.random_location_names.000)",
      "i18n(don_mod:data.biome.anorien.random_location_names.001)",
      "i18n(don_mod:data.biome.anorien.random_location_names.002)",
      "i18n(don_mod:data.biome.anorien.random_location_names.003)"
   ],
   "image": "file(images/anorien_400x300.png)",
   "story_board_image": "file(images/anorien_story_board.png)",
   "game_mode_images": {
      "stonehearth:game_mode:normal": "file(images/anorien_story_normal.png)"
   },
   "mining_loot_table": "file(anorien_mining_loot_table.json)",
   "__comment": "parameters for generating forest, flora, and water",
   "ring_tesselation": {
      "dirt": [
         {
            "width": 8,
            "name": "dirt_edge_1"
         }
      ],
      "grass": [
         {
            "width": 4,
            "name": "grass_edge_1"
         },
         {
            "width": 6,
            "name": "grass_edge_2"
         }
      ],
      "grass_hills": [
         {
            "width": 3,
            "name": "grass_hills_edge_1"
         },
         {
            "width": 5,
            "name": "grass_hills_edge_2"
         }
      ]
   },
   "season": "spring",
   "palettes": {
      "spring": {
         "null": "#ff00ff",
         "unknown": "#25221a",
         "bedrock": "#514e45",
         "rock_layer_1": "#6B6860",
         "rock_layer_2": "#76726b",
         "rock_layer_3": "#82807b",
         "rock_layer_4": "#918d86",
         "rock_layer_5": "#b3b0aa",
         "rock_layer_6": "#c1c0bb",
         "rock_layer_7": "#c1c0bb",
         "rock_layer_8": "#c1c0bb",
         "soil_light": "#918154",
         "soil_dark": "#807147",
         "dirt": "#B3A16E",
         "dirt_edge_1": "#A29161",
         "grass": "#8BB270",
         "grass_edge_1": "#AFCC7C",
         "grass_edge_2": "#9DBF76",
         "grass_hills": "#75b370",
         "grass_hills_edge_1": "#99ce7c",
         "grass_hills_edge_2": "#87c076",
         "copper_ore": "#c87533",
         "tin_ore": "#b0a080",
         "iron_ore": "#90b0d0",
         "silver_ore": "#cccccc",
         "gold_ore": "#ffd700",
         "coal": "#021c24"
      }
   },
   "terrain": {
      "__comment": "minimum height for surface of terrain",
      "noise_map_settings": {
         "octaves": 4,
         "persistence_ratio": 0.015,
         "bandlimit": 1,
         "__comment": "can stretch the terrain vertically to allow for long mountain ridges",
         "aspect_ratio": 1
      },
      "plains_percentage": 40,
      "height_base": 36,
      "__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": 2,
         "step_count": 4
      },
      "foothills": {
         "step_size": 5,
         "step_count": 1
      },
      "mountains": {
         "step_size": 25,
         "step_count": 7
      }
   },
   "terrain_detailer": {
      "mountains": {
         "__comment": "determines the height of the first layer",
         "depth_function": {
            "octaves": 4,
            "persistence_ratio": 0.2,
            "amplitude": 1,
            "layer_thickness": 1,
            "layer_count": 2,
            "__comment": "determines how many adjacent blocks have the same depth",
            "unit_length": 1
         },
         "height_function": {
            "octaves": 6,
            "persistence_ratio": 0.1,
            "amplitude": 25,
            "layer_thickness": 1,
            "__comment": "determines how many adjacent blocks have the same depth",
            "unit_length": 9
         }
      },
      "foothills": {
         "depth_function": {
            "octaves": 4,
            "persistence_ratio": 0.2,
            "amplitude": 2.5,
            "layer_thickness": 1,
            "layer_count": 2,
            "unit_length": 6
         },
         "height_function": {
            "octaves": 4,
            "persistence_ratio": 0.1,
            "amplitude": 2.5,
            "layer_thickness": 3,
            "unit_length": 8
         }
      },
      "plains": {
         "depth_function": {
            "layer_thickness": 1,
            "layer_count": 1,
            "unit_length": 8
         },
         "height_function": {
            "layer_thickness": 1,
            "unit_length": 8
         }
      }
   },
   "landscape": {
      "placement_table": {
         "stonehearth:trees:oak:small": {
            "placement_type": "dense",
            "parameters": {
               "grid_multiple": 2,
               "item_density": 0.5,
               "exclusion_radius": 2
            },
            "mountains": {
               "placement_type": "single",
               "parameters": {
                  "ground_radius": 2,
                  "exclusion_radius": 3
               }
            }
         },
         "stonehearth:trees:oak:medium": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 2,
               "exclusion_radius": 4
            }
         },
         "stonehearth:trees:oak:large": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 3,
               "exclusion_radius": 5
            }
         },
         "stonehearth:trees:oak:ancient": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 4,
               "exclusion_radius": 8
            }
         },
         "stonehearth:trees:pine:small": {
            "placement_type": "dense",
            "parameters": {
               "grid_multiple": 2,
               "item_density": 0.5,
               "exclusion_radius": 2
            },
            "mountains": {
               "placement_type": "single",
               "parameters": {
                  "ground_radius": 1,
                  "exclusion_radius": 3
               }
            }
         },
         "stonehearth:trees:pine:medium": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 1,
               "exclusion_radius": 4
            },
            "mountains": {
               "placement_type": "single",
               "parameters": {
                  "ground_radius": 1,
                  "exclusion_radius": 3
               }
            }
         },
         "stonehearth:trees:pine:large": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 2,
               "exclusion_radius": 5
            }
         },
         "stonehearth:plants:brightbell": {
            "placement_type": "dense",
            "parameters": {
               "grid_multiple": 4,
               "item_density": 0.1,
               "exclusion_radius": 1
            },
            "mountains": {
               "placement_type": "single",
               "parameters": {
                  "ground_radius": 1,
                  "exclusion_radius": 3
               }
            }
         },
         "stonehearth:plants:frostsnap": {
            "placement_type": "dense",
            "parameters": {
               "grid_multiple": 4,
               "item_density": 0.2,
               "exclusion_radius": 1
            }
         },
         "stonehearth:plants:silkweed": {
            "placement_type": "dense",
            "parameters": {
               "grid_multiple": 4,
               "item_density": 0.1,
               "exclusion_radius": 1
            }
         },
         "stonehearth:plants:berry_bush": {
            "placement_type": "pattern",
            "parameters": {
               "min_rows": 2,
               "max_rows": 2,
               "min_cols": 2,
               "max_cols": 3,
               "item_spacing": 5,
               "item_density": 0.9
            }
         },
         "stonehearth:boulder:small": {
            "placement_type": "dense",
            "parameters": {
               "grid_multiple": 4,
               "item_density": 0.1,
               "exclusion_radius": 1
            }
         },
         "stonehearth:boulder:medium_1": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 1,
               "exclusion_radius": 2
            }
         },
         "stonehearth:boulder:medium_2": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 1,
               "exclusion_radius": 2
            }
         },
         "stonehearth:boulder:medium_3": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 1,
               "exclusion_radius": 2
            }
         },
         "stonehearth:boulder:large_1": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 2,
               "exclusion_radius": 3
            }
         },
         "stonehearth:boulder:large_2": {
            "placement_type": "single",
            "parameters": {
               "ground_radius": 2,
               "exclusion_radius": 3
            }
         }
      },
      "trees": {
         "__comment": "tree size variance. anything above 0 will be considered as tree placement, and the size of the tree is determined within the sizes node declared above",
         "sizes": {
            "stonehearth:trees:oak": {
               "small": 0,
               "medium": 4,
               "large": 8,
               "ancient": {
                  "percentage": 6
               }
            },
            "stonehearth:trees:pine": {
               "small": 0,
               "medium": 4,
               "large": 13
            }
         },
         "weights": {
            "plains": {
               "1": {
                  "stonehearth:trees:oak": 1
               }
            },
            "foothills": {
               "1": {
                  "stonehearth:trees:oak": 1,
                   "stonehearth:trees:pine": 3
               },
               "2": {
                  "stonehearth:trees:oak": 1,
                   "stonehearth:trees:pine": 2
               }
            },
            "mountains": {
               "1": {
                  "stonehearth:trees:pine": 4
               },
               "2": {
                  "stonehearth:trees:pine": 2
               }
            }
         },
         "noise_map_parameters": {
            "__comment": "gaussian function",
            "mean_offset": {
               "__comment": "boundary of terrain type",
               "boundary": -5,
               "water": 40
            },
            "terrain_based": {
               "plains": {
                  "1": {
                     "density": 0,
                     "mean": -40,
                     "std_dev": 0
                  },
                  "2": {
                     "density": 1,
                     "mean": -5,
                     "std_dev": 50
                  }
               },
               "foothills": {
                  "1": {
                     "density": 0.9,
                     "mean": 15,
                     "std_dev": 15
                  },
                  "2": {
                     "density": 0.7,
                     "mean": 8,
                     "std_dev": 20
                  }
               },
               "mountains": {
                  "1": {
                     "density": 0.7,
                     "mean": 8,
                     "std_dev": 20
                  },
                  "2": {
                     "density": 0.5,
                     "mean": 0,
                     "std_dev": 30
                  },
                  "3": {
                     "density": 0.3,
                     "mean": -8,
                     "std_dev": 40
                  }
               }
            }
         }
      },
      "berries": {
         "placement": {
            "function": "gaussian",
            "mean": -50,
            "std_dev": 30,
            "__comment": "offset of mean near different terrain/landscape",
            "mean_offset": {
               "tree": 100,
               "water": 0,
               "boundary": 0
            },
            "density": {
               "plains": 0.6,
               "foothills": 0.8,
               "mountains": 0
            }
         }
      },
      "scattered": {
         "plants": {
            "__comment": "for example, a small probability with a large density would be more clustered than a large probability with small density.",
            "weights": {
               "plains": {
                  "1": {
                     "stonehearth:plants:brightbell": 1,
                     "stonehearth:plants:silkweed": 1.5
                  }
               },
               "foothills": {
                  "1": {
                     "stonehearth:plants:frostsnap": 1,
                     "stonehearth:plants:brightbell": 7,
                     "stonehearth:plants:silkweed": 1
                  },
                  "2": {
                     "stonehearth:plants:frostsnap": 1,
                     "stonehearth:plants:brightbell": 1
                  }
               },
               "mountains": {
                  "1": {
                     "stonehearth:plants:frostsnap": 1
                  },
                  "3": {
                     "stonehearth:plants:frostsnap": 1
                  }
               }
            },
            "noise_map_parameters": {
               "terrain_based": {
                  "plains": {
                     "1": {
                        "probability": 0,
                        "density": 0.6
                     },
                     "2": {
                        "probability": 0.35,
                        "density": 0.8
                     }
                  },
                  "foothills": {
                     "1": {
                        "probability": 0.35,
                        "density": 0.7
                     }
                  },
                  "mountains": {
                     "1": {
                        "probability": 0.2,
                        "density": 0.7
                     }
                  }
               }
            }
         },
         "boulders": {
            "noise_map_parameters": {
               "__comment": "Same as noise map parameters of plants. this is after trees, water, berries and plants are generated",
               "terrain_based": {
                  "plains": {
                     "1": {
                        "probability": 0,
                        "density": 0.5
                     },
                     "2": {
                        "probability": 0.35,
                        "density": 0.7
                     }
                  },
                  "foothills": {
                     "1": {
                        "probability": 0.15,
                        "density": 0.8
                     }
                  },
                  "mountains": {
                     "1": {
                        "probability": 0,
                        "density": 0.8
                     }
                  }
               }
            },
            "__comments": "approximation of percentage thresholds of boulder sizes",
            "cutoffs": {
               "small": 0.2,
               "medium": 0.4
            }
         }
      },
      "water": {
         "__comment": "placement of water bodies occur at positive samples, parameters are for a standard simplex noise generator",
         "depth": {
            "shallow": 5,
            "deep": 10
         },
         "noise_map_settings": {
            "__comment": "simplex noise function",
            "persistence_ratio": 0.01,
            "bandlimit": 4,
            "octaves": 4,
            "range": 80,
            "aspect_ratio": 1.2,
            "mean": {
               "plains": -5,
               "foothills": -20,
               "mountains": -18
            }
         }
      }
   }
}


#2

hey there @Vargbane, i just edited your post to make the code into, well, code text.

though i don’t know a thing about biome code, maybe out resident modding support @Drotten could help you. alternatively @BrunoSupremo has done a lot with biome code stuff, so he might be able to help.


#3

Ugh… Biome is the most tricky thing to mod right now I think. Some weeks ago I was trying to mod a terrain, but somehow my trees ended up not appearing, or only some of them appeared even though the parameters looked fine. I don’t know if it’s due to the collision boxes or what, I was just trying to get loooots of trees and the engine decided to do the opposite.

I think what you describe could be a thing of the seed. I don’t know if there’s a way to make that volcano-like structure you mention on every single seed. :sweat:

@BrunoSupremo (from the archipelago biome mod) might know better.


#4

The seed I used (well, am still using) in my Maratas map might fit your needs:

http://discourse.stonehearth.net/t/maratas-the-city-in-the-stone-wip/21166

Generally deserts are better for lone mountains.


#5

Hi! (=

Thanks -I did not think of that option, how do I mark it as ‘code’ in the chat?

Yes! The Archipelago MOD got me inspired, I had nooo plans for a biome.
But that mod gave me the courage to check it out (=

I can imagine there is allot in the code :worried: -I don’t change much of the base code, so far I just edit the parameters :smile:


#6

Well, for this you should only add your own biome file and mixinto some things to get it to appear in the UI. No other file apart from these jsons (and a manifest) should be needed (except if you want to add your own flora and fauna).

As @Hieronymous points, maybe you could take a look at how are the parameters in the desert biome file and compare with the temperate one.

Make sure to do changes one by one to avoid breaking things and be careful with the range of some parameters. Sometimes two variables do nothing by themselves but their values combined do change the terrain. It’s difficult because there are so many x___x (but it’s needed in order to generate many different variations)…


#7

Wow! -That looks great!! Thank you :grinning:
-Thats just what I want to do, -I need a Moutain like that for my town.

I will check this out (=


#8

You can adjust the seed a bit by moving the last few digits in the seed around. If you roll a few you’ll find other similar maps, they’re rare but not that rare.


#9

Exactly! ^^
-I started to change some trees, -Only kept the Oaks and the Pine trees.
And changed parameters from high to low in crazy variations to see what changes :sunglasses:


#10

Yes, and I’m thinking, -if I find a seed I like, and save the game before i do anything.
Maybe the code for that biome is saved so I can take it (=


#11

no problemo :smile:

uh… not sure how to describe it… but if you check this guide out it shows how to do code block in markdown…


#12

Great!
I just improved my posting etiquette :relaxed:


      "mountains": {
         "step_size": 25,
         "step_count": 7
      }
 

#13

I don’t understand… The parameters you put in the biome file are fixed, they don’t change apart from you modifying it before launching the game. With the seed a randomness input is generated. It is used in conjunction with those fixed parameters to generate a random piece of terrain.

You can retrieve the seed with the console, I think. But nothing else terrain-related, I’m afraid.


#14

Yeah, I just thought it might have worked ^^
But I couldn’t find much in the .bin files…
I was hoping for a full biome to copy-paste :innocent:


#15

Better!

-I took the code from Rayyas Children Biome, and thees are the only values I changed after that;

      "mountains": {
         "step_size": 25,
         "step_count": 7
      }

Pretty decent, less amount of mountains, wrong environment however (=


#16

Wow, thanks guys for mentioning me as some kind of expert in biomes :stuck_out_tongue: I’m not, but let me try to help.

You want less, but bigger mountains, so first increase your plains:

"plains_percentage": 40,

try maybe 80 as a value. This will be all areas without elevation. Everything else will be a mountain. Then to change the mountains you already figured out how:

"mountains": {
     "step_size": 25,
     "step_count": 7
  }

step_size is always multiple of 5 (else the game crash, unless you also mod the .lua files with all the math for the terrains, then it is even possible to make smooth climbs), and it is the vertical size in blocks of each layer of a mountain.
step_count is the maximum possible steps a mountain will have. With a lot of flat/plain areas, there will be not much space for mountains and they will hardly reach the maximum size, cause they need a large base. (I can’t remember if there is a limit to this value)
With 80% plains and 7 steps, you will get mostly 4 steps tall mountains. Less plain allow more room for the mountains to grow more steps.

By the way, those are just the rock part of the mountain, not the grass one which can be tuned at the foothills code.

You can tune how many foothills you will get before reaching the rocks. I think temperate has 3 layers of foothill each with 10 block high and desert has only 2 layers with 5 blocks tall.

The desert file is closer to what you want, so it is better to mod your biome based on that file. If you want grass, just change the colors (or copy the colors from temperate)


#17

can I play your modded biome?

the mountains are great for defense, especially ones near lakes :heart_eyes:


#18

Shure! :relaxed:

I’ll make a MOD for it also, have a new one on the go to!


MOD - Anórien Biome
#19

Hi! @BrunoSupremo :smiley:

Thank you for the The Archipelago MOD! ^^

-And thank you for posting! -It cleared allot of my confusion about the code.
I don’t know anything about the.Lua files yet though. :no_mouth:

Yeah, the desert is best for the basis of the Biome I’m aiming for.
-And I got some great results! -And some crazy ones too. :sweat_smile:

Changing the colors for dirt to grass did not appear to me (=
And I want the colors for the mountains to be in a gray/white shade.
-I will dig in and start changing the colors and terrain. (It helps, because I got the terrain shape quite right)…
Trees and bushes and such were the easy bit, but the mountains!? :confused:

A snap from the last change I made yesterday: :grin:


#20

hey @Vargbane, thanks again for your biome mode.

now I can be more defensive and sell more sundials (70g each) (Settlement Decor mod) and buy more feathers and ores w/o the need of a shepherd and ruining the map.

btw, I add in some few pics and text to fill in the nulls.