Procedural Landmass Generator

by Christopher King

Table Of Contents

A landmass generator made using noise functions and cellular automata

I thought it would be interesting to show how Kingdom Incremental started out. This toy implementation of an island generator was actually the first thing that I made for the game long before I had the idea of what it would become. The actual system that I use in engine has changed quite a lot from this, but the core concepts are still the same.

Generator

Generated under CC-BY-NC 4.0
For commercial use: CLICK HERE

Landmass Settings
The value used in the noise functions to get deterministic numbers Seed:
Should the borders of the map be pushed down? Island Mode:
Scale of the noise. Smaller values create smaller landmass. Noise Period
The number of layers of noise used. Higher values increase detail. Noise Octave
The number of distinct layers the ground is segmented to Height Steps
Water is added to all values lower than this Water Level
Controls the thickness of sand around land. Sand Radius
Tree Settings
Do we want to generate trees at all? Generate Trees:
Should we use deterministic values? Use Noise:
Scale of the noise. Smaller values create smaller groups of trees. Tree Noise Period
Higher values increase the rarity of forests Spawn Threshold
The number of neighbors required for trees to expand or die Growth Threshold
The number of times trees attempt to grow or die Iterations:
Display Settings
Offset from the origin on the horizontal axis X Position
Offset from the origin on the vertical axis Y Position
The height / width in pixels Map Size
The number of pixels between each level Level Height
The number of pixels between the top and bottom of trees Tree Height

Explanation

The core idea behind the infinite procedural worlds in many popular games like Minecraft, Terraria, and countless others is something called "Noise". The term comes from signal processing. But in the context of procedural content generation (PCG), it is generally thought of as way to get random looking values that are deterministic. The fact that a noise function will look random, but reproduce the exact same value every time for a given input makes it perfect for PCG. Noise comes in a lot of different flavors. For PCG, you'll commonly see perlin or simplex noise. Red Blob Games created an eloquent explanation of how you can stack noise in different octaves to create realistic looking terrain. For my initial generator, I followed a very similar approach.

The trees and sand are generated with something a bit different. They get seeded using noise, but then any value below a certain threshold gets discarded. The remaining locations then get clumped together using cellular automata. The basic idea here is that every position looks at it's neighbors to determine if it should grow, die, or stay the same. The rules that dictate how a cell changes can vary wildly based on the desired outcome. You can even make an automata that resembles something alive. Here the trees are simply counting their neighbors and growing out if there are more nearby trees than the growth threshold. There is an excellent write up of how this process works on rougebasin.