Instead of individual levels, you can generate entire worlds procedurally.
In this series, you’ll learn to create a shader-based world map with rivers and biomes. We will use GDScript to generate base data on the CPU and pass it to a shader to render the map using the graphics card.
A popular approach is to use Perlin noise or its newer and better alternative, simplex noise. Godot has built-in support for Open Simplex Noise. We’ll see how to use it in a complex procedural map generator.
Our algorithm works like so:
And here is the biomes legend we use to assign values to our landmasses:
It’s worth mentioning that this algorithm outputs more than images. You can use this approach to create playable worlds or levels, place cities and towns near rivers, add resources, and much more. You can build unlimited amounts of variations on top of this work to make it your own.
You are going to learn:
OpenSimplexNoise
and the associated NoiseTexture
You can find the final source code for this chapter in the WorldMap
directory of the Godot project.
We took inspiration from the tutorial Procedurally Generating Wrapping World Maps in Unity C# to create this series.