Make save files more "readable" & DialogueSystem w/ autosave

Discussion and help for Easy Save 3
Post Reply
onpocket
Posts: 3
Joined: Fri Apr 05, 2019 1:19 pm

Make save files more "readable" & DialogueSystem w/ autosave

Post by onpocket »

Hello, i have recently acquired Easy Save asset and after doing some tests with it, i've been wondering if is there any way of making the save files more "readable". With this i mean, to save information in the files so that a person could easily interpret it, and check which information belongs to which system, for example, Dialogue System data vs. regular GameObject data. I know that there is the key system that allows you to keep stuff more or less organized, yet i still get the data in one single string. Is there any way to add, for example, time stamps to the saved data?

I have also been trying to save all data from another asset ("Dialogue system" from PixelCrushers) with Easy Save 3 autosave feature, and i keep getting this error when i start the game:

Code: Select all

FileNotFoundException: File "C:/Users/[User]/AppData/LocalLow/DefaultCompany/DialogueSystemEasySave/SaveData.es3" could not be found.
ES3.Load[String] (System.String key, .ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:265)
ES3AutoSaveMgr.Load () (at Assets/Plugins/Easy Save 3/Scripts/Auto Save/ES3AutoSaveMgr.cs:45)
ES3AutoSaveMgr.Awake () (at Assets/Plugins/Easy Save 3/Scripts/Auto Save/ES3AutoSaveMgr.cs:59)
This error does not stop the game from running, as it still generates the save file afterwards and also only happens the first time. After the first save file has been generated, this error stops showing up. But still i would like to get rid of it! Here's my code integration to save all the Dialogue System data with Easy Save 3 auto save:

Code: Select all

using PixelCrushers.DialogueSystem;

...

public void Save()
	{
		if(autoSaves == null || autoSaves.Count == 0)
			return;

		var gameObjects = new GameObject[autoSaves.Count];
		for (int i = 0; i < autoSaves.Count; i++) 
			gameObjects [i] = autoSaves [i].gameObject;

		ES3.Save<GameObject[]>(key, gameObjects, settings);

                // Saves the Dialogue System data
		ES3.Save<string> ("dialogue", PersistentDataManager.GetSaveData (), settings);
	}

public void Load()
	{
		ES3.Load<GameObject[]>(key, new GameObject[0], settings);

                // Applies the previously saved data of the Dialogue System to the current dialogue
		PersistentDataManager.ApplySaveData (ES3.Load<string> ("dialogue", settings));
	}

...
Is there any better way of doing this?

PS: i have only pasted the relevant bits of code, which are the one's in which i've added code.
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: Make save files more "readable" & DialogueSystem w/ auto

Post by Joel »

Hi there,

JSON is generally the most readable way of storing structured data. To make it more readable you could run it through a JSON formatter. There is a feature request for this here, but in the meantime you may be able to find a JSON formatting library. For example, this one, though this is unaffiliated with us.

Alternatively if you're only storing primitive types, you might want to try storing your data in a CSV file as described here.

Currently the only way to add timestamps to data would be to store it as a separate key.

With regards to the Auto Save error you're getting, the line numbers don't seem to match up with the latest version on the Asset Store. Would you be able to put your Assets/Plugins/Easy Save 3/Scripts/ folder into a compressed zip and PM it to me?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
onpocket
Posts: 3
Joined: Fri Apr 05, 2019 1:19 pm

Re: Make save files more "readable" & DialogueSystem w/ auto

Post by onpocket »

Hello Joel,

Regarding the JSON formatter, i will try to see which one applies best to my case.

I have sent you a PM with the files that you requested, please keep in mind that i have changed "ES3AutoSaveMgr" in order to accommodate my wish of saving Pixel Crusher's Dialogue System data.


All the best,
João
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: Make save files more "readable" & DialogueSystem w/ auto

Post by Joel »

Hi there,

I'm afraid I can't assist with modified script files. However, in your case the code you have added does not check whether the file exists before loading. You can either supply the defaultValue parameter, or you can use ES3.FileExists.

However, I strongly recommend that you do not modify the files included with Easy Save as these will be overwritten when you update. Instead I recommend you create a basic script to call your code using the Awake and OnApplicationQuit methods.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
onpocket
Posts: 3
Joined: Fri Apr 05, 2019 1:19 pm

Re: Make save files more "readable" & DialogueSystem w/ auto

Post by onpocket »

Hello Joel,

I will keep that in mind! Thank you.

Best regards,
João
Post Reply