Bannerlord-Coop-Team / BannerlordCoop

MIT License
258 stars 51 forks source link

Provide the best serialization and compression libraries for the whole project #23

Closed evorios closed 2 years ago

evorios commented 4 years ago

Because we work with network in short time we need effectiveness utilities for serialization/deserialization and compression/decompression. I done some research for it.

Binary and json serialization/deserialization

Good overview Good overview

Binary

For simple types we have NetPacketProcessor from LiteNetLib

For arbitrary objects looks good follow libs:

Json

Utf8Json without a rival

Compression

LZ4 without a rival

evorios commented 4 years ago

related with #22

araex commented 4 years ago

Thanks for the overview.

I would argue against using a serialization library that uses explicit schemas (such as FlatBuffer) since this is more like to cause additional work with game updates. We should stick to a schemaless approach.

Additionally, i think it's important we pick a library that generates the serializer code once and is then able to reuse the generated code. We can easily spare the initialization time when booting up the game.

From just a quick glance Apex, Bois and GroBuf all fit those criteria. We could put the serializer code for #22 behind an interface and benchmark the performance for a few of those libraries with actual game objects. @garrettluskey already did some serializer work, maybe he's got some input as well.

garrettluskey commented 4 years ago

I have only done work with creating serializable classes. How we package them is still up for debate.

evorios commented 4 years ago

Only now, after more intensive work with the transfer of objects between the server and the client, I see that my research is not relevant, because the RailBitBuffer and RailRoom is the most convenient mechanism for translating objects.

garrettluskey commented 4 years ago

I disagree. Although railgun may provide some serialization libraries, it may not be optimal for large object transfer. Railgun, from my understanding, is used to synchronize the server and clients. The object we would have to initially transfer such as a character created when joining needs to be transferred separately.

garrettluskey commented 4 years ago

Adding on-hold as this is a lower priority than synchronization.