Pathfinding
a year ago
- #pathfinding
- #game-development
- #A*-algorithm
- The author worked on pathfinding for NPCs in their game, focusing on dynamic environments, natural paths, and wrapping around borders.
- Used A* search algorithm with space-partitioned queries to efficiently check blocked nodes in a dynamic environment.
- Implemented a caching system for node blockage status, invalidating the cache every 500ms to keep up with real-time changes.
- Added a proximity rating to nodes to prefer paths that maintain distance from objects, with an exponential effect to avoid close proximity.
- Enabled path wrapping around game borders by adding off-screen nodes and using the closest NPC position for path following.
- Optimized performance by splitting pathfinding processing over multiple game ticks to avoid perceptible delays.
- Developed the solution independently, focusing on problem-solving and achieving performant, natural-looking paths.