Game Settings
Settings decide how your game behaves: where it starts, how text appears, how saving works, where its files are. You set them in js/options.js, a file of the starter game, by editing it in any text editor and reloading index.html in your browser. Nothing needs to be installed or run.
This page lists every setting the engine reads. The pages after it explain the ones that need more than a line.
Where settings live
The starter game’s js/options.js begins with one call that holds every setting, each with a comment that explains it:
monogatari.settings({
// The name of your game, this will be used to store all the data so once
// you've released a game using one name, it shouldn't change. Please use the
// Version Setting to indicate a new release of your game!
'Name': 'My Visual Novel',
// The version of your game in semantic versioning (https://semver.org/).
'Version': '0.1.0',
// …the rest of the settings
});To change a setting, change its value there and reload the page. Keep the quotes around text values and the comma at the end of each line.
The object you give is merged into the engine’s defaults. A setting you leave out keeps its default, and so does every part you leave out of a setting that holds an object: 'AssetsPath': { 'root': 'media' } changes the root folder and keeps all the other folders.
index.html loads js/options.js right after the engine and before your script, so the settings are in place before the game starts.
IMPORTANT
Keep Name, Version and Storage in the monogatari.settings({ … }) call at the top of js/options.js. The game sets up its storage from them when it reaches the monogatari.preferences({ … }) call at the end of the same file, and a change made after that (in js/script.js, for example) is ignored by the storage. monogatari.upgrade() calls can go in any of your game’s files. Keep Name the same once your game is released: the player’s saves and preferences are stored under it. Storage Engines explains why.
Read or change a setting from code
monogatari.setting(name) reads one setting, and monogatari.setting(name, value) changes it:
const slots = monogatari.setting('Slots');
monogatari.setting('Skip', 50);Reading a setting that doesn’t exist throws an error: Tried to access non existent setting with name 'Slot'. Names are case-sensitive. Passing null as the value reads the setting instead of changing it. monogatari.settings() with no argument returns every setting.
Misspelled names
Monogatari 2.9.0 doesn’t check the names you give monogatari.settings(). A misspelled name ('Prelaod': false) is stored like any other and does nothing, without a warning in the console. If a setting seems to have no effect, compare its name, letter by letter and with the same capitals, with the tables below.
Settings read only when the game starts
A setting changed while the game runs takes effect the next time the engine reads it. Most are read each time they’re needed, but these are read once, while the game loads, so a change to them does nothing until the page is reloaded. Set them in js/options.js:
| Setting | When it’s read |
|---|---|
Name, Version, Storage |
When the storage is set up, at the monogatari.preferences({ … }) call in js/options.js. |
ServiceWorkers |
When the game sets itself up. |
Preload |
When the loading screen would appear, before the first screen. |
Orientation |
When the game starts: whether to watch the device’s orientation at all. |
ForceAspectRatio, AspectRatio |
When the game starts. |
AutoSave |
When the game starts: the autosave timer is created once. |
LanguageSelectionScreen |
When the game starts. |
SplashScreenLabel |
When the game shows its first screen. |
Skip, AllowRollback |
When the game starts, for the quick menu’s Skip and Back buttons and the left arrow key. |
SaveLabel, AutoSaveLabel |
When the save and load screens are built, at start. Saves made later use the new value, but the screens keep listing the old one. |
All settings
The Starter game column says what the starter game’s js/options.js does with each setting: “same” when it sets the engine’s default, and the value when it sets another one.
Your game and how it starts
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
Name |
text | 'My Visual Novel' |
same | Your game’s name. Saves and preferences are stored under it, so don’t change it once players have the game. Include Latin letters or digits: the storage uses the name lowercased, with spaces turned into - and every other character removed, so a name written only in other scripts ('物語') leaves the storage without a name (see Storage Engines). Desktop builds also use it as the window’s title. |
Version |
text | '0.1.0' |
same | Your game’s version, as semantic versioning ('1.2.0'). The storage is versioned with it: raise it for each release and never lower it (see Storage Engines). |
Label |
text | 'Start' |
same | The label a new game starts at, and the one the game goes back to after an end. |
ShowMainScreen |
true or false |
true |
same | Show the main menu. With false, the game starts at Label as soon as it has loaded. See Skip the Main Menu. |
SplashScreenLabel |
text | '_SplashScreen' |
same | When your script has a label with this name, it plays after loading and before the main menu. See Skip the Main Menu. |
MainScreenMusic |
text | '' |
same | The name of a music asset to play, looping, on the main menu. '' plays nothing. |
MainScreenMusic takes the name you gave the file in monogatari.assets('music', { … }), not the file name. A name that isn’t a music asset shows an error, The music "…" is not defined., listing the music the game has. Browsers don’t play sound before the player has clicked the page, so the main menu usually shows Click here to allow audio playback. at the top, and the music starts when the player clicks it. It stops when the player starts or loads a game. The main menu’s music plays through a plain audio element, served or opened from a file, so it takes no audio effects.

