Skip to content

World Generation

Kinsward generates worlds procedurally using noise-based terrain and a 16-step climate simulation pipeline. Each world is unique based on its seed.

Set a world seed for reproducible generation:

Terminal window
./kinsward --seed 42
# or
WORLD_SEED=42 ./kinsward

If no seed is provided, one is generated randomly.

The base terrain uses Fractal Brownian Motion (FBM) Perlin noise:

Noise LayerOctavesScaleDetermines
Elevation60.008Terrain shape, z-level
Moisture40.012Biome type (grass/mud/sand)
Temperature10.006Climate (snow/ice)
Cave30.05Underground caverns
Elevation ValueZ-LevelTerrain
< ~0.12-2Deep water
< 0.35-1Shallow water
< 0.550Plains
< 0.701Hills
< 0.852Mountains
>= 0.853Peaks

Water z-levels use a continuous formula for smooth depth transitions. Shore zones (elevation 0.35–0.40) generate Sand or Ice blocks at z=0.

Generation depth: 5 blocks below and 4 above the active z-level. Stairs are auto-placed at elevation transitions.

The region map uses a 16-step simulation that runs on a 1024x1024 grid (each cell = 16x16 tiles):

Voronoi tectonic plates with boundary uplift and detail noise. Determines the base continental structure.

Thermal erosion and smoothing passes to create natural-looking terrain.

Ocean, coast, and land classification via BFS. Computes ocean_distance for each cell.

Derived from latitude, lapse rate (elevation cooling), and ocean proximity (maritime moderation).

Hadley cell circulation + thermal pressure + barometric effects + noise + pressure centers.

Pressure gradient force + Coriolis effect + terrain deflection + surface drag.

Evaporation from oceans + advection by wind + orographic lift + rain shadow effects.

Rock type assignment from tectonic context. Eight rock types: Granite, Basalt, Sandstone, Limestone, Marble, Slate, Gneiss, Quartzite.

Priority-flood algorithm to remove micro-sinks and ensure water can drain.

Computed from elevation gradients, slope, and rock permeability.

Flow accumulation with lake filling to trace initial river paths.

River valley carving modulated by rock hardness. Harder rocks resist erosion.

Recomputed on the eroded terrain for accurate river placement.

Assigned from temperature x rainfall x elevation x drainage. 22 biome types (see below).

Soil fertility derived from rainfall + temperature + drainage + elevation + river proximity.

Plant density from biome type + rainfall + temperature + noise variation.

The world features 22 biome types:

BiomeDescription
OceanOpen water
Deep OceanFar from shore
BeachCoastal sand
GlacierPermanent ice
TundraFrozen plains
TaigaBoreal conifer
Boreal ForestCold dense forest
Temperate GrasslandModerate plains
Temperate ForestDeciduous woodland
Temperate RainforestWet temperate forest
SteppeDry grassland
ShrublandSparse bushes
SavannaTropical grassland
Tropical ForestWarm woodland
Tropical RainforestDense tropical jungle
DesertArid wasteland
WetlandSwamp/marsh
FloodplainRiver-adjacent flat
Montane ForestMountain woodland
AlpineHigh-altitude meadow
Snow PeakMountain summit
LakeInland water body

The worldgen binary generates worlds without launching the game:

Terminal window
# Generate with a specific seed
worldgen --seed 42
# Export region map layers as PNG
worldgen --seed 42 --layers elevation --format png --out elevation.png
# Export as ASCII
worldgen --layers rivers --format ascii
# JSON output
worldgen --seed 42 --json

Available layers for export: elevation, temperature, rainfall, wind, drainage, rivers, geology, fertility, vegetation, plates, biome.

You can also export region maps from a running game using kinswardctl region-map.