Climate Simulation for Procedural World Generation
🌍

Climate Simulation for Procedural World Generation

After using an ‘ooze-based’ method to procedurally generate biomes, I wanted to experiment with techniques that more scientifically accurate when compared to the climate of the real world.

This method utilises a simulation of precipitation and temperature across the entire world. The precipitation and temperature value of each cell can then be used to determine the biome at any position in the world. This results in a realistic feeling climate simulation with biomes always having similar biomes as their neighbours.

Landmass Generation

The first step of the methodology was to generate a noise map that can be used to determine the height the world’s landmass. Perlin noise is this standard for this task and therefore I also used Perlin noise to generate a noise map.

In order to ensure ocean borders the entire world, a fall off map was utilised. The reason it is important for ocean to border the entire map is due to how it makes it so much easier to tile the world on itself in order to create the illusion of a spherical world for the player.

image
A rendered noise map after being combined with the fall off map.

Climate Simulation

The methodology for simulating temperature and precipitation is generally the same. Perlin noise was again used to generate a pseudo-random range of values across the map. The values of each Perlin noise map was changed to provide different results for the rainfall and temperature of the planet. Again a fall off map was used to provide further control to each of the two climate maps, however, instead of applying a fall off map to all the borders of the noise map a different approach was used. This approach was aimed at accurately simulating temperature and rainfall across and planet. To do this, a curve was used to ensure the climate was hotter and drier closer the vertical centre of the world (similar to how it is hottest near the equator on earth). Lastly, each of the climate simulation maps were compared with landmass map. The purpose of this was to create an effect where it is colder at higher altitudes as well as there being less rainfall (again similar to the real world’s climate).

image
A rendered temperature (left) and precipitation (right) map. Red represents areas with less rainfall / higher temperature and blue represents colder or wetter areas.

Biome Generation

The next step in my mythology is biome generation. All three of the previously generated biome maps are used to determine the biome of all of the cells in the world. Firstly, any cell with a low enough altitude becomes and ocean biome and any cell with a high enough altitude becomes a mountain biome. However, for the majority of cells (which sit between these two thresholds) a look up table is used to determine the biome using the cell’s temperature and amount of rainfall.

image
image
The look up table used to determine the biome of each cell (Left) and a key of each of the biomes in the game (right). The horizontal axis of the lookup table represents the temperature and the vertical axis represents the rainfall.

The result of this method can be seen below. The generated biome map closely resembles a realistic climate that has a frozen north and south as well as hotter regions closer to the equator.

image

River Generation and Flow Simulation

The next step was to simulate rivers that start in the mountains and flow down until they meet the ocean or another body of water. The algorithm for this is very simple but effective. Firstly, a Possium Disc Sampling algorithm is used to generate a random grid of points across the world. Once these points have been generated, the altitude of each point is taken into consideration. If the altitude of any point is above a threshold, there is a chance it will become a river source. Once all of the river sources have been determined, a simple flow simulation is used to generate the path of each river. For each river, the neighbouring cell with the lowest alitude will be the direction the river flows in. This is done for each river until they all connect to either the ocean, a lake or another river.

image
A rendered map of a procedurally generated world, with rivers represented by a bright blue cell.