bugfix(pathfinder): Fix inaccurate single unit movement destinations when unobstructed#2296
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 |
|
I think this one deserves another look. This change makes the movement behavior of units more predictable, especially the chinooks (see the video). It may cause other issues but I haven't seen it yet -- in testing it occupied the same number of pathfinding cells as the original, and the sliding issue seen in one of the videos happens in the current pathfinding as well. |
05fdbe2 to
bf452de
Compare
|
The bot has a complaint. |
5243592 to
e75a4df
Compare
e75a4df to
dd31655
Compare
dd31655 to
8814291
Compare
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 when there is no obstruction.
In testing it appears to fix the chinook landing issue (only when the path where it lands is unobstructed).
It should be determined whether the change to group unit movement is desirable.The change affects single unit movement only. In testing this would negatively impact the feel of moving around a group of units.
Chinook landing motion
debug-chinooks.mp4
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
Todo