Basic multiplayer replication help for the first person character

Hey,

I am trying to learn how replication works and wanted try and implement it myself so i can understand how it works / edit if need be.

Using the FirstPersonCharacter example it replicates for me automatically other than the pitch. so i have unchecked ‘replicate movement’ and kept ‘replicates’ on. This seems to remove the auto replication for me.

1.png

So im trying to start with the mouse input part of the event graph. And ‘InputAxis Turn’ to start with.

2.png

I believe i have setup the multicast and server cast correctly as follows, but nothing replicates i only have control on the window i have selected:

3.png

I think this is becasue the target is not set and im not sure what to put there?

I tried using ‘Get player Pawn’ but it is obviously based upon the index and there for controls both charcters when replicated like this.

How would i go about solving this, im pretty sure i have the casting setup correctly (or atleast somewhat close) i just do not know how apply the yaw input to the correct ‘FirstPersonCharacters’ respectively.

Any help would be greatly appreciated.

I did also find this on another post which seems to explain the concepts pretty well:

Thanks

Hi, “AddControllerYawInput” and “AddControllerPitchInput” will only do something if the local player controller is executing this, otherwise it will do nothing. Therefore Multicast and RunOnServer makes no sense there.

I never disabled replicated movement on a character, so no idea, but maybe you need to set the rotation manually now via “SetActorRotation”.

You could read this here to get a bit of a feeling of how the character movement components replication works under the hood Understanding Networked Movement in the Character Movement Component for Unreal Engine | Unreal Engine 5.3 Documentation and keep in mind that you cannot properly rebuild this in blueprints.

Thanks, that makes perfect sense.

Turns out i was thinking about it wrongly.

I am rotating locally, therefor i need to get my rotation and send it to the server. The server then needs to tell everyone my rotation and then set it.

I had a read through and also watched through this video:

and

Based on the above i managed to figure it out as follows:

Please note that my ‘FirstPersonCharacter’ has ‘Replicates’ enabled.

Thanks again for the help!