GeoGen Script reference
Example: Marshlands

This script creates wide river valley with a bottom covered almost entirely by a vast marshland.


The map is infinite in the horizontal direction and finite in the vertical direction.

Height: Finite,
Width: Infinite,
Name: "Marshlands",
Description: "River flowing through a massive marshland with small lagoons and countless cutoffs.",
Author: "Matěj Zábský"

First step is to build the valley banks. The banks are built using a combination of HeightMap.Projection and HeightMap.Shift. Each of the banks is created separately, so each bank has a different curve, giving the map a more natural look.

var bankShiftNoiseLayers = CreateNoiseLayers(512);
var topBankProfile = HeightProfile.FromArray({
@0.05: 1,
@0.15: -1
var topBank = HeightMap.Projection(topBankProfile, Direction.Horizontal)
.Shift(HeightProfile.Noise(bankShiftNoiseLayers, 1), @0.15, Direction.Vertical);
var bottomBankProfile = HeightProfile.FromArray({
@0.85: -1,
@0.95: 1
var bottomBank = HeightMap.Projection(bottomBankProfile, Direction.Horizontal)
.Shift(HeightProfile.Noise(bankShiftNoiseLayers, 2), @0.15, Direction.Vertical);
var banks = topBank

Second step is to build the riverbed, once again a shifted projection (and once again with a different curve).

var profile = HeightProfile.FromArray({
@0.95: 0.001,
@0.515: 0,
@0.5: -0.6,
@0.485: 0,
@0.05: 0.001
var main =
.Shift(HeightProfile.Noise({350: 1}, 3), @0.1, Direction.Vertical)

Then the canal structure of the valley floor is created. "Ridged" noise is created by applying HeightMap.Abs on HeightMap.Noise.


Two layers of this ridged noise are combined together to make the canal pattern even more chaotic and dense.

var noise1 = HeightMap.Noise(CreateNoiseLayers(64), 4).Abs();
var noise2 = HeightMap.Noise(CreateNoiseLayers(64), 5).Abs();
var canalNoise = noise1

All of the layers built above are then combined together.

main.Add(HeightMap.Noise().Multiply(0.5).Add(0.25), banks);
yield main;

Full code