How do I force replication of property, even if value doesn't changed ?
How do I force replication on property ?
I want to replicate property, with each replication tick, regardless, of whether that property was changed or not. It's fairly simple struct with one float and one vector. And I need it to be always replicated, to upadte some cosmetic stuff on client.
Right now, client is completely desynced, because updates do not arrive, when there is no changed to property (and there won't be always changed in property, but there should be always updates on UI).
asked Jul 23 '14 at 10:04 AM in C++ Programming
Try this (Engine version 4.1):
Add Replicated tag to your propety:
Define replication in cpp file:
Header definition is not needed for this method. Hope this help. Details: WIKI
answered Jul 23 '14 at 10:50 AM
If you really want to do it this way, as per our conversation through comments, you could use a
You create a function that gets called on the server from the client, and another that gets called on the clients from the server. Just call this from your Tick function.
THIS is the main page for functions and their specifiers from the docs.
THIS is the Server RPC information from the docs.
THIS is the Client RPC information from the docs.
Edit: the Client RPC might not do what you want...
Edit2: Take a look at this for damage info LINK
So I read through all of your comments and other answers. I think I have an idea for you to think about for your unique case, consider this:
Stay ahead of the calculation by pre-calculating the damage for the next interval. So right after damage is applied, calculate your next damage and presend it. So basically, send from the server to the client, 1) time for the next damage tick, and that next damage amount.
That is the general gist, of the idea. There is alot more to do with it, but if you understand that core idea, it can help with sync issues. I use a similar technique for keeping animation events timed from server to client in an another project.
Hope that helps. ;)
answered Jul 24 '14 at 11:01 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here