What if save file changes

Discussion and help for Easy Save 3
Post Reply
jinxology
Posts: 35
Joined: Sat Sep 13, 2014 5:21 pm

What if save file changes

Post by jinxology »

Whenever I add data to my save file, all my users with older save files lose their save games. I know this has been answered, but I can't seem to find it. I track my version as my first field, but how & where do I add code to check version before reading data? Can I edit the ES2UserType_XXX.cs files, or will those be overwritten every time I add more data to my custom save objects?

For example:

Code: Select all

       data.auctions = reader.ReadList<Save_Auction>();
        if (GameController.I.version >= 1.16) {
            data.prestige = reader.Read<System.Int32>();
        }
        data.enduranceCurrent = reader.Read<System.Single>();
The above code works great, but will it be overwritten when I make my next change to the Save_Player type (that's where this code came from)?
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: What if save file changes

Post by Joel »

Hi there,

If you manually modify the ES3Type, any changes in Manage Types will overwrite them. So you will need to type your new Read and Write calls directly into the ES3Type file instead.

Note that incase you were not already aware, Easy Save 3 automatically handles this.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
jinxology
Posts: 35
Joined: Sat Sep 13, 2014 5:21 pm

Re: What if save file changes

Post by jinxology »

I should upgrade then I think, but what does ES3 specifically handle automatically? I'm reading the guide at https://docs.moodkie.com/easy-save-3/es ... -es3types/, and it sounds like if I make changes to the ES3TYPE file, my changes will get overwritten in ES3 too when you update your type.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: What if save file changes

Post by Joel »

Hi there,

In Easy Save 3 you will not need to manually modify the ES3Type file. You will simply need to select your fields from the Types panel.

Unlike Easy Save 2, adding or removing fields from the Types panel in Easy Save 3 does not invalidate any previous save data.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
jinxology
Posts: 35
Joined: Sat Sep 13, 2014 5:21 pm

Re: What if save file changes

Post by jinxology »

Does that mean it no longer just saves the data sequentially? Historically, my save would break when, for example:

+ The user has a save game, version 1.0, with strength, intelligence and dexterity.
+ I add wisdom as a saved stat and push version 1.1 of my game
+ The user downloads version 1.1. When he runs version 1.1, the LoadGame() function tries to read 4 data fields (now with Wisdom included), but the save file only has 3 fields, so it hits End of File.

How does the new version know how many fields will be present? Does it store the data structure and field names along with the save instead of just the data?
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: What if save file changes

Post by Joel »

Hi there,

It indeed stores the field names with the data.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply