threejs-worldgen
    Preparing search index...

    Function generateNetworks

    • Builds road, rail and power networks between settlements. Pure and deterministic.

      • Backbone: a minimum spanning tree over all non-farmstead settlements (every one is reachable by road), plus extra links picked by a gravity model (P₁·P₂ / dᵏ) where the tree forces a detour.
      • Routing: each link is an A* path over the fine hex grid, costed by slope² and water crossings, with a discount on cells earlier routes use, so roads merge into trunks. Highways route first.
      • Types: a link is a highway / road / track by the smaller population at its ends. Railways repeat the plan over settlements above railPopulation with a much stronger slope cost. Power lines are straight spans along a spanning tree of settlements above powerlinePopulation.

      Parameters

      Returns Network