Support Forum

Max node distance + avoid tags

I’m creating a turn based game with tiles with set movement limits but tiles can have traps on them.
How do I make it so I can find tiles of a set distance away and avoid tagged areas but still move through them if they have too?

I’ve implimented the ITraversalProvider example on How to limit searched for path length

However this only works if the cost to all nodes is equal and is thrown off if I add any peneltys from tags.

This sounds like a two step process.

  1. Find all tiles within a given distance (e.g. PathUtilities.BFS): https://arongranberg.com/astar/docs/pathutilities.html#BFS, or the ConstantPath type if you need diagonals to count as a distance of sqrt(2)
  2. Then use a normal path search to find a path to wherever the user (?) clicked. This path search should be configured to take traps into account.