I’d like to hear some opinions about RPCs and OnRep. In my project I am shifting more and more towards using OnReps instead of RPCs. It just seems much more reliable. And often RPCs can potentially desync the game between machines, especially when you’re thinking about re-connecting to a game or generally joining a game in progress, where all previous RPCs are “missing”. Another problem with RPCs is that necessary replicated data usually isn’t available on the client in time, when you change it right before the call.
My concern about replication is that I don’t know how fast it is. Right now I’m wondering whether I should replicate a character firing a weapon (continuously) through a state-variable with an OnRep-function or with an RPC. I mean, it’s a very time-critical thing, so it should be received on clients as soon as possible. On the other hand, if a player joins the game after a character has started firing using an RPC, he will never see it until that character stops and starts again. In that case, if I didn’t write certain “pre-cautions”, I guess a stop-fire RPC without a prior start-fire RPC might even crash my whole simulation…
Any thoughts about this? And is it possible to tell the engine to replicate a single variable immediately? I know there are actor-settings somewhere that determine the general replication frequency (at least I think so…), but increasing it to the maximum would probably be a waste of performance, especially when there are just one or two of these time-critical variables.
edit: so, there is this function AActor::ForceNetUpdate(). When I use it right after changing an actor’s replicated variables, will it reach the client as quickly as an RPC would?