So, I’m interested in making a series of games, with installments which are released independently; I want the player to have the option of starting a new game in a sequel by loading a completion-save-file from the immediately-previous game in the series, and have that affect things (i.e. what choices you made, which ending you got, etc).
So far I’ve tried changing
Config.saves.id ad-hoc when saving the file in Chapter 1 and loading it in chapter 2; however, this has two problems:
- The save UI continues to use the same set of save-slots it was already doing: that is, Chapter 1 will continue to use its regular set of save-files, with the completion-file getting a “this was made in the wrong game” when you try to load it, and Chapter 2 will continue to use its regular set of save files: you have to use “Save/Load To Disk”, which is obviously not ideal.
- Loading in chapter 2 loads the save file’s entire history, meaning you’re able to hit the “back” button and get an error to the effect of “this previous passage doesn’t exist.”
Basically, I think the way this would need to work is, there would need to be 1. a way to get an equivalent of
Save.slots for a different specified game, so that the game could iterate through it and test it for suitability, and 2. a version of
Save.deserialize() which returns a save-object instead of actually loading it.
So … yeah. Is any of this remotely possible?
I have a macro set for this. Custom Macros
Hm … That seems to solve the import/deserialize part, at least! That just leaves the
Save.slots part of the equation.
Honestly, trying to shoehorn the save from one game into another game is never going to work properly.
A far better solution would be to give an option to export a JSON file (which has only the data that you actually need) at the end of the first game, and then an option to import that JSON file at the beginning of the second game. This solves all of the problems that you’ve been running into, which is caused by all of the data that you don’t need.
I have some load/save sample code which can help people out with this, which I’ve been working on for a while, it just needs a few finishing touches. I’m still recovering from surgery and it’s taking a bit longer than I expected to finish up, so I should have it for you tomorrow.
Just read the data and grab what you need.
I know, I know! I’d just prefer something more convinient than “download and then upload”, due to the SugarCube documentation’s dire warnings about getting it to work on mobile. Like … “access the
Save.slots of a different game”, kind of thing. Ah well …
It took a little longer than planned, but you can now check out the “Loading and Saving Data Files” section of my Twine/SugarCube sample code collection for code showing how to do what you need.
Basically, just use that code at the end of your “Chapter 1” game to save whatever data your “Chapter 2” game needs, and use that same code at the start of your “Chapter 2” game so you can give players the option to load in that “Chapter 1” data.