Pathing problem

So I’ve been noticing some inaccuracies with my action phase simulator and I think I finally know whats wrong.

So up there you see a picture, let me explain.
The pink, is my enemys defence.
The green is my simulated path of pings.
The blue is the enemy firewalls that break.
The yellow is the pings actual path (after the first bit of green).
And now the orange is the problem, everytime a firewall breaks, I find a new path etc. (in my action phase simulator), so the blue breaks while my pings are at the orange location and there my simulator calls the pathing function without the knowledge, that the pings just took a step vertically and that it should now take a step sideways and well takes another step vertically and doesnt run into the destructors. You see how this is a problem?

Now please note that this szenario would not occur on this particular map, it is just to simplify something that otherwise happens quite often.

Does anyone have a suggestion on how I could fix this?

Ask questions if you are confused by my description, it was quite difficult for me to put this in words (and english is not my first language)

I had same problems few weeks ago and I fixed it by storing taken path and then if y coordinate of previous location wasn’t same as current then I just searched for new path from previous location.


I’ll rephrase the question in terms of the problem I had with this:

When recalculating paths because of a destroyed unit, the zig-zag movement pattern of horizontal/vertical movement can be disrupted when calling the pathfinder following a vertical move (i.e. the current position is a different y coordinate than the previous position).

@paprikadobi’s answer is mostly correct. This will fix your issue in most scenarios, but can result in incorrect paths in rare scenarios.

This question’s a bit out of the realm of beginner questions, though, so I’ll only provide that there is a better, 100% correct answer, but the one already provided is probably ~99.5% correct. The edge cases it doesn’t account for are far and few between.


@Ryan_Draves OK, so now because of you I will have to check lot of generated replays from my simulator and check when it is wrong to find what’s wrong with my approach :smiley: as I thought I have already perfect pathing at least.

1 Like

Ok thanks @paprikadobi, and @Ryan_Draves, I understand, I’ll give it some more thought, thanks for the hint though.

Heh, maybe I said too much. It was an edge case that took weeks to unveil itself from the replays I was watching, which is why I placed it around a 99.5% correct solution. That was my previous solution until then.

1 Like

OK, I’ve finally found it. At least I hope so. It happens when unit can go left or right, and both paths are same length, is that correct?

That’s a specific instance where your pathing could get messed up, but I think any solution that fixes that should fix the more general problem.