Hey guys,
I'm trying to create an RTS but first making small programs that deal with different aspects of the type of game i want to create. Atm I have a 3d demo of one object that i can click and move around the map with the use of seek behaviour with A* (my map is gird/tile based) Now I want to be able to do the same but I'm having trouble thinking of a good way to move a group of units as a formation (im trying to move things as a box shape like in warcraft 3).
For this I have seen that you can create a formation from the units you have clicked, pick a leader, and then "flock" (with an offset for each unit) the group to its target location with using alignment to keep the units going to its destination, cohesion to keep it in place in the formation, and separation for local avoidance from other units.
I feel like this would work OK for the most part (presuming i can get the formation algorithm working) but the problem I have is that I don't know how I would deal with collisions on the way to the location (as the a star would only be calculated for the leader not the group) and what if at the end location the formation is not possible (there is a wall in the way or something similar).
Another way I was thinking was to simply project the formation at the mouse click location and make every unit path find there way there but i still run into the same problem with the end position.
So my question is do any of you guys know a fix for this, or just a better way in general to do path finding for multiple agents.