Generalised method for waiting for replication

I’ve been prototyping a turn-based game with no networking functionality, and I’ve begun to start adding networking to it because it’ll be the only way it’s played. I’ve gotten my head around most of the networking concepts, and the biggest issue right now is using functions across the network.

In earlier prototypes functions worked great - they returned values and execution waited for the function to complete. A good example is a purchasing action -

  1. a UMG widget blueprint has a purchase
    button, which calls a function in
  2. the possessed player blueprint that performs checks and makes
    changes to variables in a
  3. simulation blueprint.
  4. The possessed player blueprint function returns a success message to
  5. The original UMG widget which then displays it, and calls
  6. an update function that gets variables from relevant simulation
    blueprints and displays them

The issue is that because the purchase function now has to have an event call it (so that the event can replicate to the server and the function can run on the server), the update function at the end gets variables from the local replicated copy of variables/object, and the replication takes time, the update function doesn’t display the latest value of variables - the changes on the server aren’t replicated in time for the widget to get the latest variables.

What I’m looking for is a generalised way of telling an execution path to wait until selected local variables have been replicated from the server, and to only continue once that has happened. I’ve kind of done this using an onRep_ function earlier (only creating the HUD once it’s been called, etc) but that only works for individual variables, and it gets messy because UI functions have to be put into simulation blueprints!

Or a way of having functions called from a client execute on the server, give a return value, and have the execution wait like they would locally.

Ooooor a way to create UMG widgets on a dedicated server (so that all function calls would natively happen on the server) and then somehow have them redirect to the client.

Has anyone else faced this issue of getting clients to wait on server return variables, and if so, how did you get around it?

My current line of thought is to call the function locally and have it performed on all locally replicated objects/variables (it’s turn based so I can afford to replicate everything to clients) to get the return value, and then call the same function on the server to make the change. The only things this will add to the current workflow are a few more event calls.

I just ran into this issue. I ended up using RepNotify on the variable to do anything on the client since that gets called when the variable is updated in the clients from the server