Authority and Replication UE5

Chris Didier
2 min readJan 5, 2024

From what we saw last time if you were the client you could run right through the cube, but if you were a server player you could stand on it.

We need to get an understanding of Actor Authority a key concept to multiplayer replication. The actors are key bit of replication. These are what are updated between client and server.

  • If you had a green and red cube on the server and client, and wanted to replicate the green cube’s color and position to the client, but not the red cube. The server will update the position of the green cube the client will get the green cube update. The red nothing will change on the client and if they disagree the server will set the client back.
  • We now want to replicate the cube movement from the cube in c++ we programmed to the clients as well.

Now back into the header we will add a begin play. Over in the cpp we will add a super begin play, and a set replicate to tell the server to replicate the cube to the client and replicate the postition as well.

Next make sure the replication is coming from the server and not the client as a client cannot replicate.

So make sure it has authority to replicate, compile and run.

Now if you move the cube only on the client, the server cube does not move, but the client cube does. This can be done, by just saying it does not have authority to move the cube’s location.

If you launch the game you will see the server cube does not move while the client cube does, but the server cube is the true cube location.

We are going to remove the ! as we want the server to update the client.

Next Time: Widgets for FVector Properties

--

--