On a character with a CharacterMovementComponent, Replicate on, Replicate Movement off, the client cannot move the character that is possessed by their Player Controller as the Server corrects any movement updates, although Replicate Movement is off. The desired behavior is that the client and server can move around freely without their movement replicating.
With the same logic on a Pawn the client and server can move around freely as is the desired behavior.
Using p.NetCorrectionLifetime 5 on the client shows that the server is correcting the position of the client’s character.
- Create a new project
- Create a character, Replicate On, Replicate Movement Off.
- Add simple movement input via blueprint or c++
- Use p.NetCorrectionLifetime 5 in the console and attempt to move the character on the client, notice that the character will not move and the debug from p.NetCorrectionLifetime will show the Server snapping the character back to the position.
- Copy the movement input logic into a pawn and move the pawn on the client. Notice it will not be restricted as is the desired behavior.
I wasn’t able to reproduce any unusual behavior with a Character not being able to move on the Client when ReplicateMovement is disabled. To test, I created a new character, turned off ReplicateMovement, and gave it the same basic forward/right movement as a new ThirdPerson template project (AddMovementInput). On the Client, the character moves as expected and that movement is not replicated to other Clients (though it does appear on the Server, as you’d expect).
Is there anything else I need to do to reproduce this? Using p.NetCorrectionLifetime 5 had no impact. If you can put together a small test project and upload it somewhere for me, I can see what you might have done differently. Thanks!
Its entirely possible that I am overlooking something however I have created a test project with the issue present.
If this isn’t the desired behavior I noticed in UCharacterMovementComponent::ReplicateMoveToServer there is no check to see whether bReplicateMovement is flagged and a check like:
may solve my problems. I haven’t had a chance to test it however.
Thanks for the test project! I saw the same behavior you described in your project, and determined the cause is the Add Actor Local Offset node. It appears to not be working correctly on Clients, and it has nothing to do with the ReplicateMovement setting. You can get around this by using different movement methods, such as Add Movement Input (which is what I originally tested with, and can verify works on Clients).
I’ve entered a bug report for the issue (UE-13071), and I’ll let you know as soon as I see an update on it. Thanks again!
Great news Ben! I’m glad that I could help.
I should also note that using the following setup has the same results: http://jamesknight.net/wp-content/uploads/2015/04/SetActorLocation.png
This is why I believed it was the ReplicateMovement setting as any nodes that change positions without considering the network don’t move the client but any movement nodes that likely consider the network do. That and p.NetCorrectionLifetime 5 would display corrections even when replicate movement was off.
I hope this information helps and I’d love to keep in the loop of what the issue is!
Thanks for the additional information. I’ll add that to the bug report. It makes sense to me that if Add Local Offset nodes aren’t working, that Set Actor Location nodes would have the same problem. Add Movement Input uses CharacterMovement directly, I believe, so it functions differently.
That makes sense, thanks again Ben!