What is the best way to replicate a value that changes often?
Basically I want to replicate the location and rotation of a Pawn, that does not affect gameplay. It's just so that the players can see each other. So I need to replicate the value from the client controlling the Pawn to the server. From there I also need to replicate the value to the clients.
So what would be the best way to replicate the value from client to server?
Secondly, what would be the best way to replicate the value from server to clients?
The possibilities are pretty much the same, with the exception, that I could also use a replicated variable.
I guess the question really boils down to how do reliable functions compare to unreliable functions? And how do replicated functions compare to replicated variables in terms of network load? Maybe some of you have a rule of thumb, that they would like to share.
asked Sep 27 '16 at 03:47 PM in Using UE4
I am pretty certain what the best solution for my case would be and what I am going to do. But keep in mind that this solution is not the best solution for every case, so try to consider all the different options in your case.
So for the server to clients replication, I will override PostNetReceiveLocationAndRotation() on my Pawn, so that the Client does not do anything, when he receives an update, since the Client acts authoritative in my case, because the Pawn has no direct Gameplay impact, like the observing Pawn in a strategy game. So that method would look something like this:
For the replication from the client controlling the Pawn to the server, I will use an Unreliable Function every tick. But I will also keep track of how often the function was with the same Location value. Kinda like this:
Of course I would have to change the Threshold based on how well this works.
answered Sep 27 '16 at 05:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here