The starter game’s folder holds more files than you’ll ever touch. This page tells you what each one is for, so you know where to work and what to leave alone.

monogatari-v2.9.0/
├── index.html             the page that is your game
├── js/
│   ├── options.js         your game's settings
│   ├── storage.js         your game's variables
│   ├── script.js          your story
│   └── main.js            starts the game
├── style/
│   └── main.css           your styles
├── assets/                your images, music and sounds, one folder per kind
├── engine/                Monogatari itself: never change it
├── favicon.ico            the icon in the browser tab
├── manifest.json          the name and icons for installing the game on a device
├── service-worker.js      offline play, once the game is served
├── types/                 descriptions of the engine for code editors
├── jsconfig.json          settings for code editors
└── …                      tools for optional tasks (listed at the end)

The files you’ll change

File What it’s for
js/script.js Your story. The characters, the list of your images and music, and the script: everything that happens in the game, in order. Most of this tutorial happens here.
js/options.js Your game’s settings: its name, how many save slots it has, which way a phone must be held, and, further down, the starting values of the player’s preferences, such as text speed and volume. Each setting has a comment above it that explains it.
js/storage.js Your game’s variables: things the game remembers about the player, such as their name, with the value each starts with. Saves keep them.
js/main.js Starts the game. It also sets how much Monogatari writes to the browser’s console, and it’s where JavaScript of your own goes later on.
style/main.css Your styles: colors, fonts and sizes that change how the game looks. They apply on top of the engine’s, so yours win.
assets/ Your assets: the pictures, music and other files the game shows or plays. Each kind has its own folder, listed below.
index.html The page itself. You’ll change the game’s title in it, and little else.

The folders inside assets/:

Folder What goes in it
scenes/ Backgrounds.
characters/ The images of your characters, usually in a folder per character.
images/ Other pictures you show over the background, such as a letter or a photo.
music/ Music.
sounds/ Sound effects.
voices/ Recorded lines of dialog.
videos/ Videos.
gallery/ Pictures for the gallery screen, where players see the art they unlocked.
fonts/ Fonts for your styles.
ui/ Pictures for the interface, such as a background for the menus.
icons/ The game’s icons, already filled with Monogatari’s. Replace them with yours when you share the game, keeping the same sizes and file names.

The engine finds your pictures, music and videos by these folder names, which 'AssetsPath' in js/options.js lists. Leave it as it is.

The folder you never change: engine/

engine/ is Monogatari itself: engine/core/monogatari.js is the engine, and engine/core/monogatari.css its styles. Don’t change anything in it. When a new version of Monogatari 2 comes out, you update your game by replacing this folder, and changes you made in it would be lost. To change how the game looks, write your styles in style/main.css; to change how it behaves, use the settings in js/options.js.

engine/debug/debug.js is Monogatari’s debug module. While you make your game, it turns the engine’s error messages into dialogs that explain what went wrong. You’ll take it out when you share your game.

How index.html loads your game

Near the top of index.html (lines 74 to 88), a few lines load everything, in this order:

<!-- Monogatari CSS Libraries -->
<link rel="stylesheet" href="./engine/core/monogatari.css">
<link rel="stylesheet" href="./style/main.css">

<!-- Debug Library. Remove this file for release builds -->
<script src="./engine/debug/debug.js"></script>

<!-- Monogatari JavaScript Libraries -->
<script src="./engine/core/monogatari.js"></script>
<script src="./js/options.js"></script>
<script src="./js/storage.js"></script>
<script src="./js/script.js"></script>
<script src="./js/main.js"></script>
  • The two stylesheets come first: the engine’s styles, then yours.
  • Then the debug module, the engine, and your four files. Each of your files tells the engine something about your game, and the last one, js/main.js, starts it.

Further down, inside <body>, the <visual-novel> element holds every screen of the game: the main menu, the game itself, the save and load screens, the settings and so on. Leave it as it is; the next page adds a title to the main menu there.

The files for code editors: types/ and jsconfig.json

types/ describes everything the engine offers, in a form that code editors and programming tools read, and jsconfig.json holds settings for code editors such as Visual Studio Code. The game itself never loads them, and you can ignore both.

The files for optional tools

These files are for tools that need a computer with Bun installed (see Open your game) or more. The game never loads them, and you can leave them where they are.

Files What they’re for
serve.ts The local web server, bun run serve.
build-web.ts Makes a copy of your game ready to upload, with bun run build:web. Share your game shows how to do the same by hand.
package.json, bun.lock The list of tools for desktop apps, and the commands above.
engine/electron/, engine/electrobun/, engine/desktop/, electrobun.config.ts, jsconfig.node.json Turning your game into a desktop app for Windows, macOS or Linux. See Desktop.

Next

Edit, save, reload: make your first change and see it in the game.