Download

Player Pathfinding (AIController) over Network - No prediction?

The issue is that the pathfinding is calculated on the server and the client can not predict the movement, meaning the character does not move until the server says OK.

An AIController only ever exists on the server. Path finding is only accessible via an AI Controller.

I have it setup as follows:

  1. GameMode spawns a PlayerController and a Pawn containing nothing other than a camera & spring arm.
  2. PlayerController tells server to spawn an AIController and the Pawn that everyone actually sees. AIController possesses this pawn.
  3. PlayerController calls AIController->MoveToLocation() to move the player.
    ^ However, it gets called on the server, so any latency at all means the player is waiting that long for their character to move.

I noticed in Project Settings -> Navigation System there is an option “Allow Client Side Navigation”, however because the client wont be aware of the AIController I don’t see how it’s meant to use that option.

Ultimately the client needs to predict the pathfinding that the server performs. If anything I’d prefer the pathfinding to be fully client-side and then using something similar to AddMovementInput to move along that path. Possible?

I set bReplicates and bAlwaysRelevant to true and bOnlyRelevantToOwner to false allowing the client to see and talk to the AI Controller.

However when I try and make the client move using it, it rotates to the desired direction but wont actually move on the client, I commented out the server code to ensure. There is nothing to debug and no work-around in sight as AIController->MoveToLocation is being called and with valid parameters. Nothing in MoveToLocation() suggests there’s an authority check.

Can someone please tell me how to do this, it claims there is functionality but has zero indication of how to actually use it - what’s the point in making something no one is able to use??

Did you ever solve this?