[Feature Request] Client-side replication event

Event Dispatchers are a great way to update UI and control the flow of events without requiring potentially costly busy-wait in Event Tick. Set up some Event Dispatchers for when variables change, register some events from your UI, and now your UI only updates when your variables change. Efficient and easy to reason about.

However, the situation gets a little more convoluted when replicating variables. The RepNotify setting for variables triggers a OnRep_VAR function to be called. But only on the server. Similarly, Event Dispatchers cannot be marked as replicated, so Event Dispatchers set up to dispatch in a function/event that changes a variable only work on the current machine (usually server for game-critical variables). This means the flexibility of Event Dispatchers to provide on-demand updating is limited. Currently, I am working around this by marking my variables as RepNotify, then dispatching an RPC to the client from the OnRep_VAR function, which then calls the EventDispatcher on the client as well. This works, but is a bit boilerplate.

Feature Request: A notification of replication to the client would be extremely useful for keeping the client state, UI, and any other events in sync. As far as I can see it, there are a handful of options to accomplish this task:

  • Create a new replication type that would run OnRep_VAR on the server and the client.
  • Allow Event Dispatchers to be marked for replication. Thus, whenever an Event Dispatcher is called, it is replicated as well.
  • Some other mechanism to listen for when variables are replicated to owning client. Perhaps explicit registration for event delegates that listen for when a specific variable is replicated.

Is that c++ bug/feature that OnRep_VAR doesnt work on client?

Because i have blueprint only project and its main way for me to keep client sync with server and its work fine (with the exception of OnRep_VAR isnt called if you add elements to array).

100% sure it getting called with every single type of networking on every client (remote client, listen server, dedicated server and standalone client).

http://puu.sh/qR2P5.png

[2016.08.28-04.57.21:111][520]LogBlueprintUserMessages: [BPAC_Ability_Library_SDC] Server: Hello
[2016.08.28-04.57.21:129][521]LogBlueprintUserMessages: [BPAC_Ability_Library_SDC] Client 1: Hello

As you can see, its even getting called if you overwrite OnRep_VAR in child blueprint. Are you sure object you trying to use is actually exist on the client?

I will do some more testing, but as far as I could tell, in Blueprint, the OnRep_VAR function is only called on the server.

Hmm. This may actually be related to my other bug report ActorComponent does not replicate variables to client. That would likely explain the confusion. I am using ActorComponents to test this, but they are not replicating. Sorry for the confusion, all! It’s likely that these issues are related.