I am making a game where there are many waves of monsters that attack, each monster utilizing pathfinding since each map is randomly generated. I am testing how 100 of the smallest monster would do and a lot are pathfinding fine. The others, though, would take an extremely long time to compute a path. There are two issues that I need help with.
I have the monsters compute a path and check if the path is blocked on a loop until the path is clear. When I make it so that there is no way to get to the goal and then create a way to get to the goal after about 15 seconds of waiting, the time the monsters use to compute a single path increases drastically and does not lower at all after.
Even when the path isn’t blocked, some monsters still take a very long time computing a path. I thought this was because they were so far away from the goal, but then I saw that other monsters that spawned even further from the goal than them could pathfind without issue.
Am I using the path:ComputeAsync() function way too much? Is there a way to fix this? I need to know so I don’t waste my time on this if there is some hard-coded limit.