Skip to content

Bridges and connectors

import { Aside } from ‘@astrojs/starlight/components’;

A river splits your board into two halves and you want the procedural generator to lay down two or three bridges at sensible spans (not too close, not over impassable terrain) every time the same seed runs.

import { createSeededGameboardPlan } from 'declarative-hex-worlds/rules';
const plan = createSeededGameboardPlan({
seed: 'forest-with-river-3',
shape: { kind: 'rectangle', width: 12, height: 8 },
generators: [
{ kind: 'river', source: { q: 0, r: 3 }, sink: { q: 11, r: 5 } },
{ kind: 'bridges', maxBridges: 3, minSpacing: 3 },
],
});
// Same seed → same river path → same bridges. Always.
  • River pathing. A* between source + sink with terrain-cost weighting.
  • Bridge placement. Seed-aware sampler picks span sites that satisfy minSpacing and don’t cross unrenderable terrain.
  • Determinism contract. See the determinism guide.