Problem and workaround: Save file size quotas
4 years ago
A few people playing Recovery have reported some errors that start popping up partway through their playthrough that stop them from saving, prompting me to look a little more into this. The system that QuestJS natively uses for saving and loading involves using a dedicated bit of memory for browser apps known as localstorage. This gets around many issues with Javascript permissions (as JS scripts cannot easily access the core filesystem - imagine if any website could just access whatever it wanted on your computer).
However, this creates another issue - localstorage quotas. As it turns out, browsers severely limit the total storage that one app can save to local storage - it's just 5 MB for the ones I checked (Chrome / Edge), and with one save file for Recovery being ~400 kB, that allows roughly 10-15 saves before the quota is reached and no new saves can be made without first deleting an old one. For many people, this is not a problem. For some, who like making many saves, it's a bummer.
To get around this, I've created my own save/load system for Recovery that can read and write files to the user's computer. (Note, the previous localstorage-based system isn't going anywhere either, so you are more than welcome to keep using it if you like it.) This bypasses the size limitation placed on localstorage, allowing the user to have as many save files as they can fit on their computer. The flip side of this is that this system is a bit less streamlined than the existing method - again, browser-based Javascript cannot, under any circumstance, read files from the user's filesystem without being given explicit permission to do so. Therefore, using this system requires manual selection of files to load in a file browser window rather than selection from an in-game menu. Similarly, I don't yet have a good way for the user to select a folder to save in other than having files download to their default downloads folder (though they can be moved afterwards). Clunkier, yes. But it at least works.
I've implemented this system already in the public-facing versions of Recovery, so if you start a new game, you should see that the Journal now has an "Extra Storage" option to create/load these save files. Old saves will still be functional, though you will not see this new button on the journal (but this functionality can still be accessed by typing "extra storage journal" in the command line all the same).
Feel free to leave me some comments if you have suggestions!
Happy healing,
H.
However, this creates another issue - localstorage quotas. As it turns out, browsers severely limit the total storage that one app can save to local storage - it's just 5 MB for the ones I checked (Chrome / Edge), and with one save file for Recovery being ~400 kB, that allows roughly 10-15 saves before the quota is reached and no new saves can be made without first deleting an old one. For many people, this is not a problem. For some, who like making many saves, it's a bummer.
To get around this, I've created my own save/load system for Recovery that can read and write files to the user's computer. (Note, the previous localstorage-based system isn't going anywhere either, so you are more than welcome to keep using it if you like it.) This bypasses the size limitation placed on localstorage, allowing the user to have as many save files as they can fit on their computer. The flip side of this is that this system is a bit less streamlined than the existing method - again, browser-based Javascript cannot, under any circumstance, read files from the user's filesystem without being given explicit permission to do so. Therefore, using this system requires manual selection of files to load in a file browser window rather than selection from an in-game menu. Similarly, I don't yet have a good way for the user to select a folder to save in other than having files download to their default downloads folder (though they can be moved afterwards). Clunkier, yes. But it at least works.
I've implemented this system already in the public-facing versions of Recovery, so if you start a new game, you should see that the Journal now has an "Extra Storage" option to create/load these save files. Old saves will still be functional, though you will not see this new button on the journal (but this functionality can still be accessed by typing "extra storage journal" in the command line all the same).
Feel free to leave me some comments if you have suggestions!
Happy healing,
H.