Skip to main content
gamedev.net
🔒 Locked

pathfinding and formations

Started by daniel_i_l 0 replies 800+ views
Original Post
daniel_i_l
daniel_i_l
Untill now I've been doing all my units movement with Craigs autonomus vehicle algorithms. With those algos, each vehicle steers itself by always trying to keep an open rectangle infront of it at the same time that it's trying to move for the destination. To do formations, you just have one vehicle trying to get to the dest and the other ones trying to get into a certain position behind the leader. Now I'm trying to make some more robust pathfinding and with a pathfinding algorithm I generate a path madeup by a list of waypoints for the lead vehicle. Now the problem is the formation, if for example the path goes through a narrow opening, the leader will get through but all of the formation will get stuck behind. What should I do? Should I generate a path for each vehicle in the formation? Thanks.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Omega147
Omega147
Quote:
Original post by daniel_i_l
Now the problem is the formation, if for example the path goes through a narrow opening, the leader will get through but all of the formation will get stuck behind. What should I do? Should I generate a path for each vehicle in the formation?
I'd throw in a periodic check for the lead vehicle to see how far away it is from the rest of the vehicles, and if the average distance is so high then have the lead vehicle stop and wait for the rest of the group to show up.

Or, if your problem is more literal, as you say with the entire group getting stuck trying to follow the leader, then either tell the leader to only plot courses that it knows the rest of the group can fit through (i.e. is there enough clearance?) or order the vehicles to move into a more proper formation in order to fit through--instead of clustered into a wide rectangular formation, when a narrow spot comes up, have the formation shift into a long, single-file line.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.