Making of the Blitz

Nice! You pulled off Sabin's Suplex Blitz. This page walks through how it was built, step-by-step, enjoy.

The site is static Astro with no UI framework, so everything below is plain TypeScript, CSS, a few PNGs, and three MP3s.

Step 1: Study the move, then storyboard it

Pin down what the move actually looks like in the game before writing any code. Step through gameplay footage frame by frame, then write the move down as beats in milliseconds. Every later decision checks back against that table.

Final Fantasy VI battle: Sabin Blitzes, lifts the Ghost Train off the screen, and slams it back down.
The Suplex in Final Fantasy VI: 53 frames at 100ms each.
msBeat
0Sabin slides in from the left on a slight arc
400"Suplex" window and Blitz sound; a white flare builds at his fists
800 to 1000Gold burst plays out
1000Hop onto the photo
1300Jump sound; he rises out of the viewport with the photo, turning it in 90° steps
1900Pixels start falling into the empty slot
2050He rides the pixelated photo back down from underneath, upside down
2400Landing sound, two-step screen shake, kneel, walk out left
2800Achievement toast

The pieces:

Step 2: Detect the input

Keyboard and touch both reduce to one vocabulary: up, down, left, right, a, b, x, y, tap. Keys go through a lookup table. A touch is classified when the finger lifts:

src/scripts/sequence.ts
/** Minimum travel (px) for a swipe; maximum travel and time for a tap. */
const SWIPE_MIN = 40;
const TAP_MAX = 10;
const TAP_MS = 300;

document.addEventListener('touchend', (event) => {
  const touch = event.changedTouches[0];
  if (!start || !touch) return;
  const dx = touch.clientX - start.x;
  const dy = touch.clientY - start.y;
  const distance = Math.max(Math.abs(dx), Math.abs(dy));

  if (distance <= TAP_MAX && event.timeStamp - start.time <= TAP_MS) {
    // Taps on links and buttons do their normal job and don't count.
    const target = event.target instanceof Element ? event.target : null;
    if (!target?.closest('a, button, input, select, textarea, summary, [tabindex]')) push('tap');
  } else if (distance >= SWIPE_MIN) {
    // Direction of finger travel: swiping up moves the finger up.
    push(Math.abs(dy) > Math.abs(dx) ? (dy < 0 ? 'up' : 'down') : dx < 0 ? 'left' : 'right');
  }
  start = undefined;
}, { passive: true });

Filter out input that isn't meant for you:

Don't call preventDefault, so arrows and swipes still scroll.

Matching is a rolling buffer with a suffix check. Append each input, trim the buffer to the sequence length, and fire when the buffer ends with the code.

src/scripts/sequence.ts
function endsWith(buffer: Input[], sequence: Input[]) {
  const tail = buffer.slice(-sequence.length);
  return tail.length === sequence.length && tail.every((input, i) => input === sequence[i]);
}

export function onSequence({ keyboard, touch }: Sequences, onMatch: () => void) {
  let buffer: Input[] = [];
  const length = Math.max(keyboard.length, touch.length);

  const push = (input: Input) => {
    buffer = [...buffer, input].slice(-length);
    if (endsWith(buffer, keyboard) || endsWith(buffer, touch)) {
      buffer = [];
      onMatch();
    }
  };
  // The keydown and touch listeners call push().
}

// The Suplex: X Y down up, or tap, tap, swipe down, swipe up.
onSequence({ keyboard: ['x', 'y', 'down', 'up'], touch: ['tap', 'tap', 'down', 'up'] }, onUnlock);

A stepwise "expect the next key" matcher breaks on X X Y ↓ ↑: the second X resets it. A suffix check always looks at the latest inputs, so mistakes fix themselves. There's no timeout either, so the code can be entered slowly, like in the game.

Step 3: Cut the sprites

Part of the Sabin sprite sheet on a teal background, with boxes around the frames that were cut.
The sheet at 2x. Gold boxes: the six Sabin frames. Cream boxes: two white flares and four gold bursts.
  1. walk
  2. walk
  3. stance
  4. hop
  5. lift
  6. kneel
The finished strip, sabin.png, at 4x.
src/scripts/suplex-animation.ts
/** Cells in sabin.png (16x24 each, facing left). */
const FRAME = { walk1: 0, walk2: 1, stance: 2, hop: 3, lift: 4, kneel: 5 };

const Z = innerWidth < 768 ? 3 : 4; // whole-pixel scale
const SW = 16 * Z;

