Pathfinding on multiple floors?

Hello,

I’m trying to implement an A* solution for a project which has multiple floors (one on top of the other) with stair cases. The grid graph seems to only create a single layer grid. I had to ignore my ceilings in order to get it to create a grid on the floor in my buildings. What should I be doing to create an A* map for levels with multiple floors overlapping each other?

Sorry if I missed something obvious!

Hi

In the free version the only way to do that is to either create a navmesh graph: http://arongranberg.com/astar/docs/getstarted2.php or to use a point graph.

In the pro version you can use a layered grid graph which can handle multiple floors or a recast graph which will automatically generate a navmesh for you (and also handles multiple floors).

Hey Aron,

Thanks for the reply. I’m looking to use this with the Random Dungeon Generator on desktop/console. The recast graph sounds like my best bet … Do you see any problems with that idea, or should this be able to work for a multi level dungeon at runtime?

Thanks again,
Dale

[Edit – Sorry if this question sounds redundant, I know you already said that the recast graph covers stuff like that. I just want to make sure what I’m planning is within the scope of what its meant to be used for, as its a $100 dollar purchase. Thanks.]

Hi

Yes it would work, however you should know that calculating recast graphs is relatively slow, and since your dungeons are randomly generated, they need to be scanned at runtime, so you should expect a 0.5-2 second calculation time (depending on the size of the dungeon) at the start of the game.

Since at the start of the game, the dungeon is not calculated yet, you will likely need to manually recalculate the graph when the dungeon has been calculated, you can do that using:
AstarPath.active.Scan()