RichAI endlessly loops while traversing an off mesh link

Hi, we’re trying to use off mesh node links to handle doorway transitions in our new game, which seems to be working pretty well apart from one situation. When following a path where the last part of the path is the off-mesh node link the AI traverses the link and then endlessly cycles back to the start of the link and traverses it again.

A few more details:

We’re using the default TraverseOffMeshLinkFallback routine (before writing out own custom one).
The path is a RandomPath that we feed into the RichAI.

We’ve taken a look at the code and can’t quiet figure out what’s going wrong but have made a few observations:

  • At the time the traversal corouting completes, RichAI.reachedDestination is false because reachedEndOfPath is false becuase approachingPathEndpoint is false because approachingPartEndpoint is false because lastCorner is false.
  • Not quite sure what lastCorner is supposed to indicate or why it isn’t being set to true.

Any insights on what we might be doing wrong would be much appreciated. Or maybe the off mesh link fallback just doesn’t handle this case in which case we’d love to know how to fix that!

Thanks.

Here is an short video showing the behavior.

Hi

would you mind posting the callback code that you are using?

Hi Aron,

@Marzipan and I work together and a few months ago you and he discussed how to tell if a RichAI has reached its destination.

As I understand it, we don’t use a callback, we poll the AIBase with an IsMovementComplete() function.

public bool IsMovementComplete()
    {
        if (richAI.pathPending)
            return false;
        if (richAI.reachedDestination)
            return true;
        if (HasMovementStarted() && richAI.reachedEndOfPath)
            return true;
        return false;
    }

It’s the “reachedDestination” bool that’s not getting set to true in our problem case.

Hey Aron, any thoughts?

Hi

Thanks to your info I found a bug in the richAI script when the path ended at an off mesh link.
I have uploaded beta version 4.3.24 now which fixes this.

Thanks Aron, We’ll download now and try it out.

1 Like

Hi Aron, Sorry about being a little slow to follow up on this, but we have noticed this bug is still happening in our game.

Don’t suppose you’ve found any other issues around this area?

Update: we are on 4.3.26.

Hi

That’s odd. This must be due to some other issue.
Does it show up in exactly the same way in the game? Do you have a video of it?

Its exactly the same as the video above.

The AI reaches the end of the path but doesn’t recognise it as “lastCorner” is still false