I’m working on a turn based game and I need some help with finding the walkable tiles within range. The point is - I’m using the terrain tiles along with point graph. Moving from one tile to another cost 1 AP - when player selects the unit I want to highlight all the tiles that user can reach from within his start position. Is there any way to do it? Right now I’m collecting all the tiles that are within the range but some might not be accessible due to walls or other obstacles - so I need to find if they can be reached within predefined action points. So I launch the path calculation and when it’s done I compare the path length to the user action points. It works but it’s very slow. Game is designed for mobile which means I have limited gpu power.
Any ideas how it could be done differently?
Thanks in advance.
You can use a ConstantPath.
The ConstantPath will run a path calculation which fills a list with all nodes within a specific cost away from the start. There is an example scene called PathTypes which you can check out.
This is a pro only feature however.
If you know all costs are the same everywhere, you can use a simple BFS search.
This also works for the free version.
You need to upgrade to the beta version however since this method had a bug in previous versions which caused it to return incorrect results.
Thanks a lot. I have the pro version so I guess it’s better to use the first approach.
Great product by the way !!
Thanks a lot once again and have a nice day.