🐇 Burrow 11 · Nov 12 · 2 min read

A Whole Game in One HTML File: How the Story Game Maker Packs It All

Climb out

A game you can just send someone

I wanted a maker for text decision games, choose your own adventure type stuff, where you can send the whole game to someone as a file and it plays pictures and sounds. They just double click it, no app or account and they don't even need this website.

Everything is inside one file

A downloaded game is one .html file with the story saved as data (every scene, choice and item), the pictures and sounds turned into long strings of text so they fit in the file, and a tiny player which is the same one that runs Play test on the site.

tools/story-game-maker.htmlKeeping pictures from making it huge
const k = Math.min(1, 1600 / Math.max(img.naturalWidth, img.naturalHeight));
// ...draw it on a canvas at that size, then:
let out = cv.toDataURL('image/webp', 0.85);
if (!/^data:image\/webp/.test(out)) out = cv.toDataURL('image/jpeg', 0.85);

Since every picture lives inside the file big photos add up fast, so anything over 1600 pixels gets shrunk and saved as WebP (or JPEG if the browser can't do WebP). The story check also warns you if the game is over 10 MB cause that's the free Discord upload limit.

The Story Game Maker with the scene list, the scene editor and the picture and sound pickersThe maker

Scenes on the left and the one you're editing on the right. That's the example game it comes with.

Opening it again later

Since the story's stored as plain data in the game file the maker can read it back out, so you hit Open a game file, pick one you downloaded and you can edit it again.

Keys and locked doors

A scene can give you an item or take one away and any choice can only show up if you have something or if you don't, so you can do stuff like Unlock the door only showing once you found the key. Going back undoes items too so you can't grab the key twice lol.

Endings and music

Any scene with no choices is an ending, so you can have good endings, bad endings and secret ones. Music keeps playing across scenes till you change it, and you can put sound effects on the big moments.

The story check

Before you send it there's a Story check that looks for stuff you'd miss, like a choice that needs an item no scene ever gives you, and it shows how big the file is. It also autosaves in your browser so you don't lose a whole story if you close the tab.

The burrow ends hereClimb back up to the surface