A* Pathfinding: Connecting Grid Graphs


I was wondering if its possible to make a multifloor building using grid graphs?

And how can I connect them together, is it possible to make auto-connection or something?

Thanks in advance


If you understand the theory / concepts of A* path finding this becomes a pretty easy question to answer. However, without knowledge of the theory it will probably be difficult to understand and implement.

So first off I recommend reading Programming Game AI by Example - by Mat Buckland . Probably one of the best / most useful books I have ever read in advancing my game development skills.

A free, but not nearly as useful, resource is here . Note that neither of these compares to an actual formal AI class at a college - which benefited me a lot even though I had already thought I ‘understood’ the theory myself.

Once the theory is understood you should be able to see that A* Pathfinding is all about graph theory . With a proper understanding of the theory the following two solutions should be fairly simple to implement:

  1. You can simply add new floors as new nodes to the graph. This would the easiest and least complicated. It also may be inefficient.

  2. You can make each floor a node in a higher level graph. First your algorithm would determine the best way to get from say floor 1 to floor 3 on a graph showing how floors connect and then each floor would determine a path to the next location.