Files
2026-05-27 23:29:53 +01:00

2.2 KiB

OpenSpec Change: enterprise-gaming-r3f-pathfinding

  • Change ID: enterprise-gaming-r3f-pathfinding
  • Package: @suaveplan/r3f-pathfinding
  • Category: gaming/gameplay
  • Target path: gaming/gameplay/r3f-pathfinding
  • Status: PROPOSED
  • Date: 2026-04-24

Summary

Deliver @suaveplan/r3f-pathfinding on the genesis branch from scratch at enterprise quality. The package provides NavMesh pathfinding and crowd simulation for React Three Fiber: NavMeshProvider that bakes a walkable NavMesh from scene geometry, A* pathfinding with funnel-algorithm string-pull, SteeringAgent applying seek/flee/arrive/separation/cohesion behaviours, a Crowd component managing N agents with local avoidance (ORCA), and NavMeshDebug wireframe overlay. usePathfinding() exposes findPath, addAgent, removeAgent. Genesis adds 100% coverage and Storybook stories.


Available workspace deps

@suaveplan/spatial-hash, @suaveplan/error, @suaveplan/types, @suaveplan/events, react, @react-three/fiber, @react-three/drei, three.


Public API surface

function NavMeshProvider(props: NavMeshProviderProps): JSX.Element
// geometry, cellSize, cellHeight, agentRadius, agentHeight

function NavMeshDebug(props: NavMeshDebugProps): JSX.Element
// visible, color, opacity

function SteeringAgent(props: SteeringAgentProps): JSX.Element
// agentId, target, maxSpeed, behaviours

function Crowd(props: CrowdProps): JSX.Element
// agents, maxAgents, timeStep

function usePathfinding(): PathfindingContext
// findPath(from, to), addAgent(config), removeAgent(id), navMesh

File layout

gaming/gameplay/r3f-pathfinding/
  package.json / tsconfig.json / vitest.config.ts
  src/
    index.ts / error-codes.ts
    types/common.ts + md
    nav/ (navmesh-builder.ts + md + test, astar.ts + md + test, funnel.ts + md + test)
    steering/ (behaviours.ts + md + test, orca.ts + md + test)
    context/pathfinding-provider.tsx + md + test
    hooks/use-pathfinding.ts + md + test
    components/
      NavMeshDebug/ (tsx + md + test + stories + index)
      SteeringAgent/ (tsx + md + test + stories + index)
      Crowd/ (tsx + md + test + stories + index)
  tests/integration.test.ts