Palim
feature · liveAlpha v0.1.19

Rain, rivers and lakes

Rain soaks in, runs downhill along a drainage network read off the terrain, fills hollows into lakes that spill when full, runs as streams, and cuts into soft ground.

The simulation loads in your browser (about 2 MB) and founds a valley of 128 paces. JavaScript is required.

The sky is three independent things: the season, a smooth swing in temperature and rain through the 360-day year; the year, slow noise so that runs of wet years and dry ones happen at a length people notice; and the day, the roll of showers, gales, frost and the storms that deliver a season’s rain in two days. Rain does not evaporate into a statistic.

hydrology.rs rests on one precomputation, a priority flood over the surface from the coast and the river inwards, which yields in one pass the column every column drains into (with depressions already resolved, so nothing traps water and nothing loops), the level water must reach in a hollow before it escapes, and an order in which every column comes after the one it drains into. Seeded sub-cell relief breaks ties across terraces so tributaries bend and merge instead of running in parallel lines.

A step is then linear in the number of columns: soak the rain into the soil store, run what will not soak in downhill, pour what reaches a hollow into that basin, let a full basin spill into the next one down, take evaporation off the top, and bring the water voxels into line. Lakes appear where the ground was always going to hold water and the weather finally provided some; they go down in a drought and come back in a wet decade. Where the discharge is high enough the water runs as a stream in a recessed bed; accumulated stream power cuts unclaimed soil and, much more slowly, rock, and the spoil settles as silt where the flow slows. Nearly full lakes seep through their outlet and can wear down the rock lip, changing their downstream route.

The step runs monthly, plus once more when a storm breaks. It never touches built fabric, a made surface or anybody’s plot, and it only removes water it put there itself: the sea and the river are terrain.

What to look for. In the F5 tab of the play page (the sky), the year’s rain, the lakes and the flood plain. On this page, the water lens after a storm, and the fertility lens a few years later: the engine’s fertility model reads streams and saturation as well as snow.


In the code: crates/sim/src/climate.rs crates/sim/src/hydrology.rs · playground: land

← The valley and its recipes Floods, and what the town does about them →