I am planning on releasing an rpg game that will have future versions down the road (for adding new quests, etc.). Will this be possible without breaking the previous saved games as long as I don't edit the already existing variables? Is there a way to perhaps add a new StoryInit passage as a sort of append to the original StoryInit? (e.g. a StoryInit for a Chapter 2 while the original StoryInit is Chapter 1) to make sure I don't edit anything that could ruin the saved games?
Thank you so very much! (I'm using Twine 2 and Sugarcube 2's most recent versions)
Comments
There will be two sections within this post:
If you are not comfortable with using JavaScript to modify loaded saves
To preserve the validity of existing saves, there are few things that you must not do:
Things which should, generally, be okay to do:
Things which should not invalidate existing saves, but will not automatically integrate new state into an existing playthrough:
Yes and no.
Let me explain the "no" first. Technically, no. There may be only one StoryInit special passage and modifications to existing story variables and/or the addition of new story variables to it will not be propagated into existing playthroughs.
And now to explain the "yes". Effectively, yes. The StoryInit special passage is really just a passage which is silently evaluated once at the start of a playthrough—i.e. sometime before the starting passage is evaluated. You may simulate the behavior by doing something like the following within the PassageReady special passage: Basically, if the specified variable does not already exist, then the initialization passage for the content update will be evaluated. You only need to gate that behind one of the new story variables—which, obviously, must be initialized within the content update initialization passage.
NOTE: That will not integrate the new story variables into the past history. They will be initialized at the moment of the load and be available from that point onward.
If you are comfortable with using JavaScript to modify loaded saves
WARNING: This is an advanced topic. You can destroy players' saves if you do this incorrectly.
You can do whatever you want. SugarCube allows you to define separate callback functions for both the creation of new saves and loading of existing saves, which allow you to make modifications to the saved state.
You would add the new variables to the StoryInit special passage as normal, so that new playthroughs would have them. To update existing saves, you'd assign a callback function to the Config.saves.onLoad property, which would perform the necessary history modifications.
I'm not going to describe this in detail at the moment because, as noted, this is an advanced topic.