Monogatari 2.9.0 fixes a long list of problems in 2.8, from games that froze after a typo to music that didn’t play when the game was opened from its file. Your script, your settings, your styles and your players’ saves keep working: nothing was renamed or removed. Most games only need a new engine folder.

This page is for a game made with 2.8.0 or 2.8.1. To check yours, open the game, open the console, type monogatari.version and press Enter.

Update your game

  1. Keep a copy of your game folder, so you can go back to it.
  2. Download the 2.9.0 starter game from Get the Starter Game and unpack it somewhere else.
  3. Replace your game’s engine/core/ and engine/debug/ folders with the starter’s. That’s the engine: everything on this page comes with it.
  4. If your game is on the web, also copy service-worker.js from the starter into your game, replacing yours. Then, at its top, set NAME to your game’s name again, and add back any file you had added to the FILES list. (This file belongs to your game, so a new engine doesn’t change it. It’s what makes offline play work in a sub-folder of a website, and what lets players get the files you change. See Releasing on the Web.)
  5. If you release desktop apps, copy the starter’s engine/desktop/, engine/electron/ and engine/electrobun/ folders into your game too, and compare your package.json with the starter’s (see the desktop apps below).
  6. Play your game from the start, with the debug file still loaded. 2.9.0 shows an error dialog for problems 2.8 kept quiet about, so a dialog that’s new to you points at something to fix in your script. Then read the sections below that match what your game uses.

Every other starter file (index.html, js/options.js, style/main.css…) is yours to keep. The starter’s own copies changed a little, and the sections below say how, in case you want the same.

Saves and players’ data

  • Saves made with 2.8 load in 2.9.0, with LocalStorage and IndexedDB, and going back from them works.
  • A new game starts from what js/storage.js declares. When a game ends or a save loads, variables the game added without declaring them are removed. In 2.8 they stayed, into the next game and into older saves. Declare every variable in js/storage.js.
  • Loading a missing slot, or a save made at a label your script no longer has, leaves the game as it was, with an error dialog while you develop. 2.8 emptied the screen.
  • monogatari.upgrade() works with IndexedDB (the starter’s storage), from any of your files. With IndexedDB, its storage function must return the new data, not a promise. See Storage Engines.
  • A Version set lower than before, or a changed Store, no longer hides your players’ saves. The game goes on with the data they have, and an error dialog says what to change back.
  • Every save made in one visit to the save screen keeps its picture, and autosaves fill empty slots first, then the oldest. Slots show their date as players read it.
  • Saves have new entries for things the game now undoes exactly when going back (choices, music, particles, the gallery, the text box, videos, images and canvases). They’re added as players save; a 2.8 save has them empty.

The script

  • A statement that fails no longer stops the game. Its error dialog opens, the next click goes on with the statement after it, and Back steps over it. In 2.8, any failure (a typo in a name, a jump to a missing label) left the game stuck.
  • Problems that were silent now open a dialog while you develop: an object statement no action knows (a misspelled Choice), a label that runs out of statements (no end or jump at the end), a jump to an empty label, an endless loop of jumps, and a wait with a time that isn’t a number. See Diagnosing Errors.
  • A {{variable}} that doesn’t exist shows in the line as written. 2.8 emptied the whole line.
  • A variable’s value shows as text. If a player types <b>Kim</b> as their name, the line shows the tags instead of a bold name. A game that keeps HTML in variables on purpose gets the 2.8 behavior back by adding 'AllowHTMLInVariables': true, to js/options.js. See Writing Dialog.
  • Skip works. The quick menu’s Skip button and the S key turn skipping on and off when the Skip setting is above 0; in 2.8 they did nothing.
  • A Conditional without the branch it picked goes on to the next statement, and an error in the branch it ran no longer runs the other branch too.
  • Choices:
    • A choice whose options are all hidden is passed over.
    • Back from the line an option showed returns to the menu and runs onRevert.
    • A choice with several Condition functions no longer locks the game after the pick.
    • Disabled options look disabled.
  • vibrate and show notification never hold the game. In a browser that can’t vibrate or show notifications, they do nothing.
  • Going back undoes exactly what a statement did, for music, sounds, videos, particles, the gallery, the text box, images, backgrounds and canvases. In 2.8, some of these brought back what was never there, or removed more than they should.

Characters, scenes and images

  • show scene black with fadeIn shows the color. In 2.8, a color with an animation showed nothing.
  • hide character and hide image with a class that isn’t an animation remove the sprite at once. In 2.8 it stayed on screen.
  • end- animations keep their whole name (end-shake-hard) and work for images too.
  • Layered sprites (an experimental feature) are no longer cut in half, play their exit animations, and changing one layer leaves the others alone. If your style/main.css has character-sprite [data-layer] { translate: none; }, it’s no longer needed.
  • A sprite shown again without at still goes back to the center, as in 2.8.

