A* Pathfinding Project

3D Board Game With Multiple Layers


I looked through the documentation, but I’m not entirely sure which Graph type I should be going with for my project. Here’s a description of what I’m wanting to do for it to help narrow down which type to use:

  • The “board” pieces will move like the cube in this video (so hopping from one tile to another, except in 8 directions instead of just 4) https://www.youtube.com/watch?v=ZmYXymCR22M

  • The pieces will only be able to stop on top of a tile at a certain point (the middle of the top)

  • The “board” will be dynamic. A user will generate a kind of battle map at runtime, save it, and then other players will be able to load that map to play on.

  • There can be multiple levels to a board, like a building with more than one floor or a bridge that you can go over or under.

  • All tiles will be the same size and have the same spacing along the XZ axis, but the Y axis placement could be anywhere from -1.0 to 1.0 higher than the neighboring tile

  • Tiles will need to hold data like:

    • If a tile is a ladder piece
    • If a tile teleports to another tile
    • If a tile is harder to traverse (so something like double cost for moving through it compared to a normal tile)
  • The tiles can be set manually (so if a user takes a model of a building and wants to define the walkable tiles inside that building, they would put tiles on the floor, tiles going up any stairs, tiles on the second floor, etc.) So it would need to be able to tell which tiles were neighbors from proximity.

  • The world could be fairly large if the user wanted it to be

From what I’ve read in the documentation, it seems like the Point, Recast, and Layered Grids are all options, but I don’t know which would be the best to go with for my case.



Sorry for the late answer.

The only reasonable graph type for this game is the layered grid graph or point graph. Recast is not the right one.
In the current version the layered grid graph only supports 4 neighbours though, but in my dev version it supports 8, so that will be released at some point.

Question: Does the pathfinding need to take into account ladders and teleports? Or is this part of the puzzle?

You’ll want to have a look at https://arongranberg.com/astar/docs/turnbased.html#ITraversalProvider