Custom path resolution with many equidistant paths (Pharaoh A New Era)

Hi,

I’m one of the developer of Pharaoh - A New Era game (the remake of the old 1998 game), and I’m currently looking into a solution for one very specific problem we currently have.

It’s a isometric city building game where “walker” goes through the city to deliver/carry resources, etc…
We’re using the A* Library because some rules apply where we need to precompute the path the walker would be able to take, and definitely not doing it ourselves was a breeze :slight_smile:
But here comes the “issue”: In the original game, when Walkers have two possible path of same distance, they alternately pick one or the other.

Here is a picture of the situation:

(I’m using a Point Graph here because the map has a square format instead of classic diamond-shaped isometric grid)
In the original game, the walker will get out of the left building, goes two tiles North-East, and then either pick the North-East road, or goes into the South-East one.
The second time the walker spawn, he will pick the other one.
Since we’re doing a remake, we must keep this feature, but I’d like to not have to go on a custom A* implementation to be honest.

Is there a way (or a callback, or even a hacky one) to make it possible to alternate between “branches” ?
In the exemple, since both branches have the same distance / weight, I suppose one is being discarded in the internal computation, but I wonder if I can somehow have the full node list before being reduced to only one path, and either apply a “pre-process” or something alike to discard it myself.

Thanks !

Hi

That is not possible, I’m afraid. The internal algorithms don’t work in a way that makes this very easy. I suppose you could modify the internal code to add a slight bias to one road if it detects that two roads are possible, but I don’t think it’s a straightforward change.