Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Storage using Flatbuffers
Flatbuffers allows us to define our stats in a format which is backwards compatible when these guidelines are followed.
Runtime classes can be generated, which allow for strong typing that can be easily kept up to date with the schema.
For scenarios where strong typing is stifling and requires lots of boilerplate, Reflection and code generation can be used to make developer lives easier. (Example: With strong typing, expanding stats to handle another built-in map would normally require modifying existing code. We can write a gode generator which reads all maps and updates the stats schema accordingly.)
The save file is at least 100 times smaller than JSON, and much faster to read and write.
Other Use-Cases
I'm also aware of how the extremely fast serialization and deserialization, along with the tiny size of the serialized data can be beneficial for sending data over the network. Flatbuffers don't just have to be used for our stats, it can also be used to optimime the network portion of the game.