I’m trying to make a pathfinding system with jump point search algorithm.
I don’t know why, when you select all players and you travel on the map, performances decrease over the time.
I haven’t found where is the problem. When player has reached destination or when right mouse button is pressed, the program deletes lists and variables with “del”, reinitialize some other things…
Do you know a tool to identify where is the problem?
2)Or could you test the .blend and take a look at my code to try to find where is my mistake?
3)Or more generally, can you tell me what can cause such decreasings of performances over the time in programs?
Unfortunately your code is a bit to large for a quick review. You have quite a lot of loops. They do not seem to be that long, so it is ok. You should keep in mind this code runs all the time. But as you do not have a constant lag you can care for that later.
I think I noticed the lag happens when right clicking. So I suggest to check the processing path when this happens. I guess there are some loops with O(n²) or worse. From my point of view the pathfinding is the bottleneck.
Thank you very much Monster! And thank you for your code even if I didn’t use it. But you put me on the path to resolve the problem. Actually, there was an issue when right click in the pathfinding process. I forgot to clean a list which became larger and larger (own[“nodesToClean”]). Now I think there is no more decreasing performances: