4 ms·
One "simple" trick here also is to consider putting at least some of your pathfinder calculations outside of the core game thread. If you take some time to sna
by NBJack 3y ago
One "simple" trick here also is to consider putting at least some of your pathfinder calculations outside of the core game thread.
If you take some time to snapshot the map state (ideally a nearly static grid like this) and throw it into another thread, you can free up your core game loop to work on other things. Once the path is done, deliver it to what asked for it asynchronously for use on the next update.
Alternately, limit the number of nodes explored per tick at a time. The path will eventually be found without hurting your frame rate as much.