http://theory.stanford.edu/~amitp/GameProgramming/AStarComparison.html
I go into a lot more detail here, with interactive diagrams.
⁽¹⁾ I’m skipping a small detail here. You do need to check to see if the node’s g value can be lowered, and if so, you re-open it.
reconstruct reverse path from goal to start
by following parent pointers
⁽²⁾ This should never happen if you have an consistent admissible heuristic. However in games we often want inadmissible heuristics.
See Python and C++ implementations here.
Connectivity
If your game has situations in which the start and goal are not connected at all by the graph, A* will take a long time to run, since it has to explore every node connected from the start before it realizes there’s no path. Calculate the Connected Components first and only use A* if the start and goal are in the same region.