How can I replicate Pawns between a server and multiple clients?

Alright, I’ve spent the night trying to figure this one out and I just can’t.

I’ve got a pawn, it’s controlled by the default player controller. When it’s either a single player, or a listen + 1 client the listen/single player moves around fine. The second client doesn’t. In the case of a dedicated server neither replicate to one another.

I’ve also tried making my pawn inherit from DefaultPawn so that it has a movement component however using AddMovementInput ended up with the same results as using SetActorLocation or SetActorRelativeLocation.

  1. If single player, works
  2. If Listen and 1 client, Server works
  3. If dedicated server, none of the clients replicate

What am I missing? Is it as simple as telling the the server the client pawn is attempting to move and to move the pawn on the server?

Look at the pawn class (and other classes) of the ShooterGame example. It is a fully functional multiplayer shooter game. Compare the classes [mostly the values set in the constructor] and see what you are doing different.

It’s really difficult for someone to answer a question like this without the full details of your entire setup. It could be 1 or more of many things but I would start with the ShooterGame example project.

Unfortunately the problem comparing the two is all moving/replicated Actors in that example are inheriting ACharacter. My current game is inheriting from APawn or ADefaultPawn because the Mesh doesn’t have a skeleton. The problem I’m describing above even happens with the flying template if you attempt to play it multiplayer. The second ship doesn’t appear to be replicated on a listen/client setup, and neither appear to be replicated on a dedicated server setup. This is all with Replicate and Replicate Movement turned on.

Hmm. So setting the variables inherited from AActor to true in the constructor…

bRelicates = true;
bReplicateMovement = true;

Isn’t helping…

Is it the movement that isn’t replicating or the visibility or both?

Mesh or movement or both?

Well then, my guess would be that since you don’t have the UCharacterMoveComponent that comes with the ACharacter class, none of your movements are being replicated. Look at the UCharacterMovementComponent and you can see it uses the interface INetworkPredictionInterface.

This is the only major difference I can see between APawn and ACharacter that relates to movement.

The UMovementComponent doesn’t utilize this interface and maybe that’s why it’s not replicating. Can you try to stick a UCharacterMovementComponent on your object and move it that way? Maybe it will replicate the movement then.

I’m simply trying to work through the possibilities with you, I’m no UE4 guru =)

Just the movement. Meshes are drawn as expected.

This makes sense. You have to manually replicate your movement calls.


Get input, send request to server.


Handle client request, move pawn, tell client to move pawn


Move Pawn from method called by server.

Although, I don’t think this handles any network smoothing [interpolation/extrapolation] like I believe the UCharacterMovementComponent does internally.

When you are a Listen Server, you act as the server and a client… nothing is being replicated anywhere… technically. You are playing as the client, but the other clients talk to you rather than a dedicated server. So you are seeing your own movement locally as if you were just a normal client. When you spawn in another client that connects to the game the Listen Server is hosting that is the true replication there… the Listen Server is not replicating any movement so you don’t see each other move.

Where do you see this dependency?

Oh my… I completely missed that. I misunderstood your first post, I’m sorry.

So… you have a Listen Server with another Client connected to it. From the connected Client you can see the Listen Server Pawn moving around, but the Lister Server can’t see the Client pawn move. This is odd indeed.


You know what… it might be that the second client isn’t sending any of it’s movements to the server, kind of like sixb0nes was saying. Look at my first comment on sixb0nes’ post there and that is what you need to implement. The Listen Server moves fine and replicated because it is the server… you are telling the server directly to move so the other connected Client sees the movement.

I responded to another thread about this yesterday - it seems like a gap that should be filled by the team - unless that was never the intention of the Pawn? I’m in the same boat FYI. For now I’ve just put it on the back burner and moved on.

Here is a way to get it working through Blueprints, though I don’t think it is something you would want to do in production code?

There was also mention by JamesG on the forums that they would be releasing some networking pieces around the vehicle stuff in 4.2, that might help us out.

Pawn Replication - Blueprints

JamesG on vehicles

Right, but there are tick boxes to “replicate movement” when blueprinting, etc. and they seemingly have no effect? Again, maybe using the Pawn for a purpose (character) that it wasn’t designed for and the assumption is that you will be handling it on your own. Seems odd.

I’m pretty green too, so I may be completely out to lunch as well :slight_smile:

Thanks sixb0nes,

What I don’t understand is why does the movement replication work on a pawn when one player is also acting as the server? The server/client machine has it’s movement replicated onto the connected client machine no problem while the connected client machine doesn’t.

I do agree that this seems like something that should be filled in by the engine.

Giving it a go though I do notice it requires a reference to a character. I may take a look at all the network prediction related code in UCharacterMovement and see if I can’t make it work in a custom movement class that doesn’t depend on the character.

I may have not been clear, or perhaps I’m not understanding what you’re saying. When I setup a listen server and a second client the listen server/client movement is replicated to the second client. That’s where my confusion lies. So there’s clearly something going from the listen server to the second client letting it know that a pawn has moved.

I tried adding it to the existing Flying template, unfortunately it does depend on this reference but you’ve given me a place to start possibly fixing it.

[2014.05.16-01.57.19:426][505]LogCharacterMovement:Error: MovementComponent0 owned by TestFlying2Pawn_1 must update a component owned by a Character

I should add that this only happens when a second client is introduced.

Exactly! Which is where a lot of my confusion lies :slight_smile:

Well… crap.

I think you just need to implement the movement manually kind of like sixb0nes was saying.

Something like this:

Moving Client:

Get input, send request to server.


Handle client request, move pawn, tell all clients to move pawn

All Clients:

Move Pawn from method called by server.

Alright, so just to keep the loop going… I tried using the mesh as a character, ran the same test, same results. So I’m obviously not doing something right here. Taking a break, getting some rest.

Scratch that last update. I had reverted back to using SetActorLocation instead of AddMovementInput. Now that I’ve gone back to AddMovementInput it’s working.