New version in App store and game state

I have no idea how app updates in the various app stores work.   Let’s say I put out a new app in an app store like from version 1.0 to version 1.1 and add some new levels or fix some bugs.  Can someone explain how the new code is deployed and how it might effect the saved game state of the current user?   

Currently, I am using GGdata to save a person’s gamestate to a json file and then just read it back in when the game starts again.   But if the app in un-installed all the gamestate info gets deleted with it.  

I need to understand what happens when a game is updated and not re-installed.  What are people doing to save the current state a user.  This assumes of course that I don’t have a remove server active to pull user data from. 

Hi laura.
An update should of course not affect saved game files, provided they are stored in persistent directories.
Any compatibility between app versions and saved files is something the developer need to handle in code.
I dont know the gg save you are using but if all you save is a json file then thats very easy to directly in lua yourself.

You can store a version number in your saved data, or look to see if some new value you’re going to be saving exists or not and decided if you need to update the saved data.

FYI This may be the #1 cause of apps crashing after an update: expecting some value in a save file that isn’t there and your app crashes trying to access the data value.

In all three main app stores, you’re going to upload a binary build with a higher version number.  For people with Auto updates on, they will get them when their device updates. For people without auto updates, they may never update your app.

Rob

The simplest way for you to test “what will happen” is to install the version that is currently available from the store, and then install your updated build directly over the top (I would advise that you always do this when preparing an update for release). That way you will have the exact same experience as existing users. 

It may sound obvious to do that, but it’s really easy to forget that you’ve added a new save data value that wasn’t in previous builds (as Rob mentioned) and so it’s worthwhile doing this just to be sure. When I add new save data elements to my code, I put default values as fallbacks:

mySaveData = loadSaveData() --new values which were added after initial release mySaveData.someNewThing = mySaveData.someNewThing or 100 mySaveData.anotherNewThing = mySaveData.anotherNewThing or "hello"

This way it will use the data if it is present in the save file, otherwise it will be given a non-nil default value.

updating an app does not affect any files stored in sub folders of your app - like documents or cache.

cache folder is obviously cleanable by the OS if it needs to

Hi laura.
An update should of course not affect saved game files, provided they are stored in persistent directories.
Any compatibility between app versions and saved files is something the developer need to handle in code.
I dont know the gg save you are using but if all you save is a json file then thats very easy to directly in lua yourself.

You can store a version number in your saved data, or look to see if some new value you’re going to be saving exists or not and decided if you need to update the saved data.

FYI This may be the #1 cause of apps crashing after an update: expecting some value in a save file that isn’t there and your app crashes trying to access the data value.

In all three main app stores, you’re going to upload a binary build with a higher version number.  For people with Auto updates on, they will get them when their device updates. For people without auto updates, they may never update your app.

Rob

The simplest way for you to test “what will happen” is to install the version that is currently available from the store, and then install your updated build directly over the top (I would advise that you always do this when preparing an update for release). That way you will have the exact same experience as existing users. 

It may sound obvious to do that, but it’s really easy to forget that you’ve added a new save data value that wasn’t in previous builds (as Rob mentioned) and so it’s worthwhile doing this just to be sure. When I add new save data elements to my code, I put default values as fallbacks:

mySaveData = loadSaveData() --new values which were added after initial release mySaveData.someNewThing = mySaveData.someNewThing or 100 mySaveData.anotherNewThing = mySaveData.anotherNewThing or "hello"

This way it will use the data if it is present in the save file, otherwise it will be given a non-nil default value.

updating an app does not affect any files stored in sub folders of your app - like documents or cache.

cache folder is obviously cleanable by the OS if it needs to