Multiplayer CharacterMovement Replication

I am trying to replicate the character movement in a multiplayer game. I set the SetIsReplicatedByDefault as true in the structure, I updated the replicated data in the tick component, and I got a warning of

Here is my code: (h)

(cpp)


Does anyone know how to fix this warning? The gameplay is working fine. I had tried not to replicate the ROLE_SimulatedProxy, it ignored the warning, but the data would not update on the simulated clients.

First, check out the good generic network guide: Multiplayer Network Compendium | An Unreal Engine Blog by Cedric Neukirchen

Second, from here you can learn that on the client, your actors have be owned by player controller to be able to send client->server RPCs. Probably the problem is in the way you spawning your character - without the proper owner; Can also be a plenty of other reasons

And the third: you should be aware that UCharacterMovementComponent that comes with ACharacter already supports network movement replication out-of-the-box. Though implementing your own as an exercise is also an option. You can even check CMC’s code for details of its implementation

Also, don’t make on-tick RPCs reliable, it will breaks quite fast with such amount of requests. For movement you really should use unreliables. There are some well-known methods to make it work relatively reliable by the way.

1 Like

Hi, thank you for reply my question; I spent time learning the document and figuring out how to fix the issue.

For the last point you mentioned of on-tick RPCs reliable, I have been searching for some methods to replicate, such as “LeanAngle” to additive in locomotion, the value is often updated in the game, but there are not many solution posts on forums. Could you share any well-known methods to replicate this kind of value?

Well, i’m indeed forgot that though they are “well-known”, they aren’t easily searchable. The two links i had in mind is:

If you’re willing to use the built-in CMC, I strongly suggest reading the ‘Networked Movement in the Character Movement Component’ article. It provides a lot of valuable information on how it works internally.

Additionally, this series of video tutorials expands on the previously linked tutorials, explaining how to extend CMC to correctly implement networked mechanics and how it functions in general.

This should provide you with a very strong foundation when working with CMC.

1 Like