How can I set up Movement Replication Client to Server in Top-Down Demo?

I started with Top-Down Code Demo, and adjust the playercontroller.h as well as playercontroller.cpp to replicate the location from client to server.

However, the walk animations don’t play on the Client (he kinda just jitters and slides around). Server side plays the client walk animation, so I need to replicate this somehow. But I thought all movement should be replicated by default.

One more issue is the movement speed is very different from Server to Client. The client walks at a much slower pace, I don’t know the cause of this.

I have a feeling the SimpleMoveToLocation Function isn’t the best thing to use for networking games.

Any advice would be great, I haven’t made much progress on this in a long while. Is there a better solution for this type of movement?

This code is being ran by the server from request of the client to update the client movement/location in the playercontroller.cpp

void ATDPlayerController::ServerSetDestination_Implementation(const FVector DestLocation)
    {
    	APawn* const Pawn = GetPawn();
    	if (Pawn)
    	{
    		UNavigationSystem* const NavSys = UNavigationSystem::GetCurrent(this);
    		float const Distance = FVector::Dist(DestLocation, Pawn->GetActorLocation());
    		if (NavSys && (Distance > 120.0f))
    		{
    			NavSys->SimpleMoveToLocation(this, DestLocation);
    		}
    	}
    }

Hi there, I’m struggling with the same issue here:

I’ve somehow managed for the client character to replicate it’s movement and animation but it’s still “jittery”. I’ve looked into the SimpleMoveToLocation source code but couldn’t see what the problem is. For what it’s worth, server character gets replicated just fine. May be it’s just a unreal bug and it would be really nice if one of the epic guys could take a look into this issue.

I’m also struggling with this. If the server and client are running on the same machine it works fine, however once I try using two computers on the same network as server and client the client becomes slow and doesn’t display animations. I’ve looked everywhere but no one seems to have a viable solution for this.
I’m using blueprints btw.

I’ve found a solution for this: Does UE4 have client-side prediction built in? - Multiplayer & Networking - Epic Developer Community Forums

Hi @Exreph,

Did .Holyman’s solution work for you?

Try this mate - a little modification to the character controller all via BP.

Hi Exreph,

Since we have not heard from you for a while, I will be marking this issue as resolved for tracking purposes. If you still need any further assistance, please feel free to let us know. Any new comments on this post will re-open it.