Replicate Pawn Movement

Here’s something I don’t understand:

I derived one class from a character.
I bound input functions (no UFUNCTION at all) for forward/right/mouse axes that move and rotate the character.
The functions I use are Actor::AddMovementInput and PlayerController::AddPitch/YawInput.
The movement happens (or replicates) on all clients and server.

I derived another class from a Pawn and gave it a SpectatorMovementComponent.
I did the same thing as above.
Now movement happens only on the controlling client, on the server nothing happens.
I tried setting SetReplicates(true), SetReplicateMovement(true) and MovementComp::SetIsReplicated(true).

Am I missing something here? I’m aware that you should usually call “Server”-functions from client-input, if you want to change anything from client to server, but I didn’t do that with my derived character class either (not for basic movement that is).

Movement replication is implemented for character only , if you want it for a pawn you have to do it yourself or copy part of the implementation within character.

Your conclusion is correct, most of the movement replication logic is within the MovementComponent classes.

Are you sure about that? I added the vehicle example features to my project. When I have them possessed by a client’s PlayerController, the movement gets replicated just like that as well. I checked the code and there aren’t any “Server”-functions either.

Does that mean the code for sending client input and replicating on the server is handled inside the various MovementComponent-derived classes (IF it is handled) ??

Well thanks, but I find it hard to believe that vehicles and characters are the only types of controlled actors that come with built-in syncing, prediction and lag compensation functionality etc.

A simple type of kinematic movement should absolutely be supported out of the box as well. The way I see it, there are basically three “final” derived movement classes: character, vehicle and floating pawn. Why floating pawn lacks the network functionality (despite being so simple) that the other two have, is beyond me.

Do you have any advice (or link) how I should make my own Network-ready floating pawn movement? The easiest way I can think of would be to bind the client-input directly to server functions that cause the pawn to move on the server. But that would probably be laggy and use lots of bandwith.

I felt the same when i started programming in UE4, i have build my own flying movement component from scratch… no way around it. If you want to implement it with physics as well it gets even more complicated, i skipped that part…

Have you had a look at the Vehicle code? I mean, that’s probably where you want to look if you are going to make physics-simulated replicated movement.

Well, I’m having a look right now and all I found so far is that the client’s input gets sent to the server as a replicated structure. And that’s all? I didn’t find anything related to client-prediction, interpolation etc.

Is it that dynamic (physics-simulated) objects have their own implementation of smooth client corrections, so that you just need to apply forces on client and server?

I guess I will need to look at the character movement next to learn some more.

UE4 does have a built-in multiplayer-ready movement component: