Replication, structs and arrays

Am I right in assuming that both structs and arrays always get replicated as a whole and not per member-property or element?

I think this is really something that needs improvement.

Many times a struct is the only sensible way to organize your data in. Think of a character stat and skill system for example. It can have dozens of values and “derived” values and would ideally also contain things like health that potentially change very frequently. Replicating the whole struct every time a single value changes will force me to use bad style and put lots values “loosely” into an object, which makes re-usability impossible.

Please tell me I am wrong and structs know what to replicate and what not…

I know for a fact that in a struct only UPROPERTY’s can be replicated in C++, don’t know how it works in BP though.

The question isn’t so much whether the data-members get replicated or not, but if they get replicated “selectively” (only the ones that actually changed) or if every struct (and array) always replicates as a whole, producing lots of redundant network traffic.

Or are you suggesting I should only mark those struct-members UPROPERTY() that I want replicated and leave the rest “hidden” from the engine? That’s an interesting idea. I’d rather have all variables replicate though, but not redundantly.

I’m still interested in this…

Let’s assume I have some kind of “game event” structure that has a date-time member, maybe a text, maybe some coordinates and references, which are needed to make changes in the world by the clients that can’t be replicated directly (because of non-replicated actors, basically), only reconstructed based on the event-info. If I would send these as a parameter of some server function every time an event occurs, then anyone joining the game afterwards will never receive these events. This leaves me with two options, the way I see it. I can either use a seperate replicatable UObject for each event or have a replicated array of event-structs in the game-state (or wherever). Now, if the number of events will be in the thousands, then the limit of replicatable objects would be reached at some point using UObjects. Besides this kind of object spam just can’t be right. On the other hand, if I use structs inside an array, and new events are added almost every second, then my fear is that the whole array will be sent to clients every time, even though only the last element would have to be sent. So then these thousands of structs inside the array would be broadcast to every client every time a new event gets added and probably kill the network traffic sooner or later.

Can anyone confirm this? Or maybe the engine internally knows what array-elements need to be sent after all??
If not, I guess I would have to make it more complicated and “manually” have the number of received events tracked for each client and use a function to send only new structs individually or in small arrays as parameter to individual clients. But I wouldn’t bother with that unless I have to.