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 -
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?
asked Nov 07 '15 at 04:13 AM in Blueprint Scripting
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
answered Dec 30 '15 at 02:43 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here