TECHNOMANCY TAVERN

Esper Elfy: Save Sparky · Post 03 · Design

Outline First, Then Real

How to warn someone you are about to hurt them, with a cheerleader made of fire.

Every fight in this game starts with a lie of omission. The boss winds up, the room goes quiet, and for a few tenths of a second nothing happens. That gap is not lag. It is the warning, and it is the most important thing we draw.

The rule

In Esper Elfy an outline is a warning and a fill is real. If you can see the dashed edge of a thing, it is about to be there. If it is filled, it is already there. That was a rule from the first box (see post 1), and it has outlived every art style since.

Three kinds of warning

  1. A mark where it will land. A dashed ellipse, a ring, a circle on the floor.
  2. A lane. A dashed line at the height a shot will fly. Head height means crouch; foot height means jump.
  3. The attack itself, as an outline. Zip Zephyr blinks, and a dashed edge of her whole body appears where she is about to be. That one needs a function that draws the attack, notes which pixels changed, undoes it, and then paints only the edge:
// a warning outline of a whole figure: only the edge of whatever drawFn paints, dashed
function outlineOf(drawFn, c, a) {
	const sav = col.slice(); drawFn(); const mask = new Uint8Array(N);
	for (let p = 0, i = 0; p < N; p++, i += 3) if (col[i] !== sav[i] || col[i + 1] !== sav[i + 1] || col[i + 2] !== sav[i + 2]) mask[p] = 1;
	col.set(sav);
	for (let p = 0; p < N; p++) { if (!mask[p]) continue; const x = p % W; if ((x > 0 && !mask[p - 1]) || (x < W - 1 && !mask[p + 1]) || !mask[p - W] || !mask[p + W]) put(x, Math.floor(p / W), c, a); }
}

From kits/anime.js. drawFn is whatever draws the attack for real, so the warning can never drift out of sync with the thing it warns about.

The flicker and the flash

A still outline reads as decoration. A flickering one reads as alarm. About 60 of the 69 fight files use the same blink: on most of the time, off just often enough to notice (Math.sin(t * 30) > -0.2). For lane warnings, the dashes also turn white in the last tenth of a second before the hit. White means now.

The cheerleader who spells doom

Pom-Pom Pyra's cheer is the cleanest example in the game. She shouts GIMME A G, and a giant letter G is outlined on the floor where you are standing. A moment later it falls on that spot, burning. The warning and the attack are the same shape, and the only difference is whether it is outlined or filled. In code, the whole difference is one branch in bigLetter:

if (mode === "warn") { if ((edgeX || edgeY) && ((px + py) & 1) === 0) put(px, py, "#ffffff", on ? 0.9 : 0.35); continue; }

In "warn" mode a pixel is drawn only if it sits on an edge and on a checkerboard, flickering. Any other mode fills the letter with fire. The timing lives in the caller:

if (t > at - 0.6 && t < at) { bigLetter(ch, lx, ly, s, t, "warn"); const k = (t - (at - 0.35)) / 0.35; if (k > 0) bigLetter(ch, lx, lerp(-40, ly, k * k), s, t, "fire"); }

The outline appears 0.6 seconds before the letter lands, and the burning letter starts falling 0.35 seconds before it lands. Six tenths of a second is the warning; the last third of it you can watch the danger arrive.

Live demo: Pom-Pom Pyra, running in your browser. Click it, then press S for quarter speed and watch the first letter.

Try it

Slow the demo down and count the flickers before the first letter lands. Then in realms/10-rooftop/fights/pyra.js change at - 0.6 to at - 0.2 and rebuild. That is how fast "hard" turns into "unfair", and the gap between those two numbers is where most of our balancing happened.