• 0

# [435] Units prefer moving left if shortest path obstructed by a unit?

## Question

This video demonstrates the BB Fighter moving a short distance. The shortest path would be a straight line between the two points, except that on that particular angle he is coming from, the width of his selection circle is partially blocked by another unit, meaning he would have to path around that unit to get to his destination.

The shortest path taking into account the unit blocking the way is to the right, and then a straight line to his destination.

However the BB Fighter (and every other unit) always seems(?) to prefer pathing to the left if the shortest path is blocked by another unit. Going left is often the long way around, as is the case here - as left means that he has to path around multiple units just to even get to his location.

Expected result: Units should always take the first shortest path available to their location, whether it is to the right, or left.

## Recommended Posts

• 0

##### Share on other sites

• 0

It also doesn't look like it's just units either, they seem to always go left when they hit an edge of the navmesh as well.

##### Share on other sites

• 0

That's interesting. Thanks for videos.

However, are you sure it's always (or only) a left-side preference, what causes problems in the presented situations?

For example, if I move a blockade (from the second video) to block the right side next to hearthstone, the BB unit acts the same way. This time deciding to go right, hit the blockade and be stuck there. He will not go left around the hearthstone at all (till stationed at least half way there or so). Eg. see BB fighter in the picture

I hope this helps somehow.

Other than that, is it possible, that this issue is somehow connected to the pathfinding issue of narrow passages?

http://forums.obsidian.net/topic/69757-392-pathfinding-issue-with-tight-spaces-between-other-units-unit-cannot-find-shortest-path/

For example, If there is some collision detection or obscure vision problems, those may affect both issues.

As the left-path-choosing as well as narrow passage issues happen when the moving unit has to go near an obstacle...

##### Share on other sites

• 0

The only case where a unit will move to the right around anything is if they bump off another unit's selection circle who doesn't have enough pathable space to the left (eg, between them and the edge of the navmesh). Units have trouble detecting gaps between other units, so the automatic pathfinding will not find the gap between the NPC and the edge of the navmesh to try and move left.

Here's a video that demonstrates that they just bump into them and path straight into the right wall LOL because the left path is blocked

They still try and move to the left around everything though.

This video also demonstrates that units can't detect whether a path is blocked by other units without actually bumping into them first ... they should probably change that.

Edited by Sensuki
##### Share on other sites

• 0

Nice, that's basically what happened to me too. Thanks for the video.
Wait, are we playing an RPG billiard?...

Also I probably worded my post wrong.

If all the pathfinding would be (almost) perfect, and a unit would always decide to go left, but only in case, when both paths are equal (eg. as an implicit decision for undecidable situations), will you consider that as a problem? I mean what one may observe as the left-path-choosing issue may be just situations, when a unit should clearly move to the other side than it did, as you demonstrated.

My only concern is, whether we should see that as a root cause of the pathfinding issues (eg. a mismatch of left/right in the code, or decision to go left too early before pathfinding estimation, etc.) -> then changing it may solve a lot. Or should see it as one of the consequences of deeper problems (eg. a wrong pathfinding (re)calculation, etc.) -> then changing left to right, or a random combination, may not solve anything, as statistically speaking you will probably detect the same issues... (Please don't take examples seriously, I don't know anything about pathfinding.)

##### Share on other sites

• 0

I don't know much about pathfinding either, but I do know about routing - which has some similarities to pathfinding. It just seems like that units are told to go left if their path is blocked, no matter what.

If all the pathfinding would be (almost) perfect, and a unit would always decide to go left, but only in case, when both paths are equal (eg. as an implicit decision for undecidable situations), will you consider that as a problem?

No, it probably wouldn't matter. It's not them being told to go left that is the cause of the problems, necessarily but it seems to be a consistent result - which could help Obsidian identify where the problem is.

##### Share on other sites

• 0

No, it probably wouldn't matter. It's not them being told to go left that is the cause of the problems, necessarily but it seems to be a consistent result - which could help Obsidian identify where the problem is.

Definitely.