Languages
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
MultiLanguage |
true or false |
false |
same | Your script is written in several languages, one set of labels per language. See Internationalization. |
LanguageSelectionScreen |
true or false |
true |
same | With MultiLanguage on, show a screen where the player picks a language the first time they open the game. With false, the game starts in the Language preference and the player changes it on the settings screen. |
The language the game starts in is a player preference, not a setting.
Saving
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
AutoSave |
number | 0 |
same | Minutes between autosaves. 0 turns autosaving off and hides the load screen’s Auto Saved Games section. |
Slots |
number | 10 |
same | How many autosave slots the autosaves rotate through. Manual saves have no limit. |
Screenshots |
true or false |
false |
true |
Take a picture of the game screen with each save and show it on the save slot, instead of the scene’s image. See Save slot pictures. |
SaveLabel |
text | 'Save' |
same | The start of the storage name of manual saves (Save_1795891887668). |
AutoSaveLabel |
text | 'AutoSave' |
same | The start of the storage name of autosaves (AutoSave_1). |
Storage |
object | see below | 'IndexedDB' adapter |
Where saves and preferences are kept. |
Storage holds three options. The engine’s default is { 'Adapter': 'LocalStorage', 'Store': 'GameData', 'Endpoint': '' }; the starter game sets 'Adapter': 'IndexedDB' and keeps the other two. Storage Engines explains each adapter, and Saving the rest of this table.
Going back
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
AllowRollback |
true or false |
true |
same | Let the player go back to earlier lines. With false, the quick menu has no Back button and the left arrow key does nothing. |
The Back button and the left arrow key are set up when the game starts. Turning AllowRollback off later, from your script, stops going back too (the button stays but does nothing); turning it on later doesn’t bring the button or the key back.
Text, skipping and auto-play
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
TypeAnimation |
true or false |
true |
same | Show dialog letter by letter. With false, every line appears at once and the settings screen hides its Text Speed slider. |
NarratorTypeAnimation |
true or false |
true |
same | Type out the narrator’s lines. Only applies while TypeAnimation is on. |
CenteredTypeAnimation |
true or false |
true |
same | Type out the lines of the centered character. Only applies while TypeAnimation is on. |
NVLTypeAnimation |
true or false |
true |
same | Type out lines shown in NVL mode (the full-screen text box). Only applies while TypeAnimation is on. |
InstantText |
true or false |
false |
true |
What a click does while a line is still typing: true shows the rest of the line at once, false types it out at top speed. |
TypingCursor |
true or false |
false |
same | Show a blinking cursor after the last typed letter. See Type Writer. New in 2.9.0. |
AllowHTMLInVariables |
true or false |
false |
same | Show HTML in the values of {{variables}} as HTML, in dialog, names, choices, messages, inputs and the credits. With false, values show as text, so nothing a player types can change the page. Turn it on only when no variable holds what a player typed. See Variables in the text. New in 2.9.0. |
Skip |
number | 0 |
same | Milliseconds between lines while the game skips. 0 turns skipping off and removes the quick menu’s Skip button. |
Text, Skip and Auto-play explains these with examples.
Screen shape
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
ForceAspectRatio |
'None', 'Visuals' or 'Global' |
'None' |
same | Keep the game in the shape of AspectRatio whatever the window’s shape: 'Visuals' keeps the scene and characters in it, 'Global' the whole game. |
AspectRatio |
text | '16:9' |
same | The shape your scenes are drawn for, as width and height ('4:3', '21:9'). Only used when ForceAspectRatio isn’t 'None'. |
Orientation |
'any', 'portrait' or 'landscape' |
'any' |
'landscape' |
On a phone or tablet held the other way, show Please rotate your device to play. |
Aspect Ratio and Orientation shows what each value looks like.
Files and loading
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
AssetsPath |
object | see Assets path | same | The folders your images, sounds and other files are in. |
Preload |
true or false |
true |
same | Load the game’s images and sounds behind a loading screen before the main menu. Only for a game served from a website or a local server: a game opened from a file, or running as a desktop or Cordova app, skips it. |
ServiceWorkers |
true or false |
true |
same | Let the browser keep a copy of the game’s files, so it loads faster and plays offline. Only for a game served over https or from localhost or 127.0.0.1; anywhere else, the game plays without it and the console says so. Works from a sub-folder of a site too. |
Asset Preloading explains both, and what a web host needs for them.
Unfinished features
| Setting | Type | Default | Starter game | What it does |
|---|---|---|---|---|
ExperimentalFeatures |
true or false |
false |
same | Turn on unfinished features: in 2.9.0, layered character sprites (show character y:mouth smile). They may change in later versions in ways that break saves made with them. |
Assets path
AssetsPath tells the engine where each kind of file is. The path of a file is the root folder, then the kind’s folder, then the file name, so with the defaults a scene registered as 'beach.png' loads from assets/scenes/beach.png:
monogatari.settings({
'AssetsPath': {
'root': 'assets',
'characters': 'characters',
'icons': 'icons',
'images': 'images',
'music': 'music',
'scenes': 'scenes',
'sounds': 'sounds',
'ui': 'ui',
'videos': 'videos',
'voices': 'voices',
'gallery': 'gallery',
},
});| Folder | What the engine loads from it |
|---|---|
root |
Holds every other folder. It can also be the address of another site ('https://cdn.example.com/game'); see Assets on another site for what that site must allow. |
characters |
Character sprites, expressions and side images, inside each character’s own directory. |
images |
Images shown with show image. |
scenes |
Backgrounds shown with show scene and show background, and the picture of a save slot when the save has no screenshot. |
music, sounds, voices |
Audio played with play music, play sound and play voice, and the main menu’s music. |
videos |
Videos shown with show video. |
gallery |
The images of the gallery screen. |
icons, ui |
Not read by the engine. The starter game’s index.html and manifest.json name their icons as assets/icons/… directly. |
Settings the engine writes
Three more settings appear in monogatari.settings() once the game has started. The engine writes them itself, from the sliders of the settings screen, so a value you set is replaced:
| Setting | Written from |
|---|---|
maxTextSpeed, minTextSpeed |
The max and min of the Text Speed slider (50 and 1). |
MaxAutoPlaySpeed |
The max of the Autoplay Speed slider (60). |
Player Preferences explains what the sliders change.
Related pages
- Player Preferences: what players change on the settings screen, and the defaults you set for them.
- Saving and Storage Engines: the saving settings in detail.
- Start Here: opening and editing the starter game.