generated from PhoenixEntertainment/SystemPackageTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
V3 rewrite #6
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
Merged
Merged
V3 rewrite #6
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SpathiTS
approved these changes
Jul 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR completely rewrites the data system. This rewrite was needed for quite a few reasons:
Data is now cached as tables instead of value objects.
In prior versions of this system, data was cached in replicated storage as value objects. While this allowed for easy replication, it ate more bandwidth than it needed to, and it was hard to work with the data (had to convert to table form, then back to valueobject form,
.Valuespam everywhere in the game's code). Data is now simply a table, making it much more robust and easier to work with.Data is now written & read via "data handlers", which serve as an interface between the game and the raw savedata.
Previously, data had to be manually read & written to. E.g. if a game system wanted to read the player's coin balance, it would either have to directly access
Data.Currency.Coins, or call a wrapper API likeMarketService:GetPlayerCurrency(). Both had their own sets of problems. Now, this is handled at the level of the datasystem. Any part of the game can simply callReadDataorWriteDatawith the relevant "handler". No wrapper APIs needed, no ref updates are needed, etc.Replication is now more efficient.
The old system used value objects for replication, now replication is diff-based. When the server makes a change to the data, the name of the handler it used to change the data is replicated the client. The client then locally runs that handler, 1:1 taking the steps the server took to modify the data. This is similar to how replication with a state-store library like rodux would work.
Code that reads data can no longer accidentally write to the data.
In the previous version of the system, if a piece of game logic gets a reference to the player's data for the purpose of reading it, but due to a bug wrote to the reference, the player's data would be updated. Now, if the game calls
ReadData, it physically cannot write back to the player's data accidentally without an explicitWriteDatacall. This is accomplished by returning a copy of the player's data whenReadDatais called instead of a direct reference to the cache table. This does come with a performance cost, but in most scenarios the cost is acceptable as savedata isn't (and likely shouldn't) being written to constantly every frame.