Releases: PhoenixEntertainment/PlayerDataSystem
v3.0.0-rc.1
What's Changed
- V3 rewrite by @NobleDraconian in #6
Full Changelog: v2.1.0...v3.0.0-rc.1
This release features a complete rewrite of the data system:
-
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 accessData.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 callsReadData, 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.
v2.1.0
What's Changed
- Add
Formatsupport to clientGetDataAPI by @NobleDraconian in #4
Full Changelog: v2.0.0...v2.1.0
v2.0.0
Bump package to 2.0.0