It is generally said that A* is the best algorithm to solve pathfinding problems.
Is there any situation when A* is not the best algorithm
Collaborative Diffusion is a simple alternative (no wrangling with heuristics).
It works well when you need to target one target or any member of a group, indiscriminately, and in this case can be faster than A*. It mimics "You're Getting Warmer/Colder". This works in two steps:
1.0
if we are using floating point) and using a standard diffusion formula to spreads that scent across the map. This scent gets weaker and weaker as it spreads out from target. Once a certain weakness of scent is reached, we stop spreading.0.0
, since you cannot move there.It works best in games like football with just a few goals (where both teams of agents track the ball and goalposts specifically, leading to just 3 influence maps) or Pacman (similar, multiple agents tracking Pac) or games where there is one combined heatmap representing the centroid of a group of agents, as averaged from each agent in that army, so that one army can approach "the other army" rather than "specific units within the other army". This generality may afford increased performance.
It is best suited where maps are fairly densely populated with many, moving units, thus justifying the extensive diffusion which must occur across the entire search space on each update, although the computational cost increases on the number of maps that must be updated per frame.