Music, sound and video

  • Opened from its file, a game plays its music, sounds and voices. Their audio effects only apply when the game is served. See What works opened from a file.
  • A missing or misspelled audio file no longer stops the game. A dialog names the file while you develop, and the game goes on without it.
  • The delay, chorus, phaser, ringmod and autowah effects change the sound. In 2.8 they did nothing, so a game that used them will now hear them.
  • play music for a track that’s already playing keeps its loop, and a save restores the track once.
  • Videos:
    • The mode can be left out (show video intro with close).
    • A video without close lets the player move on once it ends.
    • A video that fails to load no longer holds the game.

Text and translations

  • The Text Speed slider is faster to the right. Players’ saved speeds don’t change.
  • Text effects show on lines that appear at once, and effects that reveal letters start when each letter is typed.
  • The wave effects lift the letters. If you set a negative --effect-wave-amplitude to make them rise, use a positive value now.
  • Centered lines have a box: white text on the main color. For the 2.8 look, add centered-dialog { background-color: transparent; color: var(--text-color); } to style/main.css.
  • monogatari.translations(object) adds strings to each language instead of replacing all of that language’s strings.
  • A string a language lacks shows in English, and a missing language opens one dialog instead of one per string.
  • The page’s language follows the game’s. <html lang> and <html dir> are set from the Language setting, so a game in Arabic is laid out right to left.

The interface

  • Messages, alerts and the name prompt are narrower on wide screens, and error dialogs show above them.
  • The quick menu’s icons are 24 pixels (they were 16). Your own [data-component="quick-menu"] svg rule still wins.
  • Gallery pictures show. In 2.8 their cards had no width, so unlocked pictures were invisible.
  • The credits screen is laid out as a centered column, and a section written as text keeps its heading.
  • The loading bar fills as the files load.
  • The help screen no longer lists an A key, and leaves out Skip and Back when your game turns them off.
  • Menu changes (addButton() and the others) work anywhere in your files, not only after init().
  • Screen readers read every new line with its speaker, sprites by name and expression, and the names of every button and slider.
  • Fifteen new CSS variables reach colors you could only change with selectors before. Nothing looks different until you set them. See CSS Variables.
  • On a phone held the wrong way for your Orientation, the rotate message has an OK button.
  • The starter’s index.html allows pinch zoom. Your game’s index.html keeps its own viewport line; Accessibility shows the one-line change.

Errors and the debug file

  • The debug file turns the dialogs on by itself, so they show even when js/main.js never sets a debug level.
  • A typo in one of your .js files opens one dialog that names the file. In 2.8 a typo in js/main.js left a blank page with no dialog.
  • Without the debug file, a released game’s console only shows errors and warnings, even at debug level 5.
  • The console no longer shows “Lit is in dev mode”: the engine bundles Pandora 0.5.1, built for production, and is about 8 KB smaller.
  • The error dialog’s help links point at these docs and GitHub, not at the old community forums.

Offline play and hosting

These come with the new service-worker.js (step 4 above):

  • A game in a sub-folder of a website (itch.io, GitHub Pages) plays offline.
  • Players get the scripts and stylesheets you change on their next visit, and pictures or sounds you replace under the same file name by their second.
  • Two games on one website keep their offline copies apart.

The desktop apps

  • FileSystem storage works in both desktop apps: saves are files in the app’s data folder. A game whose engine/core/ is 2.9.0 but whose engine/electron/ files are older waits 5 seconds, then keeps its data in the browser storage and says why. Copy the new desktop folders (step 5) to fix it.
  • Links to websites open in the player’s browser. In 2.8, Electron asked whether to quit the game.
  • The Electrobun app shows your game’s name as its title and lists window sizes in the settings.
  • The engine’s default Resolution is '1280x720'. The starter sets its own, so only a game that removed it from js/options.js sees the change.
  • The starter’s package.json runs without Yarn, builds the Linux app, makes a smaller Electron app and a release build of the Electrobun app. Your game’s package.json is yours: Releasing for Desktop lists the lines to copy.

Your own actions, components and code

  • monogatari.configuration({ part: { … } }) changes the configuration (it changed nothing), and a menu on screen redraws when its configuration changes.
  • onSave() on actions and components runs after every save.
  • Component.get(id) and instance(id) find elements by data-instance.
  • A component registered for a tag already in use keeps the first one.
  • A didApply() that returns nothing waits for the player instead of throwing.
  • Preloading fires a new assetFailed event for each file that fails, and didPreloadAssets always fires.
  • The engine no longer writes into your script’s statement objects.
  • TypeScript projects can import the engine’s types from @monogatari/core; they need TypeScript 5.0 or later.

The Engine API and Extending Monogatari pages describe each of these as 2.9.0 has them.