Edit, Save, Reload
Every change to your game takes the same three steps: edit a file in your text editor, save it, and reload the game in your browser. This page walks through them once, with a small change: your game’s title.
Give the game a title
The starter game’s main menu has no title, only its four buttons. You’ll add one, and change the name the browser shows on its tab.
Open
index.htmlin your text editor, not in the browser. In your file manager, right-click it, choose Open with, and pick your editor. In a code editor, open the whole game folder (in Visual Studio Code: File › Open Folder…) and clickindex.htmlin the sidebar.Find the main menu. It’s on lines 105 and 106, inside
<body>:<main-screen> <main-menu></main-menu>Most editors can search the file: press Ctrl+F (Cmd+F on a Mac) and type
<main-screen>.Add a line with your title between them. The tutorial’s story is called After the Bell:
<main-screen> <h1>After the Bell</h1> <main-menu></main-menu><h1>and</h1>mark a title on a web page. Whatever you write between them shows on the main menu.Change the name on the browser’s tab. On line 7, replace the words between
<title>and</title>:<title>After the Bell</title>Leave the comment after it, the part between
<!--and-->, as it is: the browser ignores it.Save the file: Ctrl+S, or Cmd+S on a Mac.
Reload the game in your browser: click the reload button next to the address bar, or press F5 (Cmd+R on a Mac). On a tablet or a phone, reload the preview the way your editor does it.
The main menu now shows your title, and the browser’s tab shows the same name.

If it still looks the same, check that you saved the file, and that the folder in the browser’s address bar is the one you’re editing.
TIP
On a computer, put the editor and the browser side by side, so you can change a line and see the result without switching windows.
Served games keep a copy of your files
Opened from its file, a reload always shows your latest change. When the game is served at http://localhost, at http://127.0.0.1 or at an https:// address, the game keeps a copy of its own files, so it can load fast and play offline (the file service-worker.js does this). It checks that copy each time the game loads:
- After you change a file in
js/orstyle/, a reload shows your change: the game asks the server for those files every time, and uses its copy only when the server doesn’t answer. - After you replace a picture or a sound with a new file of the same name, the first reload still shows the old one and fetches the new one meanwhile. Reload a second time and the new file is there.
If a reload shows an old file anyway, reload while holding Shift, which skips every copy the browser kept (checked in Chromium). Firefox can also keep a stylesheet it loaded before the game’s copy was set up, the first time you opened the game: close Firefox and open the game again, and from then on a reload shows your changes.
Your game’s stylesheet explains the same for styles.
Each reload starts the game over
A reload brings back the main menu, and the story starts from the beginning when you press Start. To try a change near the end of your story without playing it all again, save the game there, reload, and load your save from the main menu’s Load button. Saving and loading shows how.
Where Monogatari tells you about mistakes
Monogatari doesn’t read through your whole script when the game starts. It finds a mistake when it reaches it:
- A typo that breaks a file, such as a missing comma in
js/script.js, shows a dialog as soon as the page opens, and the main menu never appears. - A name the game can’t find, such as a character or a label that doesn’t exist, shows a dialog when the story reaches that line.
- Some mistakes show nothing: a misspelled background shows a black screen, and a misspelled instruction shows up as text.
The dialogs come from the debug module, engine/debug/debug.js, which index.html loads while you make your game. Players never see them once you share your game. When something goes wrong explains each kind of message, and the mistakes that don’t show one.
Next
Your first scene: replace the sample story with your own.