HaywireInteractive / OnAllFronts-Public

UE5 MilSim FPS / RTS Game (formerly ProjectM)
MIT License
115 stars 22 forks source link

Reduce replication cost of soldiers when level starts #927

Closed Leroy231 closed 1 month ago

Leroy231 commented 4 months ago

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: