I’m currently writing replication code for the transform of a player controlled object (specifically, it’s a VR motion controller). From my understanding, the only way to replicate the transform from the client to the server is through an RPC.
As this object will be moving pretty much constantly, a simple dirty check would have me sending an RPC every frame. Is there anything built into Unreal that would help throttle this automatically or do I need to write my own system?
UnrealNetwork will do its best to handle any replication that is going through the system to be as efficient as possible. This includes doing things like keeping the last state of any variable replication on the server and only sending it to the client(s) if it has changed.
Furthermore, if you don’t want to “overload” the network with any one variable being sent on frame, you can send it as “unreliable”, meaning given high network saturation, the replication could be dropped.
Also, just as a thought, you should be able to replicate a single transform on frame without a big performance hit (unless you are doing this for a big number of Actors). I feel like its one of those situations where you set it up to work and only look into optimization if it becomes a issue.
Here is documentation for Unreal RPC:
Thanks the reply. Knowing that that’s the way that unreliable works is actually super useful. I’m used to unreliable simply meaning that there will be no Ack/Resend flow. The fact that the engine will also automatically drop unreliable messages during high traffic situations is very good to know.
And, yeah, I know a transform isn’t too much (probably around 40-50 bits plus whatever your header and footer size is), but death by one thousand cuts. It all adds up.
To clarify, Unreliable is defined as the following:
The function is replicated over the network but can fail due to bandwidth limitations or network errors. Only valid when used in conjunction with Client or Server.
Replicated function calls can be set to either Reliable or Unreliable where Reliable calls are guaranteed to occur, while Unreliable calls may be dropped during heavy network traffic
My mistake about it waiting. Apparently that is not true.