I am making an RTS game, and the whole terrain is like a grid (cells with x and y coordinates). I have a couple of soldiers in a group (military unit), and I want to send them from point A to point B (there are obstacles between points A and B). I can solve for one soldier using the A * algorithm, and that is not a problem. How to ensure that my group of soldiers always comes together? (I notice a couple of cases when they break up and go in different ways to the same destination, I can choose the leader of the group, but I do not need the soldiers to go to the same cells, but the leader, for example, a pair with the right side, a pair on the left side, if possible). Has anyone solved a similar problem in the past? Any idea for modifying the algorithm?
Damir source share