Hi, im new to replication in UE4 and im having some problems, some variables are not replicating.
I need to send the mouse location from the controller to the pawns so them can use it, but only the server’s are being replicated on the other clients. The clients variables are being only locally displayed.
I’ve used basically the same system on other variables, but only this one doesn’t work. The variables and the character are marked to be replicated.
Ouch. A Reliable Multicast to display a variable value every tick? That will contribute to flooding your connection eventually.
If the variable is replicated, and only set it on the server, it will update on the clients, just maybe 1 to 5 times a second, and not every tick, but updating anything every frame across a network is not realistic or performant, even if it WAS possible for network packets to keep up with 60 FPS.
I recommend using a Timer event to send those Server RPCs from the Clients, on the order of say, every 0.2 seconds at the most, and maybe not make them Reliable unless they absolutely must not miss any update ever, and you can Lerp between the last known updated position to the current one to smooth things out. You might need that smoothing anyway if you’re going to use this value for a visual or mechanical representation, since delays are inevitable in networked games, even if you (or sometimes especially if) you spam the network with an RPC every tick.
But I suppose we better focus on just making it work for now and iron out those details after.
Performance gripes aside, it looks like it should work, even if not optimally.
I wonder if all your RPCs are actually firing where you expect them to. Can you put in some break points or PrintString nodes to confirm?