Before soldiers have done anything (combat is disabled) we have to replicate a lot of data for each soldier because we replicate a FReplicatedMassSoldierAgent for each one. We really don't need all of that data replicated because unless the values have been modified on the server, the client can use default values. It would be nice to use a TOptional for the properties in FReplicatedMassSoldierAgent (assuming that would serialize to 0 bytes if it's not set), but TOptional is not valid to use with UPROPERTY. Instead we should find another way to serialize to 0 bytes when we just want the default values. One option:
[ ] Change the TagContainer, CharacterState, and Health properties on FReplicatedMassSoldierAgent to be of type TArray<CurrentType>. Then when we detect changes on the server we can add an element to that array.
[ ] Confirm with network profiler before and after changes this approach makes a difference. Use level L_SmallPlayerOnly for this so we know just a single entity is getting replicated.
[ ] Assuming this approach makes a difference, update our Mass Replication code generator so that it generates the code which was manually modified.
Before soldiers have done anything (combat is disabled) we have to replicate a lot of data for each soldier because we replicate a FReplicatedMassSoldierAgent for each one. We really don't need all of that data replicated because unless the values have been modified on the server, the client can use default values. It would be nice to use a TOptional for the properties in FReplicatedMassSoldierAgent (assuming that would serialize to 0 bytes if it's not set), but TOptional is not valid to use with UPROPERTY. Instead we should find another way to serialize to 0 bytes when we just want the default values. One option:
TArray<CurrentType>
. Then when we detect changes on the server we can add an element to that array.