Lag while calculating larger paths


I found that while calculating larger paths (often obstructed by obstacles), there is a visible amount of lag (easily a second) before the character starts moving along the path. Is there a way to eliminate this? I am currently using nodes of size 16 pixels, with the entire grid dimensions being 195 nodes by 195 nodes (3120 pixels by 3120 pixels).

Example path:

As you can see in the console, the path takes almost 60ms to calculate.


If the path takes 60ms then it definitely shouldn’t take a second before the character starts to move.
Do you explicitly request a path or are you just moving the target object. If you are just moving the target it will wait until the next automatic path calculation happens. This is controlled by the ‘repath rate’ variable if you are using one of the built-in movement scripts. Try to set it to a lower value and see if that helps.

Also. Your image is now showing up.

For optimizing pathfinding, take a look at this documentation page: