Saving Data

Hello

I am hoping to get comments as to why we are saving data in so many places as opposed to having a static dictionary with key value pairs. (JSON).

IS there a method of doing this with ONE central data store for all the state in the game?

Is there to much data?

guess I am old school but seems to me having ONE data store is more concise.

Thoughts?

Thanks

Actually, in the end, it is one central data store for all the state in the game.

Our saving system gathers each component’s data, arranged by GameObject then Component. Since each component has it’s own unique needs, you can’t have “one” data field for each thing…

What you’re describing is actually already available to you in the form of the SharedPreferences library built in to Unity. It stores (in string form, parseable to string, int, or float) a key/value pair…

So what would our data look like, and how would it be retrieved when we don’t have a fixed idea of what each component needs to save at build time?

Each health component would need access to the preferences, where it would look up it’s UUID/Health (I suppose the key would be UUID-Health, with the value)…
Same with each component along the way… Instead of passing the character exactly the data it needs to restore itself you would be asking each character/component to go find it’s own saved data.

Speaking of Json, you might check out my replacement saving system Saving System Upgrade: Replacing BinaryFormatter with Json.NET - #7 by Brian_Trotter
It still gathers/disperses all of the saveable data from the components, but it does so in a safer format (Microsoft now advises companies not use BinaryFormatter, leaving even some big corporations scrambling for a new data storage strategy).

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms