I’ve made some libraries (as I did not found what I was looking for) to help me create a mobile multiplayer game, my main goal is to focus on scalability and maintainability.
Proteus: a modern automatic and efficient serializer which supports inheritance and generics.
Iris: Uses Proteus, a frame-based UDP framework that handles client health checks and packet loss recovery.
It’s been a couple of days since these libraries are stable, I’m now sure they are mature enough for me to share them and I’m really looking forward to hear about what you think and get your feedbacks to improve these projects.
What I’ve found to be true in most realtime games I’ve worked on is that you want two forms of serialization if you want to optimize for productivity as well as performance. protobuf is nearly impossible to beat as a default for high productivity and also integration with various server side libraries/frameworks that support it, and then switching to custom for things that are being sent at a high rate. With the later you will often still use varint encoding but your own no GC implementation, combined with some bit packing here and there.
It’s impossible to make the custom stuff generic, because it’s inherently context specific. Ie you can create good abstractions for bit packing, but your actual data can have bit packing and varints and then who knows maybe some custom compression, all interleaved in ways that fit the specific context.
The data you send frequently stays rather constant as the complexity of your game grows which is why optimizing for multiple paths can give really good returns in productivity. We have over 100 data models and around 50 message types. 4 messages types for data that is sent at a high rate, which is mostly movement and combat related. We also have 2-3 more that are very data heavy but infrequent,where we bit pack but still use protocol buffers as an envelope to keep it in the ‘default’ flow. Since our customized bit packing flow for receiving/dispatching messages requires more setup. In a common envelope the bit packing can be encapsulated at the feature level.