Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats rewrite #144

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Stats rewrite #144

wants to merge 8 commits into from

Conversation

mwnDK1402
Copy link
Contributor

@mwnDK1402 mwnDK1402 commented Sep 26, 2024

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.

I'll be reworking the interface for BaseGameProgressHandler, in order to allow for specials to be passed in.

Refs: https://discord.com/channels/681641241125060652/1270983206921044063
This will make it easier to transition into including the special used as an argument.

Refs: https://discord.com/channels/681641241125060652/1270983206921044063
When shown in the profile, they are not ordered.

BREAKING CHANGE: GameProgress will be reset with this commit.
Refs: https://discord.com/channels/681641241125060652/1270983206921044063
Previously, they were serialized as doubles, which causes inaccuracy for large values.
`longAsString` is readonly to signal that it should not be changed.

Refs: https://discord.com/channels/681641241125060652/1270983206921044063
@mwnDK1402 mwnDK1402 self-assigned this Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant