CANVAS BUILD · 400×600 · 8×4
000SESSION HI
READY
CRT · 400 × 600
MODEL BB-400VANILLA JS
HOW THE BOX THINKS

Thirty-two bricks,
zero libraries.

The whole cabinet is one HTML file. A single <canvas> holds every game pixel — bricks, paddle, ball, score, lives, and both end screens, including a canvas-drawn restart button with its own hit test.

FIELD 400 × 600 BRICKS 8 × 4 · 50 × 20 BALL r3 · 3.44 px/frame PADDLE 60 × 10 @ y580 DEPS NONE
  1. Gridlayout

    Bricks pack flush from y=48 — 8 columns × 50px, 4 rows × 20px. The render sprite is inset 2px so the eye reads 32 discrete blocks while the hitbox stays the exact grid cell.

  2. Sweepmarch

    Each physics tick is split into substeps capped at 1.5px. A ball moving 3.44px per frame can never tunnel a 20px brick, and no branch of the loop can skip a wall.

  3. Sideresolution

    Circle→AABB contact, then the shallowest penetration axis decides: flip dx for a side strike, flip dy for top or bottom. Only the deepest-overlapping brick resolves per substep, and velocity magnitude is never rewritten — only its signs.

  4. Anglepaddle

    Contact offset maps −1…+1 across the 60px face onto ±58°, plus a slice of live paddle velocity for slice shots. Dead-centre hits return a clean vertical, edge hits skim wide.

  5. Budgetperf

    A fixed 60Hz accumulator drives physics on any refresh rate; render runs once per animation frame. 32 bricks cost one drawImage each from a pre-rendered sprite. Backing store scales with devicePixelRatio, capped at 3×.

  6. Inputdevices

    Pointer capture and touchmove with preventDefault, so a drag never scrolls the page. Arrow keys ramp paddle velocity, tap launches, P pauses, R restarts. The keycaps above light up as you press them.