Bridges: let cats and roads cross rivers #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Rivers are hard blockers in the walk grid (
lib/game/pathfinding.ts: water is impassable), so cats path around them and roads cannot cross. On seeds where a river separates the village from good hunting/quarry grounds, routes get long and the leader's economics degrade.docs/ROADMAP.mdlists bridges as an open item.Design direction (implementer owns details)
buildings.type: 'bridge'), commissioned by the leader when route analysis shows a high-value crossing — e.g. when the wear-weighted detour around a river segment exceeds a threshold versus the straight corridor (the road director inlib/game/roads.tsalready computes cumulative-wear corridors; a bridge is conceptually "a road tile that beats water").buildjob, real material cost (materials + refined feels right for era-gating — refined comes from workshops), scaffold + progress rendering.ROAD_COST) — one clean hook in the WalkGrid cost/blocked functions. The per-cat route cache (server/game.ts) must be invalidated when a bridge completes (same two-layer pattern as fence changes: cache clear on completion + per-edge revalidation already exists — verify it covers "tile became walkable", not just "tile became blocked", since revalidation only rejects newly-blocked edges; a new bridge should also trigger re-planning to use it).lib/game/terrainGen.tsmonotonic-descent rivers) so single-tile spans are the common case; multi-tile spans can be explicitly out of scope for v1.public/Kenney Game Assets All-in-1 3.5.0/, gitignored; copy what's needed intopublic/images/iso/). Add a fitting case to/dev/fit.Tests (per the CLAUDE.md contract — deterministic, seeded)
findPathprefers the crossing when cheaper; incomplete bridge still blocks; route cache re-plans after completion (regression test mirroring the fence-invalidation test intests/integration/serverVillageArea.test.ts).Acceptance criteria
workerTick's phase order. Full suite + typecheck green.