Pathfinding optimizations