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?
Status | Released |
Authors | Good Faith Company, VioletJoy, UnmakerOfThoughts, John Ivess, Senia Icethief |
Genre | Adventure, Action, Role Playing |
Tags | Dungeon Crawler, Fantasy, Isometric, Medieval, Perma Death, Real time strategy, Roguelike, Singleplayer |
More posts
- Devlog: Implementing a Status Effects system - Ivan Shyika53 days ago
- Devlog: Refactoring Items and TraderActor - Ivan Shyika60 days ago
- Devlog: Technical design of the Inventory System - Ivan Shyika68 days ago
- Devlog: Overhauling Squad Movement and Formations - Keegen Love76 days ago
- Devlog: Hero Classes and Special Abilities - Ivan Shyika76 days ago
- DevLog: Implementing Death (Animations) - Violet Weathersby76 days ago
- Devlog: Preserving squad data across levels - Ivan Shyika82 days ago
- DevLog: Squad Selection Crashes - Violet Weathersby82 days ago
- Devlog: Fixing Squad AI Freezing in Combat: A Deep Dive into Task Instancing and...82 days ago
- DevLog: Camera Issues - Adam Denomme82 days ago
Leave a comment
Log in with itch.io to leave a comment.