What is the best way of replicating this array of structs?

Hey @Sezze!

I know your question is a couple of years old, but I have a better solution to this issue

So, what solution am I talking about?

  • Fast TArray replication (namely FastArraySerializer).
  • Tada! :smiley:
  • Spoiler: It does come with a few drawbacks

The pros:

  • Changing or deleting an element somewhere in the middle of the array does not instigate the replication of all the elements following the changed/deleted element.
  • One of your requirements: It allows events to be called on the Client when an element changes
  • Perfect for large datasets

The cons:

  • Elements which change have to be marked dirty explicitly
  • This could be a deal breaker: The order of elements in the array is no longer guaranteed to be the same on both the client and the server

How can you implement it?

  • See FastArraySerializer.h for detailed instructions in the Engine source code

Hope this helps!

2 Likes