Short distance teleport

Hello!

Since upgrading to A* Pro 5, I’ve noticed more short distance teleporting.

It seems to be taking longer to calculate paths? Anything I can do to rectify?

I want to try and get rid of all teleporting, and I don’t want to use the switch path interpolation either as that looks equally janky and clunky. My game is multiplayer, with paths calculated server side, and it has opened my eyes to the possibility that even if path calcs improve, latency may contribute to short distance teleporting also, so preferably I need a solution that’ll mitigate issues as best as possible.

Thanks for any assistance anyone can offer!

I’ve rectified the issue and managed to get it working similar to how I had it before.

Seems as though a change has occurred whereby the seeker.StartPath no longer automatically starts walking the path after calculating. I guess this is to keep inline the recommendation to use ai.StartPath now, which I am now calling manually after the path has been calculated server side.

However, I now have another issue… the pathCallback has been deprecated, but I rely on repathing when following other units, and I relied on that callback to network the newly calculated path. Repathing doesn’t seem to call the new callback method which I pass in when I first calculate the path, so how do I handle this now please?

Thanks!


Please Lord A. Granberg, you must help! Thanks! :slight_smile:

No suitable alternative to pathCallback when using repath rate then? I cannot see the reason for removing something and not providing a suitable alternative, illogical.

Hi

Hmm. That’s a use case I had not thought of.

You can solve this in one of two ways:

  1. You can override the OnPathComplete method on the AILerp component.
  2. If you always do the path requests yourself (not quite sure you do), you can calculate the path first, and then send it to the movement script:
var path = ABPath.Construct(ai.position, ai.destination, (p) => {
    // Send the path over the network
    ai.SetPath(p);
});
// Optionally apply path settings here

// Calculate the path
AstarPath.StartPath(path);
1 Like

Okay thank you for the assistance.

I’m looking into FollowerEntity, what’s the most efficient way of being notified of path recalculations from the autoRepath policy? I’m still struggling with the lack of events, I don’t want to poll the path every update if that’ll be inefficient, because I want my game to be scalable if possible, and support potentially many units. Thanks!