BREAKOUT

CABINET BX-400 · 400×600 · 8×4
LIVE STATE ATTRACT FPS 60 HI 000
MODEL BX-400● POWER ON
320 PTS MAX · 3 LIVES
Your browser does not support the canvas element.
AABB · ΔV=0 · 60FPS
INSERT COIN

BUILD NOTES / ENGINEERING

Three collisions, one axis, zero drift.

No physics library. Every bounce is resolved by hand so the ball keeps a constant speed magnitude, never tunnels, and never lodges inside a brick.

01

Fixed timestep with substepping

Simulation runs at a locked 1/60s step (accumulator + guard against spiral of death), split into 2 substeps. Movement per test is ≈1.7px, far below the 20px brick height — no tunnelling on fast phones.

02

Closest-axis resolution, one hit per frame

Circle vs box uses clamped-point overlap. The axis with the smaller penetration is the one actually crossed, so dx flips on flanks and dy on faces. The loop breaks on the first hit and ejects the ball by the penetration depth — a brick can never be hit twice, and velocity magnitude is preserved by renormalising after every bounce.

03

Paddle angle control

Contact offset rel = (ball.x − paddleCentre) / 30 maps to ±64°, so edges give shallow ricochets and the centre gives near-vertical returns. A floor on |dy| kills degenerate horizontal loops, and paddle velocity adds english before the vector is renormalised to the target speed.

04

Speed curve

Launch vector (2, −2.8) ≈ 3.44px/frame ramps to 3.95 across the 32 bricks — inside the 3–4px window, so difficulty rises without breaking the tuning budget.

05

Frame budget

Brick rows, ball glow and paddle are pre-rendered to offscreen sprites once; particles and score pops are pooled caps; device pixel ratio is clamped to 2; the context is opaque. Steady 60 FPS on mid-range mobile.

06

Input & edges

Pointer, touch drag (touch-action:none, preventDefault) and keyboard all feed one smoothed paddle target, clamped to 0…340. Canvas coords are derived from getBoundingClientRect() so the scaled CSS size never desyncs the hit test.