I’m using the A* package for a rather simple, Fire Emblem-esque turn based strategy game. The game plays out on a grid and I use a small grid graph to control movement range, walkability and such. The system has thus far been absolutely wonderful and solved most of my movement-related problems.
However, I can’t figure out a good way to calculate the total movement range of a unit. What I’m doing right now is finding every position the unit can walk to under optimal conditions, then draw paths to each one to check if it can actually reach them. I then color each accessible square red. Examples:
The problem is that I can’t calculate the paths through a normal loop. I have to use a coroutine and pause it for a fraction of a second every time I start a new path. This makes the operation extremely slow, around five seconds at worst. I need it to be almost instantaneous since the range marker is shown and redrawn every time you move a unit.
Is there a way to calculate new paths without having to wait for the previous one to finish? Should I buy Pro and use a multi target path instead? Or am I just approaching this the wrong way? I’m a total noob when it comes to pathfinding, so I’m sure there is a much more efficient way to solve this than whatever I can come up with.