Hi Everyone! I've got another update, and while this isn't a huge update, it took a lot more time to get working properly than I had originally thought.
TL:DR - Save system can now merge in from the template if there is an update, lots of little bug fixes
Below is the full story:
Update - This update was a challenging one, mostly because I had to fight a little bit with the LitJSON library to have it do what I wanted.
The trick was to get the LitJSON object to merge in my save template with the current save file for when I do updates to the game and add new fields. If the field doesn't exist in the save object and I had tried to access it, the game would throw an error and things wouldn't work right.
This new part of the save system allows me to edit my save template, and when an update of the game goes out, if the player has a save file this will update it to the new version. Since it doesn't hurt to have fields exist in the save file, I can leave things in the save that aren't in the template, but not vice-versa.
I'm going to put the code for that I'll be talking about above the description so you can follow along:
First we have MergeTemplateWithSaveFile(), and what this does is start the process. I read in a copy of the save template, and at the highest level using the JsonData object (LitJSON specific) I can pull all of the keys at the level I'd like. Since we're at the root of the object, I'm pulling all of the keys within the first set of curly braces. Next, using a foreach loop, I'm pulling the key out and passing it in to my MergeLayer function that takes the key, and both JsonData objects at the level I want to parse through the keys.



What's Next - To finish the save system, I'll need to make sure making changes in the save file is working, as well as adding new items to the objects in the save file based on events. From there, I had /u/CybixStudios play through the game and give some feedback on the controls, so that's going to be getting updated before I start working on the layout of the next level!
That should do it for this update, and I'll catch ya next time!
-TJ