Random biome generation

Hello! I am making a 2D sandbox game and I would like to implement randomly generated biomes. Think terraria or a 2D minecraft. But… I’m having trouble with it. What I’ve done is make an empty object and added a script to generate a chunk, then an empty object with a script to generate multiple chunks. But how would I do this with multiple biomes? How would I have it randomly select biome chunks to place? Also, on a less important note, how would I have plants and animals/monsters randomly spawn? Thank you if you help, I’m kind of new so I don’t know if I did something stupid and made a newbie mistake.

Unity has a Basic 2D Dungeon Generation tutorial. It generates top-down levels. If you’re making a platformer, you could combine the ideas in the tutorial with those in this Procedural Level Generation for a 2D Platformer article.

Think of each biome as a “tileset”. This way you can test each individually by giving the generator one tileset to use. Each room template in the tileset can have a number of spawnpoints where you can spawn objects appropriate to that tileset.

Once you get your basic random generation going, you can add weighted values to make smoother transitions from one biome to another. For example, if your starting point is a jungle “room”, the jungle and savannah biomes might be weighted higher than desert or arctic, since it’s more likely that a jungle will be adjacent to a savannah than an arctic tundra.

You can also generated a noise dedicated to biomes selection, for example if above 0.5 it’s savannah, else it’s water.

The way it used to be done by minecraft is that it has multiple biomes noise as parameter (like humidity and temperature) then use a look up to select a biomes (inspired by the whittaker diagram)?

You can have has many entry parameter you want, like wilderness that define how dangerous a place is (how many monster), or even mood or gameplay intention. I would advise you to have a hierarchy of selector, for example an overall noise decide main biomes, another geographical features, then inside the region you use another selector to create sub biomes.

If you use coherent noise like perlin, the design of the selection diagram will ensure you have the right biomes next to valid neighbor. For example becaue it’s a gradient, if you use temperature as a selector, you won’t have a desert right next to snowy region without having temperate region inbetween.

Don’t forget you can modulate selector between them, for example let say you use a global noise feature to select land vs ocean (geographical features), you can use the land altitude to modify the temperature noise (the higher the less hot) before generating environment biomes, etc …

3 Likes

Ok… that makes a ton of sense. There… is one problem though… I’m not really sure how to do that.

Consider starting with the 2D Dungeon Generation tutorial (linked in my first post). It has step-by-step instructions, and you’ll be able to build biome selection on top of that.

1 Like