For those who don’t know, A* is simply a better form of Dijkstra, which in turn is a algorithm that finds the best route from point A to point B. I’ve already implemented Dijkstra once, but today I wanted to try A*.
Mind noticing I’ve yet to add parallel scripting to this, since I’m interested in making A HORDE OF FLIES that chases people, using this algorithm to go around corners and such (very terrifying) and maybe even some boid stuff to make them move like an organized cloud.
Hi, I believe this could be optimized by doing an initial flood fill so that raycasts are not needed (later). However, a downside is that any real-time changes to the map might cause issues.
The problem with such a mechanic is that, I believe, small holes/tunnels/compartments might become inaccessible, forcing me to reduce the space between the nodes and end up making the whole thing more dense. Either that or I’ll have to set up a bunch of checkpoints all throughout the map.
With the way I’m doing it, the node table just fills itself up as needed. Also, do players count as real-time changes? The enemies will fly towards them.
Either way, I will already optimize it by:
making the size of the nodes created in a path-find operation directly proportional to the distance between the points;
limiting how many steps the algorithm takes, returning an incomplete result if it exceeds the limit (it’ll end up getting closer despite not being complete);
not making a complex, closed, cramped map (allows for the enemies to follow from above, where there is plenty of space)
Oh, I’ve never tried that. I’ll try to learn octrees and then, if successful, add them in. Thanks a lot for the suggestion, I wouldn’t have found that myself.