mwg API
    Preparing search index...

    Type Alias OverworldTerrain

    OverworldTerrain:
        | "water"
        | "plains"
        | "forest"
        | "hills"
        | "mountains"
        | "desert"
        | "swamp"

    An overworld map: a whole realm as plain tile data.

    The world-map counterpart to generateDungeon and generateCave: elevation and moisture fields from seeded value noise classify each cell into water, plains, forest, hills, mountains, desert or swamp (the seaLevel knob decides how much is sea); rivers run from high ground down to the sea or a lake, merging when they meet and never crossing a mountain ridge (a ridge stops a river as a lake instead); settlements place themselves by suitability (near water, on buildable ground, spaced apart) and join into a road network that prefers flat ground and fords a river where it must cross one; points of interest carry a leadsTo id a game feeds its Overworld locations with; and every cell carries a coarse region id so encounter tables and names can hang off a region instead of a cell.

    shape: 'hex' generates the same realm on a hex grid (odd-q offset coordinates, the Level convention): the noise is sampled where each hex is drawn so landmasses are not stretched, rivers and roads step across the six edges, spacing and "near water" count hex distance.

    Deterministic: the same seed gives the same realm on every platform, drawn from the framework Random stack. Sizes up to a few hundred tiles a side generate on load; a bigger realm is a threads.spawn task like any other long job.

    import { generateOverworld } from '@datamoc/mwg/roguelike';

    const realm = generateOverworld({ width: 96, height: 64, seed: 42 });
    console.log(realm.terrain[0]); // 'water' | 'plains' | 'forest' | ...
    console.log(realm.settlements.length); // roads join every one of them