Skip to content

feat(nav): renderoni/nav — tiled grid A*, expedition router, spatial hash - #41

Open
cmaycumber wants to merge 1 commit into
elemarin:mainfrom
cmaycumber:feat/nav
Open

cmaycumber wants to merge 1 commit into
elemarin:mainfrom
cmaycumber:feat/nav

Conversation

@cmaycumber

Copy link
Copy Markdown

A new renderoni/nav entry point: grid pathfinding for large worlds, extracted from a shipping game.

  • NavGrid: generic over a NavCostField the game supplies (size, cellCost(x, z), optional coarseWalkable/passable for far-away queries that must not build tiles).
    • Tiles are sampled lazily and LRU-evicted, with pooled arrays.
    • Blockers (buildings) are re-applied when a tile rebuilds.
    • A* runs in a bounded window with generation-stamped scratch and a typed-array heap, so there's no per-search allocation.
    • It also offers nearestWalkable, lineClear, segmentWalkable and prewarm.
    • Cell size, tile size, tile cap, window, node budget, easy cost and blocker slack are all options.
  • ExpeditionRouter: joins complete local paths into long corridors across the map against a small RouterNav interface, with a ticketed request API.
  • SpatialHash<T>: a neighbour-query grid over anything with position: { x, z }.

The game now supplies only its cost rules (water, cliffs, slope, roads) and uses these classes directly. Its 496-test suite passes on them, including long-range navigation tests.

Verification: typecheck, build, 246/246 tests.

🤖 Generated with Claude Code

…atial hash

NavGrid is generic over a NavCostField the game supplies (size, cellCost,
optional coarseWalkable/passable). Tiles are sampled lazily and LRU-evicted
(evicted arrays are pooled), blockers are re-applied on rebuild, and A* runs
in a bounded window with generation-stamped scratch and a typed-array heap.
Cell size, tile size, tile cap, window, budget, easy-cost and blocker slack
are options; defaults reproduce the Sunder March grid exactly.

ExpeditionRouter joins complete local paths into long corridors against a
small RouterNav interface. SpatialHash<T> works over anything with a
position {x, z}.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant