[Blueprints] -
Is there a way to ensure that references to actors and objects are maintained and replicated, but their internal variables are only replicated to the owners of that actor? For example:
I’m developing a strategy game where players construct city entities on a global map. Having the servers reference to those actors replicate is so phenomenally convenient that it’s hard to put into words, but I want the internal data (technology levels, income, civilian count, etc) to only be replicated to the owner of that object - as this data gameplay wise is supposed to be kept secret from other players.
A possible solution I have at the moment is that only references and actors are replicated, but none of the internal variables are (aside from cosmetics), and that the owner is then given additional information in an event issued from the server.
I can’t shake the feeling that there is a better solution then that however. Thank you for any advice you can give.
Could I trouble you for a brief description of how to do it?
Thank you for the link, I’ve watched the series before, and just re watched 2, 3 and 4. To reiterate, I would like to know how to make some variables of a specific actor replicate as usual, but some of them to only replicate to the owner.
I’ve just looked into another project again and it really didn’t have the option to replicate a variable to owner only and we actually added that ourselves… and used it ever since in every new project
Sorry. So for an immediate fix the question is what variables / how many and is C++ impossible?
If this is only about a few specific variables replicating them via events might work just fine.
For more in BP only a second actor set to replicate to owner only can work too.
Otherwise it does really make sense to either just set up the variables in a C++ class or add “Replicate to owner” to the list in blueprint if you can manage that.
“Sorry. So for an immediate fix the question is what variables / how many and is C++ impossible?” - c++ isn’t totally out of the question, I just really wanted to avoid it because I’m a garbage coder, but knowing that it’s the solution your team went with gives me peace of mind that it’s probably the best answer. One variable at the moment, a struct of int’s, but I doubt that this will stay the only owner only variable for very long.
Could you give me some advice on how to go about adding the Replicate to Owner functionality to the Replication list? Will I need to build the engine from source etc? Thank you very much for your advice so far!