Hey folks!
I am currently trying to implement a NetDeltaSerialize function for a struct, but it does not seem to behave the way I expect it to. Unfortunately, the FFastArraySerializer seems to be the only example in the entire engine to ever use net delta serialization and it has a huge amount of complexity where I am not entirely sure which parts of it are necessary for a more simple case and which aren’t.
From what I understand, the minimum steps for net delta serialization should be:
- When writing:
- Check which values differ compared to the OldState passed in via the FNetDeltaSerializeInfo (or send everything if we don’t have an old state yet)
- Copy the current values to NewState in FNetDeltaSerializeInfo so we can use them as a reference the next time
- Write all the changed values to the provided Writer archive
- When reading:
- Read all the changed values from the provided Reader archive and apply them
This seems to mostly work in my tests, BUT in bad network conditions some sent changes can get lost and will never arrive on the client. Alternatively, some changes seem to also be sent multiple times and arrive on the client multiple times. This will inevitably cause the state of server and client to drift apart.
Is there some mechanism I’m missing here that should allow us to handle this? Is it even feasible/reasonable to implement delta serialization without building upon FFastArraySerializer?
Thanks in advance,
Dave