Saving
A Monogatari game can save in two ways: the player saves from the save screen, and the game can save by itself on a timer. Both kinds show on the load screen, where the player picks one to go back to that moment of the story.

Kinds of saves
| Kind | Made by | Storage name | How many |
|---|---|---|---|
| Manual save | The player, on the save screen (the quick menu’s Save, or Shift + S) | Save_ and the moment it was made, in milliseconds: Save_1795891887668 |
As many as the player makes. |
| Autosave | The game, every AutoSave minutes |
AutoSave_1 to AutoSave_ and the Slots number |
Slots, reused in turn. |
On the save screen, the player types a name for the save (the date and time is filled in) and presses Save, which makes a new slot. Clicking an existing slot asks to overwrite it, with its name ready to change; the slot keeps its storage name. The × on a slot deletes it after asking.
The load screen lists manual saves oldest first, and autosaves by slot number. An autosave’s name is the date and time it was made, written the way the player’s browser writes dates (Nov 28, 2026, 1:09:17 PM in American English), like the name the save screen fills in.
Save settings
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
AutoSave |
number | 0 |
same | Minutes between autosaves. 0 turns them off. |
Slots |
number | 10 |
same | How many autosave slots the autosaves go through. It doesn’t limit manual saves. |
Screenshots |
true or false |
false |
true |
Keep a picture of the game with each save, for its slot. |
SaveLabel |
text | 'Save' |
same | The start of the storage name of manual saves. |
AutoSaveLabel |
text | 'AutoSave' |
same | The start of the storage name of autosaves. |
Storage |
object | LocalStorage |
IndexedDB |
Where saves are kept. See Storage Engines. |
Set these in js/options.js. AutoSave, SaveLabel and AutoSaveLabel shape the save and load screens when the game starts, so a change from your script doesn’t reach them.
What a save keeps
A save holds:
- the label and the step (the position in that label) the player was at, and what was on screen and playing (the
state); - the history the game needs to go back from there;
- the game’s variables, set with
monogatari.storage()(see Variables and storage); - the name of the slot, its date, the name of the scene on screen and, with
Screenshotson, the storage name of its picture.
It doesn’t hold the player’s preferences: volume and text speed belong to the player and stay as they are when a save is loaded.
Because a save remembers a label and a step, a save made before you change your script loads at the same step of the same label in the new script. Keep the labels’ names, and add new lines at the end of a label rather than in the middle, so old saves land where they should. If the label is now shorter than the saved step, the game resumes at the label’s last statement. A save made at a label your script no longer has doesn’t load at all: the game stays as it was, and while you develop an error dialog names the missing label.
Autosave
Set AutoSave to the number of minutes between autosaves:
monogatari.settings({
'AutoSave': 5,
'Slots': 10,
});The timer starts when the game loads and ticks every AutoSave minutes. At each tick, the game saves only if the player is in a game (on the game screen or in a menu opened from it); on the main menu, nothing is saved. Each autosave goes to the first empty slot, AutoSave_1 up to AutoSave_ and the Slots number, or, once every slot is used, to the one written longest ago. The slots go round in turn this way across visits too, and a slot the player deleted is the next one used.
With AutoSave at 0, there are no autosaves and the load screen has no Auto Saved Games section.
Save slot pictures
With Screenshots on, each save keeps a small picture of the game screen, 400 pixels wide, and its slot shows it. Without it, the slot shows the scene that was on screen.
monogatari.settings({
'Screenshots': true,
});The save screen takes the picture when it opens, so it shows the game as the player left it, and every save made before the player leaves the save screen uses it, an autosave included. An autosave made during play takes its picture when it happens; one made while another menu covers the game has no picture.
The pictures are kept apart from the saves, in a browser database named after your game (my-visual-novel_Screenshots for the default Name), whatever Storage adapter you use. Deleting a slot deletes its picture. If the browser can’t keep the pictures, slots show the scene instead.
The picture is made by copying the images on screen, which the browser only allows for images it can read:
- Opened from a file (
file://), the picture comes out without the scene and the characters: the slot shows a black picture with the text box, in Chrome and in Firefox. Served, it works in both. See what works opened from a file. - Images from another website, when
AssetsPathpoints at one, appear in the picture only if that site allows it with anAccess-Control-Allow-Originheader. Otherwise the picture is black where they should be, even though they show during play.
Your own code can keep the pictures somewhere else by replacing three functions on the engine: monogatari.onSaveScreenshot = async (slotKey, blob) => key, monogatari.onLoadScreenshot = async (key) => imageAddress and monogatari.onDeleteScreenshot = async (key) => {}. See the Engine API.
Two games on one website
Each game keeps its saves and preferences under its Name, so two games with different names on the same website never see each other’s saves. Two games that both keep the starter game’s 'My Visual Novel' share them. Give each game its own Name before you publish it; SaveLabel and AutoSaveLabel don’t need to change.
Saving and loading from code
These are for your own buttons, screens or tests. The player’s save and load screens already do all of this. The Engine API has the full reference of each method.
Saving
// A manual save, named by the player's date and time.
monogatari.saveTo('SaveLabel');
// A manual save with a name.
monogatari.saveTo('SaveLabel', null, 'Before the festival');
// Into autosave slot 3.
monogatari.saveTo('AutoSaveLabel', 3);monogatari.saveTo(kind, id, name) takes the setting that names the kind of save ('SaveLabel' or 'AutoSaveLabel'), the slot number (or null for a new one, numbered with the current time) and the slot’s name (or null for the date and time, written like an autosave’s). It returns a promise. It only saves while the player is in a game: on the main menu it does nothing.
Loading
monogatari.loadFromSlot('Save_1795891887668').then(() => {
monogatari.run(monogatari.label()[monogatari.state('step')]);
});monogatari.loadFromSlot(storageName) restores the save and shows the game screen; running the statement at the saved step, as the load screen does, continues the story from there. When there’s no save under that name, or the save is at a label the script no longer has, the promise is rejected and the game stays as it was; while you develop, an error dialog says which.
Listing saves
The saves are entries of the game’s storage, monogatari.Storage. Their names start with the SaveLabel or AutoSaveLabel and an underscore:
monogatari.Storage.keys().then((keys) => {
const saves = keys.filter((key) => key.startsWith('Save_'));
console.log(saves);
});monogatari.Storage.get(storageName) returns a save’s contents. The storage also holds the player’s preferences, under Settings.
Related pages
- Storage Engines: where saves are kept, and keeping them across versions of your game.
- Saving and loading: the player’s side, step by step.
- Load Screen, Save Screen and Save Slot: the screens and how to change them.