I’m developing my own game from scratch, and up until now I’ve been using json (nlohmann) for de-/serialization. My game generates a lot of objects procedurally (think of it as Minecraft in size) and objects load/unload pretty slow and occupies a lot of disc space. I’ve seen lots of people recommend creating your custom serialization instead of using something like protocol buffers, but I cannot find much on the subject in terms of general guidlines and principles.

What I’m looking for:

  • Highly performant (probably a format that translates directly from and to the objects themselves?)
  • Simple to extend existing classes with serialization/deserialization instructions
  • Serialization of objects with nested objects
  • Handling of arrays/vectors and primitive types

I might be thinking wrongly on these wishes, please tell me if so =)

I’ve been pondering and searching for guidance but not finding anything concrete. I thought that there’s probably some of you smart people that have experience with this!

  • @existential_crisis
    link
    English
    21 year ago

    Flatbuffers! It’s like protocol buffers, but much leaner. It was actually specifically designed for games, and meets all your requirements.

    The only challenge is that, like protocol buffers, it requires an extra compilation step and involves code generation. Depending on your build system, that could be a challenge.

    • @[email protected]OP
      link
      fedilink
      English
      21 year ago

      Ooo nice! I’ve read a bit about it but couldn’t tell the difference from protobuf. Thanks for the recommendation!