const drawSabin = (frame: number, x: number, y: number, facingRight: boolean) => {
  sabin.style.backgroundPosition = `${-frame * SW}px 0`;
  place(sabin, x, y, facingRight ? ' scaleX(-1)' : '');
};
src/components/SuplexEgg.astro
.suplex-sabin {
  background-image: url('/sprites/suplex/sabin.png');
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

The Blitz needed one more step. The sheet holds only one side of each burst. Gameplay frame 17 shows the game mirrors it around its bright point, with a ray straight up and straight down. Each of the six frames (two white flares, four gold bursts) is mirrored four ways around that point, then cleaned up wherever mirroring doubled the vertical ray.

In game, frame 14: a white flare at Sabin's fists.One gold burst as the sheet holds it: rays on one side only.The same burst mirrored four ways around its bright point.In game, frame 17: the full gold burst over Sabin.
Frame 14's white flare; one gold burst as the sheet holds it; the same burst mirrored; frame 17 in game.

Step 4: Run everything off one timeline

The animation keeps no step-by-step state. render(elapsed) computes the whole scene from the elapsed time:

Time is quantized to 50ms steps, and positions snap to a sprite-pixel grid anchored on the photo. That's the choppy SNES feel, and it's why the photo lands exactly in its slot.

src/scripts/suplex-animation.ts
const STEP = 50;

// Snap to a sprite-pixel grid anchored on the photo, so the
// flying photo starts and lands exactly on its slot.
const snap = (v: number) => Math.round(v / Z) * Z;
const snapX = (v: number) => P.x + snap(v - P.x);

const render = (elapsed: number) => {
  const t = Math.floor(elapsed / STEP) * STEP; // hard 50ms steps
  if (t < beats.blitz) {
    const p = t / beats.blitz;
    drawSabin(walk, lerp(offLeft, standX, p), floorTop - Math.sin(Math.PI * p) * 4 * Z, true);
  } else if (t < beats.jump - 300) {
    drawSabin(FRAME.stance, standX, floorTop, true);
    // ...and the shine frame for this step
  }
  // ...the hop, lift, ride down, kneel, and walk out

  if (t >= beats.land && !landed) {
    landed = true;
    land(); // the one side effect: swap the photo
  }
};

// animateSuplex drives the scene on the page; the scrubber below calls render(t) directly.
const start = performance.now();
const tick = (now: number) => {
  const elapsed = now - start;
  if (elapsed >= beats.done) return scene.finish(); // land if needed, remove the overlay
  scene.render(elapsed);
  requestAnimationFrame(tick);
};
requestAnimationFrame(tick);

Drag through the timeline. This stage runs the same render function as the Bio page, at a smaller scale.

900ms: Blitz, gold burst

Why it holds up:

Supporting choices:

Step 5: Sync the sound

Create the Web Audio context inside the key press or tap, since browsers only allow audio after a gesture. Then schedule all three sounds up front against ctx.currentTime. Timers drift and audio clock times don't, so each sound lands on its frame. Sprites and sounds preload when the browser is idle, so the first run starts on time.

src/scripts/suplex.ts and src/scripts/sfx.ts
// Runs inside the key press or tap, so the browser allows audio.
const sfx = await createSfx(Object.values(SOUND));
if (sfx) {
  const at = (ms: number) => sfx.now() + ms / 1000; // seconds on the audio clock
  sfx.play(SOUND.blitz, at(TIMING.blitz));
  sfx.play(SOUND.jump, at(TIMING.jump));
  sfx.play(SOUND.land, at(TIMING.land));
}

// In createSfx: each sound starts at its scheduled time, not on a timer.
play: (src, at) => {
  const node = ctx.createBufferSource();
  node.buffer = loaded.get(src);
  node.connect(output);
  node.start(at);
},

Step 6: Pixelate the photo

The original photo.
The photo
The photo at 32 by 32 in the site's 16 colors; the face is lost.
Site palette: the face is gone
The photo at 32 by 32 in its own 16 colors at 15-bit depth; the face survives.
Its own 16 colors at 15-bit: kept

A build-time sharp script shrinks the photo to 32x32. It then picks the photo's own best 16 colors and rounds each to 15-bit SNES color. Mapping to the site's 16-color palette came first, and it lost the face. The page scales the result back up with image-rendering: pixelated, and CSS rests it upside down.

scripts/pixelate-photo.mjs
const small = sharp(SRC).resize(32, 32, { fit: 'cover', kernel: 'lanczos3' }).removeAlpha();

// The photo's own best 16 colors...
const quantized = await small.png({ palette: true, colours: 16, dither: 0 }).toBuffer();
const { data } = await sharp(quantized).removeAlpha().raw().toBuffer({ resolveWithObject: true });
// ...rounded to 5 bits per channel, expanded back to 8 the way SNES emulators do.
const pixels = Buffer.from(data.map((v) => (v & 0xf8) | (v >> 5)));

Step 7: Keep page state on the DOM

StateWhereWhat it does
runningclosureIgnores input mid-animation, so mashing can't stack runs
data-suplexedphoto <figure>CSS shows the real or pixel image
data-suplex-liftedphoto <figure>Hides the slot image while the photo is in the air
data-suplex-landedphoto <figure>First landing only: the toast, and the strip that links here

Step 8: Respect reduced motion, then test

How this page unlocked

The first landing reveals the "Unlocked: Making of the Blitz" strip under the nav with the same Bayer dither dissolve as the theme switch. Nothing is stored, so it's gone on reload. The page is unlisted and noindex.

src/scripts/secret-nav.ts
export function revealSecretNav() {
  const item = document.querySelector<HTMLElement>('[data-secret-nav]');
  const link = item?.querySelector('a');
  if (!item?.hidden || !link) return;
  item.hidden = false;
  // 16 Bayer dither levels over 800ms, the same keyframes as the theme switch.
  link.classList.add('nav__unlock--reveal');
  link.addEventListener('animationend', () => link.classList.remove('nav__unlock--reveal'), { once: true });
}

Credits

Bonus round

You read all the way down, so here's your reward: Zac Gorman's take on the Ghost Train, from his comic blog Magical Game Time.

Three-panel comic by Zac Gorman. The Ghost Train bears down on the party through thick smoke. Sabin squares up as a battle menu offers Suplex and Aura Bolt, and a party member behind him says 'Dude, seriously?' Close-up of Sabin's narrowed eyes: 'Bitch, I'm Mother Fuckin Sabin.'
Comic by Zac Gorman, from Magical Game Time