Saving and Loading
Players can stop your game and come back to it later. The starter game already lets them save and load, with no changes from you. This page shows what players can do, how your game can save on its own (autosaves), where saves are kept, and how to keep saves working when you release an update.
Settings go in js/options.js, inside monogatari.settings({ … }). Each one is described in full in Saving.
What a save keeps
A save is a copy of where the player is: the label and line of the script, the scene, the characters and images on screen, the music and sounds playing, the values of your game’s variables (the ones in js/storage.js), and the history the Back button uses, so the player can still go back after loading. Each save sits in a slot, which the save and load screens show as a card with a picture, a name and a date.
What the player can do
Save
The Save button of the quick menu, or Shift + S, opens the save screen. Its name field starts with the date and time; the player can type a name of their own and press Save. Every save made this way goes in a new slot and appears on the screen at once. There’s no other message. When the name field is empty, pressing Save does nothing.

To replace an old save instead, the player clicks its card. The game asks “Are you sure you want to overwrite this slot?” and shows the save’s name in a field, so the player can change it before pressing Overwrite.

Players reach the save screen only during a game: the title screen has no Save button, and Shift + S does nothing there.
Load
The Load button, on the main menu and on the quick menu, opens the load screen; during the game, Shift + L does too. Clicking a card loads that save: the current game is cleared, the saved one is put back, and its line shows again. From the main menu, that starts the game at that point. The load screen has up to two sections:
- Saved Games: the saves the player made.
- Auto Saved Games: the autosaves. This section only appears when autosave is on.

After loading, the player can go back through the lines before the save with the Back button.
Delete a save
Each card has a small round button with a cross in its corner. It asks “Are you sure you want to delete this slot?”, with the save’s name, and deletes the save when the player presses Delete.
Where saves are kept
Saves are kept by the player’s browser, on the player’s device, separately for each website. A few things follow:
- The same game opened from a different place (from its files, then from a website, or from two websites) doesn’t see the saves made in the other one.
- A player who clears the browser’s data for the site, or plays in a private window and closes it, loses the saves.
- When the game starts, it asks the browser to keep its data even when the device runs low on space. A browser can say no; while you develop, the browser’s console then shows “Persistent Storage permission has been denied”.
- The game’s
Namesetting is part of where its data is kept: the starter game’s'My Visual Novel'becomes a database calledmy-visual-novel. Choose the name once, before you release the game, and don’t change it afterwards: under a new name, the game finds no saves and no settings. Mark new releases with theVersionsetting instead.
The starter game keeps its data in the browser’s IndexedDB database (the Storage setting in js/options.js). The pictures of the save cards go in a second database next to it, named after the first with _Screenshots at the end. Other places, such as a server of your own, are described in Storage Engine.
Turn on autosave
Autosaves are off in the starter game. The AutoSave setting turns them on with a number of minutes:
// Save every 5 minutes
'AutoSave': 5,Autosaves go round a set of slots: the first in slot 1, the next in slot 2, and so on up to the number in the Slots setting (10 in the starter game). Once every slot is used, the next autosave replaces the oldest one. The load screen shows them under Auto Saved Games. An autosave has no name of its own, so its card shows the date and time it was made in its corner as well.
Some details that matter when you choose the number:
- The minutes count from the moment the game opens, on the title screen too. An autosave only happens while a game is being played; when the time comes on the title screen, nothing is saved.
- The slots go round across visits too: the first autosave of a new visit goes to an empty slot, or replaces the oldest one.
- An autosave made while the game screen or the save screen shows has a picture of the game. One made while the player is on another screen (the settings, say) shows the scene behind it instead.
Pictures on save cards
With the Screenshots setting on (it is in the starter game), each save keeps a small picture of the game screen. A save from the save screen keeps the picture taken as the screen opened. Without the setting, a card shows the scene’s image instead, without the characters or the text box.
The pictures need the game to be served from a website or a local server. Opened from its file, a save’s picture comes out black in Chrome and in Firefox, with only the text box in it, because the browser doesn’t let the game read its own images. Open your game lists what else differs when the game is opened from a file.
The comment next to the setting in js/options.js also warns that images loaded from another website come out black unless that website allows it. Keep your images in your game’s assets folder and this doesn’t come up.
Limit what players can do
No going back.
'AllowRollback': falseremoves the Back button and the ← key. Saves still work.No Save button. Remove it from the quick menu inside the
initfunction ofjs/main.js(see The Game’s Interface):monogatari.component('quick-menu').removeButton('Save');Shift + S still opens the save screen; that shortcut can’t be removed. Autosaves keep working.
Keep saves working when you update your game
Players keep their saves when you release a new version. A save remembers its place as a label name and a line number in that label, so changing the script can move or break that place:
- New labels don’t bother old saves.
- Lines added or removed in a label move its saves: a save loads at the same line number, which is now a different line. Add new lines after the place players are likely to have saved, or in new labels.
- A renamed or deleted label breaks every save made in it. Such a save doesn’t load: clicking it does nothing, and while you develop an error dialog names the missing label. Keep the old label names.
- A new variable in
js/storage.js: old saves get its starting value when they load. - The
Namesetting: don’t change it. ChangeVersionfor each release.
When an update needs to change the data your game has stored, monogatari.upgrade() lets you write the change: see Storage Engine.
Save and load from your own code
monogatari.saveTo() and monogatari.loadFromSlot() let your own code save and load, and the willLoadGame and didLoadGame events tell it when a save loads. A save made while no game is being played (on the title screen) does nothing. See the Engine API.
Related
- Saving: every save setting, with its default.
- Save Screen, Load Screen and Save Slot: the screens and cards, and how to style them.
- The Game’s Interface: the quick menu and the keyboard shortcuts.