I am trying to implement a path-finding routine involving the following:
- Multiple agents
- Multiple Goals
- Both agents move in sync, i.e. they both move in the same direction unless one is stopped by an Obstacle. See explanation below in the edit section.
A1 and A2 represent the starting position of two agents. The dark squares marked with "X" represent obstacles. "G1" and "G2" represent the final goal.
I played around with A* path finding algorithm, and it works great with 1 actor with one goal. However, I couldn't get it to work with more than one actor and goal.
Any suggestions and pointers about how to go about it would be very helpful.
Edit: Synchronized movement explained
If for instance, A1 is stopped by the obstacle but A2 can move, it is a valid option. A1 would stay in place but A2 will move.
- Move Right: A1 moves to (2,1) and A2 moves to (2,7)
- Move Right: A1 stays in place but A2 moves to (3,7)
- Move Up: A1 moves to (2,0) and A2 moves to (3,6)
- Move Up: A1 stays at (2,0) and A2 moves to (3,5)