Status: done (2026-10-30)
Priority: 3
Size: S
Arch: tooling
Phase: implement
Design ref: World and scale (Terrain; Uses of regions); Systems overview (Work: walking ignores terrain: mountains cost the same as meadow).
Goal: Routes in src/sim/agents.js are breadth-first searches over passable tiles, so a pawn crosses a hill or a mountain as fast as a meadow and takes no detour round it. Give terrain a cost, in the route search and in walking speed.
Acceptance criteria:
TERRAIN table in src/sim/rules.js.QUESTIONS.md; it now stands under VB-096. HPA* over regions is VB-097.src/sim/agents.js into a new module src/sim/routes.js (tileCost, passable, stepCost, findRoute, route, costChanged, refreshRoutes); VB['sim/agents'].route still names it. A step between two tiles costs the mean of their costs, so a route costs the same both ways and the cache answers the way back with the way there, reversed. One A* search up to ROUTE.reach (200 meadow steps) replaces the two breadth-first searches of 60 and 200 steps; beyond it a pawn still walks straight and routeFallbacks counts it. Houses and fields cost 1 whatever the biome under them; the two ends of a route may be closed tiles.clearTile (felling a wood to nothing, clearing a plot) marks the tile in st.routeDirty; at the end of the day refreshRoutes drops each cached route that the tile could change: those for which steps from the start to the tile plus steps from the tile to the end, times the cheapest step, are within the route’s cost.tests/perf.js): 129.6 to 88.1 ms a game day; the search no longer shows in the profile. Cached routes after a year: 3,697 to 2,991.founders and heirs entry at seeds 7 and 42 from year 1 on; the seed entries only by the new routeDirty key. world, calibrate and apiKeys are unchanged.