Monday, 26 May 2014

Building Biomes

To add depth to the world generation I've added in a method of generating biomes onto the landscape.  There's quite a lot of biome types and classifications that you can ready about but I found the simpler, kid friendly websites the most helpful as they distil the variations down.  In particular I used blueplanetbiomes.org.

My biomes are a combination of temperature, rainfall and elevation and it was simply a matter of generating each of those layers and then combining them to define the biome.  I broke each layer into three too, for example temperature changes linearly from 1f to 0f from the equator, and I set the value to be hot, warm or cold depending on the range, e.g. hot > 0.8f.
Temperature (hot, warm, cold) from equator.
(left) without & (right) with simplex noise.
Rainfall and elevation use the same 3d noise function as the land/water generation.  I could have used the land values I already had but it would mean mountains would predominantly lie at the center of the land masses and I thought that was a little dull.

Rainfall and elevation.
Both with a low noise scale.
I had these all set up in a neat XNA project so I could interactively tweak all the values, varying the noise scale and the different ranges.  I didn't want to have dozens of different biomes, which would mean dozens of unique textures to be done, instead I broke it down to a handful that would give a nice variation for exploring.

Low elevation...
Hot Warm Cold
Wet rainforest deciduous taiga
Moist savannah grassland tundra
Dry desert grassland polar

Medium elevation...
Hot Warm Cold
Wet rainforest deciduous taiga
Moist savannah deciduous taiga
Dry savannah grassland tundra

High elevation is always alpine. Not sure if/how I'll represent hills, I might just ignore that element and treat the world as flat or mountainous.  Using elevation as three layers though stops mountains from appearing in the middle of deserts and adds to the randomness nicely.

Combining the layers results in a
single biome for each cell.

A feature I want is reproducibility, so if you have a map that you think is particularly fun to play on you should be able to save and share a small set of seed values in order to perfectly regenerate it.  I did have a different method of generating the temperature using a sum of sine waves with some random frequencies, but it wasn't reproducable.  Thankfully with the noise functions, you really only need to remember the seed values and a few other numbers for each layer and the result is deterministic.  I would be cool if I could compress those down into a neat little hashtag style string but I'll worry about that later.

Higher noise scale for better biome distribution.
Oceans break it up further.