andulvar
Member
I'm trying to optimizing the way I create movement grid highlighting in my game and I'm running into some problems.
Currently I use a square grid based system and to highlight the possible movement squares I call an A-star algorithm on every square within the movement range. This works fine for smaller movement ranges, but at the maximum movement range (12 squares), I need to perform this function on 312 squares in a single step.
This process currently takes about 5 seconds while the screen freezes during the calculation.
Logically speaking, is there a better method to display possible movement, while still making sure not to highlight accessible, but unreachable squares?
Currently I use a square grid based system and to highlight the possible movement squares I call an A-star algorithm on every square within the movement range. This works fine for smaller movement ranges, but at the maximum movement range (12 squares), I need to perform this function on 312 squares in a single step.
This process currently takes about 5 seconds while the screen freezes during the calculation.
Logically speaking, is there a better method to display possible movement, while still making sure not to highlight accessible, but unreachable squares?