Saving

Configure save slots and auto-save functionality

Monogatari provides a flexible save system that allows players to save and load their progress.

Save Settings

Setting
Type
Default
Description

Slots

number

10

Number of save slots available

SaveLabel

string

'Save'

Prefix for save slot storage keys

AutoSaveLabel

string

'AutoSave'

Prefix for auto-save slot storage keys

AutoSave

number

0

Auto-save interval in minutes (0 = off)

Number of Save Slots

Control how many save slots are available:

monogatari.settings({
    'Slots': 10  // 10 save slots available
});

Increase for games where players may want more save points:

monogatari.settings({
    'Slots': 20  // 20 save slots
});

Save Slot Prefixes

Multiple Games on Same Domain

If you host multiple games on the same domain, they will share save data by default. To prevent this, use unique prefixes:

Auto-Save

Enabling Auto-Save

Set the AutoSave setting to the interval (in minutes) between automatic saves:

Disabling Auto-Save

Set to 0 to disable auto-saving (default):

Auto-Save Behavior

When auto-save is enabled:

  • The game saves automatically at the specified interval

  • Auto-saves are stored separately from manual saves

  • The load screen shows both manual saves and auto-saves

  • Auto-saves are labeled with the AutoSaveLabel prefix

Storage Configuration

Control how and where game data is stored:

Storage Adapters

Adapter
Description
Use Case

LocalStorage

Browser's localStorage (default)

Most web games

SessionStorage

Cleared when browser closes

Temporary/demo games

IndexedDB

IndexedDB API

Large amounts of data

RemoteStorage

REST API endpoint

Cloud saves

Remote Storage Example

For cloud saves:

Save Data Contents

When a game is saved, Monogatari stores:

  • Current label and step position

  • All state variables

  • All storage variables

  • History for all actions

  • Player preferences

  • Timestamp and slot name

Programmatic Save/Load

Saving Programmatically

Loading Programmatically

Checking for Saves

Save Slot UI

The save and load screens are provided by built-in components. You can customize them using the template method:

Last updated

Was this helpful?