bugfix(pathfinder): Accurate movement destinations when unobstructed#2296
bugfix(pathfinder): Accurate movement destinations when unobstructed#2296stephanmeesters wants to merge 2 commits intoTheSuperHackers:mainfrom
Conversation
|
This looks related: #1998 |
|
When running a debug build, use You need to make sure a unit is not considered to be taking up more pathfinding cells than it originally would, otherwise it will throw off pathing around that unit if you attempt to accurately place a unit where the mouse clicked compared to how the pathfinding grid is laid out. This "issue" is likely something we don't want to change the behavior of since it can have consequences on pathfinding in various ways. |
|
@Mauller I have added extra video's with the pathfinding overlays, one for single units and one for a group, please have a look. As far as I can tell there are no additional cells being used. Group movement appears less clumpy. |
|
See the chinooks video, we can surely say it's related. To be clear I don't expect this PR to pass at this point, it changes way more than I set out to do with just the linked bug. But the destination snapping to pathcells is problematic in it's own way for sure. |
|
In the "Pathcells debug for single unit" video we can see the bomb truck in the right bottom corner sliding after the fix so that's at least one new problem and there are probably more. Closing |
When moving units the exact destination will be determined by pathfinding: the
Pathfinder::adjustDestinationwill adjust a given coordinate to account for obstacles. It will however also adjust the destination when there are no obstacles and place it in the middle of a path find cell (as Mauller suspected in the linked issue).The fix here is to use the original destination (undo the adjustment) when there is no obstruction and the player is human.
It also appears to resolve the chinook movement issue but only when the path where it lands is unobstructed.
It should be determined whether the change to group unit movement is desirable.
The videos below show the effect this fix on a single unit and on a group of units.
Demonstrate accuracy relative to mouse click
output.mp4
Pathcells debug for single unit
debug-single.mp4
Pathcells debug for a group of unit
debug-group.mp4
Pathcells debug for chinooks (fixed linked issue only if path unobstructed)
debug-chinooks.mp4
Todo