Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

About adding updates to a released Twine game

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

  • edited October 2016
    Preface. I had minor surgery today and I'm currently on pain medication, so I could be a bit loopy.

    There will be two sections within this post:
    1. If you are not comfortable with using JavaScript to modify loaded saves.
    2. If you are comfortable with using JavaScript to modify loaded saves.


    If you are not comfortable with using JavaScript to modify loaded saves
    Coraline wrote: »
    Will this be possible without breaking the previous saved games as long as I don't edit the already existing variables?
    To preserve the validity of existing saves, there are few things that you must not do:
    • Change the connections/links between and/or names of existing passages.
    • Change the logic behind and/or values of existing story variables, within existing passages.

    Things which should, generally, be okay to do:
    • Adding new passages and connections/links to them.
    • Adding new logic for and/or new values to existing story variables, within new passages.

    Things which should not invalidate existing saves, but will not automatically integrate new state into an existing playthrough:
    • Adding new story variables.

    Coraline wrote: »
    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?
    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:
    <<if ndef $newVarFromTheUpdate>><<display "Init For 2016-10-31 Content Update">><</if>>
    
    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.
  • edited October 2016
    Oh, wow. Hope you're doing well post-surgery and thank you for taking the time to answer despite it! I'm not that comfy with Javascript, but I think the other answer will work well for what I'm planning!
Sign In or Register to comment.