this post was submitted on 30 Jun 2023
7 points (100.0% liked)

GameDev

638 readers
1 users here now

A community about game development.

Rules:

More rules might follow if they become necessary; general rule is don't be a pain in the butt. Have fun! ♥

GameDev Telegram chat.

founded 2 years ago
MODERATORS
 

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!

you are viewing a single comment's thread
view the rest of the comments
[–] existential_crisis 2 points 2 years ago (1 children)

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] 2 points 2 years ago

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