cBournhonesque / lightyear

A networking library to make multiplayer games for the Bevy game engine
https://cbournhonesque.github.io/lightyear/book
Apache License 2.0
464 stars 47 forks source link

Bincode instead? #489

Open simbleau opened 4 months ago

simbleau commented 4 months ago

What's the reason for using bitcode instead of bincode, which is arguably more mature and has wider adoption in production scenarios?

msvbg commented 4 months ago

https://github.com/cBournhonesque/lightyear/pull/452

simbleau commented 4 months ago

Gotcha, so this is a docs issue then. The README still specifies that bitcode is used.

cBournhonesque commented 4 months ago

The main reason was that bitcode is way more performant and efficient than bincode. However it doesn't support serializing/deserializing directly from impl Read or impl Write so it was a bit tedious to maintain. You're right the readme should be updated

cBournhonesque commented 4 months ago

Another benefit was that bitcode used bitpacking to reduce the bandwidth (a bool would only take 1 bit) vs 1 bool takes 1 byte in bincode