memorcade

How I built a video game gift in plain JavaScript, with no engine

2026-10-12

Most gifts are things. I wanted to build one that is a story: a short video game where the person you love is the hero, made from your own memories, ending with a letter from you. That became Memorcade. Here is how it works under the hood.

The idea in one paragraph

You add their name, their face, a few inside jokes, three moments (the night you met, a trip, your first place) and a letter. Memorcade turns that into a two-minute game. The inside jokes become billboards along the path, the moments become levels, their favorite things become collectibles, and the game ends with a photo booth strip of your photos and your letter typing itself out. They open it from a link: no app, no account.

No framework, one canvas

The whole game is plain JavaScript drawing to a single <canvas>. No engine, no framework. The build step inlines everything into one HTML file, about 350 KB gzipped.

The loop is a plain requestAnimationFrame with a variable timestep. The step is clamped to a tenth of a second, so a hiccup (a notification, a garbage collection) cannot teleport the player through a platform.

Rule one: never do expensive drawing every frame

The first version looked great on a laptop and stuttered on an older phone. The culprits were the usual ones: shadowBlur, ctx.filter, big gradients and text drawn every frame.

The fix was baking. Anything that does not change from frame to frame (the sky, distant hills, the gift box, glowing collectibles, the characters) is drawn once into an offscreen canvas at the device's pixel ratio, then copied with drawImage. Glows and shadows are baked into the sprite instead of being computed live. After that, a frame is mostly cheap image copies.

When a phone still cannot keep up

Baking was not enough for every phone, so the game also watches its own frame times. If the average over about three seconds drops below roughly 42 frames a second, the canvas resolution steps down. After about nine smooth seconds it steps back up, but it never climbs straight back to the level that was just too slow. One hiccup does not cost sharpness for the whole session.

Only the backing store is resized. The sprites are never re-baked, so the change is invisible apart from the picture getting slightly softer.

Fitting a whole gift into a link

A gift has text, settings and a handful of photos. It is packed into one URL-safe token: a version byte, a small JSON header for the words and settings, then typed blocks of JPEG data for the photos, all base64url encoded. Optional settings are left out when they have their default value, so old links keep working when new features are added.

On the hosted site the token is stored privately and the link is a short id, but the format is the same. That made testing easy: any gift can be replayed from its token.

The photo booth ending

With two or more photos, the game prints a photo booth strip between the finale and the letter, in one of four styles. Each style is a set of canvas operations (grain, tint, frame) applied once when the strip prints, then animated as it "develops". It can be saved to the phone as a full-size image.

Small things that made it feel like a gift

Tests are what made this workable

Before every deploy, browser tests play the main flow on a phone-sized screen and a desktop-sized one: making a gift, opening it, playing it through and reading the letter. Separate suites cover each game style, the photo strip and the checkout. Screenshots are part of the check, because a test can pass while the page looks wrong.

What I would do differently

The sample on the home page is free to play if you want to see it running.

How it was built: I directed and tested, and Claude (AI) wrote most of the code and helped write this post. The art and sound are drawn by code. There are no AI-generated images in the game.

Make her the hero of her own video game

Her face on the hero, your inside jokes on the signs, a photo booth strip and your letter at the end. Made in a few minutes, and sent as a link. Plays on any phone.

Free to make. $4.99 to send, or $9.99 with you and your voice at the end.

Start her game free

More from the blog