threejs-worldgen
    Preparing search index...

    Class Population

    A live population over a world: settings in, PopulationData and a Network out, regenerated (synchronously, deterministically) whenever the settings or the world change.

    const population = new Population(world, { seed: 'valley', totalPopulation: 800_000 })
    population.data.settlements[0] // the largest place: { class: 'city', position: [x, z], … }
    population.network.edges // roads, rail and power lines as [x, z] polylines
    population.set({ zipf: 1.2 }) // live update; listeners (e.g. the overlay) rebuild
    Index

    Cells, settlements and land use.

    network: Network

    Roads, railways and power lines.

    Resolved settings. Change them with Population.set / Population.reset.

    version: number = 0

    Bumped on every regeneration.

    world: World

    The world people live on.

    • Regenerates whenever the world changes (on from construction). Returns a function that stops it; calling follow again resumes.

      Returns () => void

    • Calls listener after every regeneration. Returns an unsubscribe function.

      Parameters

      Returns () => void