- Home /
How to use A* pathfinding for a large map?
So currently i got used to A* pathfinding and it has been good so far but how do i make the pathfinding on a bigger map with more AI characters(an army for example). The problem is if i make more graphs that will make the game laggy and same goes to expanding the graph, Also i came to know that multiple AI characters asking for a path at the same time will also make the game laggy. So what should i do to use A*(or another pathfinding system if there is one that is better) on a large map with big number of AI characters???
I would also appreciate if anyone can tell me the pathfinding approach used in Strategic games like total war?
Answer by adrenak · Oct 31, 2012 at 05:11 PM
When you are making locomotion programs for a group of entities, it is not practical to do the path analysis for every character, this way you always will end up with something really slow for a game, and will also get unrealistic results as the behavior will be like every entity (or soldier in your case perhaps) will end up looking as if it is acting alone, ignoring everyone else in the group it belongs to.
I don't think that A* is the way to go ahead with. Have a look here, these are really good works by Craig Reynolds and you can find group/combined behaviors. You can also have a look at Programming Game AI By Example by Matt Buckland, it has a chapter for path planning and briefly deals with group behavior such as cohesion, which I think is a good solution for your question.
I hope this helps! -Vatsal
I took a look at steering and apparently it works by setting waypoints for the game object not by actual pathfinding, That will make the crowd look unrealistic and the approach will not be practical for a large map i believe.. is that right?
Yes. Its not a very practical way, and the crowd will not look realistic as there are no inter dependencies between their locomotion, which results in the members of the crowd trying to run into the other members and so on.
If you still want to make use of A* then use it for the crowd and not for every individual in the crowd. This way, you can move the crowd along a sequence of waypoints, or along the A* route and make the crowd move as a group.
For example, do an A* search and find the suitable path, then assign a group leader of the crowd that follows the path found by the A* and let the other members of the group follow the group leader. Or ins$$anonymous$$d of having a group leader, keep some cohesion between the crowd members to keep the crowd together and move the crowd as a whole along the A* path
Well this is the greatest piece of advice i stumbled upon, I cant believe you are a 17-year old. but even if i do that and let one guy be the leader still i need a solution for expanding the graph map without having any lag? But thanx alot though
Answer by abdosaher · Nov 06, 2012 at 05:14 AM
OKay I found out how to do this, I used the WaypointMaster technique found at unify for when the NPCS are out of sight unless they are visible by the player then they switch to the A* method..
Your answer
Follow this Question
Related Questions
A* or AStar Pathfinding doesnt work for me? 0 Answers
How do I go about making a 2d platform enemy ai 1 Answer
Astar Pathfinding ai moves more nodes than it should 0 Answers
Colliders and Astar 0 Answers