Biome Generation - Voronoi Noise


So, it's time to talk biome generation.

In a procedurally generated world, there's plenty of different ways to pick out which biomes should appear where, but in a world of individual hexes things are just a touch more complicated.

You could have each hex roll the dice and pick a random biome, but then every other hex would be a completely different biome and none of them would be grouped together.

You could tie biome to certain world coordinates, but then the same biomes would always be in the same place (and you could still end up with random biomes every other hex, depending on how it's handled).

You could have each hex influence the hexes around themselves, but how do you control which direction takes priority? If you don't control that then biomes in an area would change depending on the direction you travelled in.

So what's a good way to have procedurally generated biomes that can be consistent in one run, but different on a new run?
I ended up going with a Voronoi Diagram map.

What's a Voronoi Diagram?
Well:
-Take a square, for example, and choose a number of random points on that square. These are 'seed points'
-For every other point on the squares surface, decide which 'seed point' it is closest to. These are part of the 'Voronoi cell' of that 'seed point' 
-Colour code each cell so that you can easily tell them apart
Voronoi diagram under Euclidean distance

Now you have a Voronoi Diagram.

This produces a random, but rather natural looking pattern.
It can be used to produce interesting textures, even resembling things we might be familiar with, such as

The spots of a giraffe:

"Close Up Of A Giraffe's Spots" by Stocksy Contributor "Jen Grantham ...


or cobblestone paths:

Stunning DIY Cobblestone Paving with Pavermaker Mould


It can even be used in 3D, to quickly generate random and procedural destruction and fracture of materials:

New in Release 19 - the extended Voronoi break object


In the case of this game, we want the diagram to be used to decide where different biomes are in the world generation.

So, how would we achieve that?
Simple enough, we take a square we choose a number of random points on that square, organise everything into Voronoi cells, and then colour code them according to the relevant biome.


Looking at the above biome maps, you might even be able to guess which biomes are represented by which colours.

From there, each biome can be tweaked to have a certain chance of being included in a given biome map, and a certain amount of 'size' to be taken up.

For example, you might notice that pink only shows up in two of those maps, and only takes up a small amount of space.
Meanwhile, light green shows up in all of them, and can clump into large patches, like in the middle of the centre square.

The game then takes these maps and compares the world coordinates of a hex to the pixels on the maps. Each hex is a part of whichever biome it falls under on the map.

Using this, it's possible to control how common, or rare, a certain biome is as well as how big it is compared to other biomes.

And that's how biome generation works here.
Hope that was fun, and that you learned something new and interesting!

until next time!

Get What, Once, was Here?

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.