DevLog: Fixing Invalid Click Locations in Pathfinding - Keegen Love
This week, I ran into a frustrating issue with handling invalid click locations in our game. The core problem was that the NavMesh system was struggling to properly handle pathfinding requests to locations that weren't valid—like when a player clicked somewhere offscreen, inside an impassable object, or outside the playable area. The result? The game would ignore the player’s command without providing any feedback, which made the gameplay feel unintuitive. Players got frustrated when their units failed to respond to valid commands simply because of slight miscalculations in pathfinding, such as clipping through terrain or models that shouldn't be passed through. While the issue didn’t cause any major delays, it did push our system release closer to the deadline, as I had to prioritize addressing this problem.
The root cause of the issue was how the our system handled path projection. Even a small vertical shift in the click location—something that happens more often than you’d expect—could cause the pathfinding algorithm to fail. It would try to draw a straight line from the player's location to the clicked point, and if there was even a slight clip with the ground or objects, the path was deemed invalid. This caused units to fail to respond, even when the destination was perfectly navigable.
To fix this, I adjusted the pathfinding algorithm to account for these situations, depending instead on looser queries to NavMesh. Instead of just projecting a straight line, the system now checks for more nuanced path validity. It considers the surrounding terrain and obstacles, ensuring that small vertical shifts or obstructions don’t result in an invalid response. This change has made the game feel a lot more responsive and intuitive. Invalid selections are now properly culled, so players won’t end up clicking offscreen or into walls with no feedback.
Get Return to Divinity
Return to Divinity
Strategic combat, tactical formations, and perilous dungeon runs—can you survive the depths?
More posts
- Devlog: Overhauling Squad Movement and Formations - Keegen Love9 hours ago
- Devlog: Hero Classes and Special Abilities - Ivan Shyika18 hours ago
- DevLog: Implementing Death (Animations) - Violet Weathersby19 hours ago
- Devlog: Preserving squad data across levels - Ivan Shyika6 days ago
- DevLog: Squad Selection Crashes - Violet Weathersby6 days ago
- Devlog: Fixing Squad AI Freezing in Combat: A Deep Dive into Task Instancing and...6 days ago
- DevLog: Camera Issues - Adam Denomme6 days ago
- Devlog: Designing interaction between player and autonomous AI - Ivan Shyika13 days ago
- DevLog: Creating the Player HUD - Violet Weathersby13 days ago
Leave a comment
Log in with itch.io to leave a comment.