Skip to content

Claude/fix unit pathfinding o1r kt#1065

Merged
braedonsaunders merged 3 commits into
mainfrom
claude/fix-unit-pathfinding-O1rKT
Jan 27, 2026
Merged

Claude/fix unit pathfinding o1r kt#1065
braedonsaunders merged 3 commits into
mainfrom
claude/fix-unit-pathfinding-O1rKT

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

No description provided.

Clean up comments to remove game-specific references.
The movement architecture is inspired by RTS conventions but
doesn't need to call out specific games.

https://claude.ai/code/session_01WMrGYxn1NPTPcGn9XCykRh
1. Building/gathering worker path failures:
   - Added calculateInteractionPoint() to find valid navmesh points
     on building perimeters instead of blocked centers
   - clearUnitMovementTarget() now reroutes workers to interaction
     points instead of cancelling assignments
   - Workers path to walkable perimeter positions, not obstacle centers

2. Water navmesh support in worker:
   - Added loadWaterNavMesh() for naval unit pathfinding
   - Added findWaterPath() for water-based path queries
   - Added isWaterWalkable() for water navmesh point validation
   - Naval pathfinding no longer falls back to main thread

3. TileCache limitation documented:
   - Explained why pre-exported navmesh doesn't support dynamic obstacles
   - Recommended loadNavMeshFromGeometry() for games with buildings

https://claude.ai/code/session_01WMrGYxn1NPTPcGn9XCykRh
Cylinder obstacles are 5-10x faster for TileCache updates compared
to box obstacles. Box obstacles require full tile rebuild from input
geometry, while cylinders use an optimized path.

Trade-off: Cylinders approximate rectangular buildings using the max
dimension, so there's slightly more blocked area around buildings.
This is acceptable since:
1. Building placement is infrequent (every 10-30 seconds)
2. The performance gain is significant
3. Units already maintain clearance via walkableRadius

Changes:
- PathfindingSystem: Use addObstacle() instead of addBoxObstacle()
- pathfinding.worker.ts: Use cylinder directly, remove box fallback

https://claude.ai/code/session_01WMrGYxn1NPTPcGn9XCykRh
@braedonsaunders braedonsaunders merged commit 3369457 into main Jan 27, 2026
2 of 4 checks passed
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.

2 participants