Neon Pinball
A synthwave pinball machine in a dark arcade, live in 3D with real ball physics: pop bumpers, slingshots, drop targets, a spinner and a wire-return ramp. An auto-player cradles and aims its shots; take over with the keyboard or by tapping.
Made in Claude Code (Claude subscription) with claude-opus-5.5. The agent wrote code, looked at the preview and fixed it over several iterations. This is not a single-shot result: comparisons on this site show models in one attempt.
Starting prompt
Build "Neon Pinball": a real-time 3D pinball machine in a dark night arcade that plays itself from the first frame and can be taken over by the viewer. It should look like a polished showcase, with real proportions and glossy materials, never toy-like. Single self-contained HTML file; Three.js and its addons from a CDN via an import map are fine; build everything procedurally (canvas textures are fine), no external models, images or audio.
The machine (1 unit = 10 cm, y up; the playfield is about 4.8 × 10.5 units, tilted 6.5° up away from the player):
- A black lacquered cabinet on four legs, with chrome side rails, a lockdown bar, a lit coin door, a plunger knob and neon-striped side art.
- The playfield, painted on a canvas: a striped synthwave sun over a magenta perspective grid, mountains, stars and a purple nebula, with tinted plastic inserts (arrows, circles, the lane letters N-E-O-N, bonus 2X–5X, SHOOT AGAIN, JACKPOT) and small labels. It is glossy: it mirrors everything standing on it (a planar reflection with a Fresnel term), it is lit by soft coloured pools of light from the bumpers, slingshots and inserts, and the ball casts a soft shadow on it.
- Walls with a pink-to-violet-to-cyan LED strip along the top edge, a rounded top arch, and a shooter lane on the right with a spring plunger and a one-way gate.
- Two white flippers with pink rubbers, tapered and about 0.8 long; two slingshots (a white rubber band around three posts under translucent violet plastic with a neon edge); three pop bumpers (cyan, pink and amber caps with a star, a chrome ring and a coloured skirt); a bank of four drop targets; a spinner in the left orbit lane; left and right orbit lanes; four top rollover lanes; rubber posts, wire inlane guides and an apron with instruction cards.
- A clear plastic ramp with cyan neon edges that climbs about 10 cm, makes a U-turn and returns as a chrome wire habitrail into the right inlane.
- A backbox with a glowing backglass ("NEON" in neon-tube lettering, "PINBALL", the synthwave sun and grid) and an orange 128×32 dot-matrix display drawn by a shader. It shows the ball number, AUTOPLAY or PLAYER 1 and the score in large digits, plus short animated messages (RAMP!, JACKPOT, ORBIT, BALL SAVED, BONUS, GAME OVER).
- The room: a dark arcade with dimmer sister machines on both sides, each with its own backglass, and a carpet with a purple light spill.
The physics (2D on the playfield plane, fixed sub-steps of about 600 Hz):
- Gravity pulls down the tilted playfield. A steel ball of radius 0.135 collides with walls, posts and the rotating flippers, whose surface speed is added to the bounce.
- Pop bumpers and the slingshot faces kick the ball. Drop targets fall when they are hit hard and reset once all four are down. The spinner spins with the ball's speed and scores every half turn.
- The ramp is a 3D path that the ball rides with gravity along its slope; if it is too slow, it rolls back out.
- Plunger launch, a drain between the flippers, a short ball save, three balls per game, bonus × multiplier when a ball drains, game over and a new game. If the ball rests anywhere for two seconds, nudge the table.
- Run the simulation at about 0.8× real time so it stays readable.
The auto-player:
- It flips, with slightly random timing, just before the ball reaches a flipper, or when a rolling ball reaches a chosen point along it.
- It often catches and cradles the ball, pauses, then releases it and shoots a planned shot (the ramp, an orbit or the drop targets) by flipping when the ball has rolled to a measured fraction of the flipper. It launches with a random plunger strength.
- It plays from the first second and loses a ball now and then, like a person.
The look:
- Deep blues and purples with hot pink, cyan, violet and amber neon. ACES tone mapping; bloom only on the lights (LED strips, bumper caps, inserts, display, backglass), never on the painted playfield.
- A small procedural environment map for the chrome and lacquer, and a small live cube map so that the chrome ball reflects the real table.
The camera: the classic player view from behind the lockdown bar, with a slow cinematic drift. Over about 46 seconds it moves between a close view of the playfield and the display and a wider view that reveals the whole backbox and the neighbouring machines, and it leans slightly toward the ball. On a portrait phone it shows the whole machine from a higher angle.
Interface:
- The title and a one-line caption of what is happening, for example "Autoplay · ball 2 of 3 · ramp shot", "pop bumpers" or "cradled · lining up the ramp", plus a small hint line.
- Keyboard: Left/Z and Right/M flip, and holding then releasing Space launches the plunger. On a phone, a touch on the left or right half of the screen flips that flipper, and a touch while the ball waits at the plunger pulls and launches it. The auto-player takes over again about seven seconds after the last input.
- Drag to orbit and scroll to zoom; the camera returns to its path a few seconds after the last input.
- Everything starts automatically and is visibly moving from the first frame, without any interaction. The layout works on a phone. It runs in a sandboxed iframe: no storage, alerts or extra network requests.
Engineering rules (the page must work on the first load, with no fixes):
- Use Three.js r170 and only methods that exist on each of its classes. Give every custom ShaderMaterial `fog: false`, and declare every uniform, constant and varying its shaders use.
- Declare each identifier once. Inside one calculation, never reuse a shared scratch vector for two values that are both still needed; use local vectors.
- Guard every animated value against NaN.
- Answer with the complete file exactly once, in a single ```html code block: no drafts, partial snippets or notes.
Keep planning brief and write the code. Aim for roughly 900 to 1,300 lines, compact and well structured.