Skip to content

feat(677): autonomous agent movement via spatial bundle nav graph - #10

Open
v1hns wants to merge 2 commits into
mainfrom
677-autonomous-agents
Open

feat(677): autonomous agent movement via spatial bundle nav graph#10
v1hns wants to merge 2 commits into
mainfrom
677-autonomous-agents

Conversation

@v1hns

@v1hns v1hns commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds GET /api/models/{unit_id}/spatial_bundle endpoint exposing rooms, nav_edges, zone_tags, and world-space centers
  • Replaces the fixed-loop agent animation with genuine BFS pathfinding over the nav graph
  • Each agent picks its next destination by role: nurses patrol patient-care/nursing-hub rooms, instructor visits consultation rooms, emergency responder targets CRITICAL finding rooms first, supply staff cycles utility↔patient-care
  • Emergency responder reactively re-targets as new CRITICAL findings arrive via the findings API (no reload needed)
  • Agents smoothly lerp between room centers using dt-based speed in world-units/sec; new BFS path computed on every arrival

Test plan

  • Load landing page — 5 agent dots appear and move through rooms
  • Trigger a scan — after findings load, responder dot should converge on CRITICAL rooms
  • Agents should never get stuck (BFS returns fallback [start] if unreachable)
  • Backend /api/models/unit_1/spatial_bundle returns 10 rooms + 9 nav_edges

🤖 Generated with Claude Code

v1hns and others added 2 commits April 10, 2026 23:29
Replace fixed-loop animation with genuine graph-based pathfinding:
- GET /api/models/{unit_id}/spatial_bundle exposes rooms + nav_edges
- buildNavGraph() constructs adjacency list from bundle edges
- bfsPath() finds shortest-hop route between any two rooms
- tickAgent() advances each agent along their BFS path with smooth
  lerp between room centers, dt-based speed in world-units/sec
- pickNextTarget() selects next destination by role:
    nurse           → patient_care + nursing_hub rooms
    instructor      → consultation + patient_care rooms
    emergency_resp  → CRITICAL finding rooms first, else patient_care
    supply_staff    → utility + patient_care rooms
- criticalRoomsRef updated from findings API so responder reactively
  re-targets live CRITICAL findings without a page reload
- Agents recompute a new BFS path each time they arrive, so movement
  continuously adapts to findings state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- AGENT_EYE_HEIGHT=1.65 — agents float at shoulder height, not floor
- jittered() adds ±0.18 lateral noise to each waypoint so paths don't
  snap to the exact room-center grid lines
- buildCurve() wraps BFS waypoints in a THREE.CatmullRomCurve3 so
  movement follows a smooth arc, not visible straight-line hops
- tickAgent() advances a single t along the curve (arc-length normalised),
  samples getPoint(t), and adds a per-agent sinusoidal bob (±0.06m, 1.8 rad/s)
  so agents visibly drift in 3D rather than skating on the floor
- Bob phases are spread evenly across agents so they don't pulse in sync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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