_Project dir ~/defender · target https://defender.arnao.ai · written 2026-11-21 (Claude Code, session defender) · status: plan, awaiting Byron's go_
Byron's ask (2026-11-21): a faithful browser build of Williams' 1981 Defender as an installable app at
defender.arnao.ai; a hotkey (O) that flips between the original look and a high-resolution modern look while the
game keeps running; an AI mode, available only after Google sign-in, where a model flies the ship and you can switch
between models (Anthropic's as the first family) as an experiment; and a plan that ships the exact replica first but is
built so the other two drop in without a rewrite.
Reference: the original game and its rules — https://en.wikipedia.org/wiki/Defender_(1981_video_game) · the enemy roster
and scoring on StrategyWiki — https://strategywiki.org/wiki/Defender · Jarvis on the design (Computer History Museum
oral history) — https://www.computerhistory.org/collections/catalog/102738171
Simulation, presentation and control are three separate layers from the first commit.
input shells simulation (the game) renderers (the look)
─────────────── ───────────────────────── ─────────────────────
keyboard ─┐ fixed 60 Hz step retro : 2D canvas, 320×256 logical,
touch ─┼─ intents ─► seeded RNG state ─► integer-scaled, 16-colour palette
gamepad ─┤ entities + planet + scanner hd : WebGL 2, particles, bloom,
AI pilot ─┘ input log (replayable) lit planet, debris physics
thrust, reverse, up, down, fire, bomb,hyperspace) once per tick and emits state. That is what lets an AI pilot sit beside the keyboard as just another shell.
game. That gives replays, ghost ships, server-verified high scores (re-run the input log) and, above all, a fair model
comparison: every model flies the identical wave.
notices. The HD renderer may add cosmetic physics (debris, shockwaves, humanoid tumble) but **never changes what the
sim does**, so a score in HD is a score in retro. A true "Newtonian physics" variant, if wanted later, is a *separate
labelled mode with its own scoreboard*, not a renderer option.
tab or a Node process, without any scheduled job (see §6 on the freeze).
One static site: index.html + sim.js + render-retro.js + render-hd.js + input.js + audio.js + ai.js
+ sw.js + manifest.webmanifest, plus two serverless routes (api/pilot.js, api/role.js). No framework, no build.
| Wave | Deliverable | Build time (my work) | Sittings* |
|---|---|---|---|
| 0 | This plan; domain claimed; project dir | done today | — |
| 1 | Faithful replica, installable PWA, keyboard + touch + gamepad, synthesized sound, Playwright tests, live at defender.arnao.ai | 2–3 h | 1 |
| 2 | HD renderer + O toggle (WebGL 2, particles, bloom, lit parallax planet, debris); attract mode; high-score table | 2–3 h | 1 |
| 3 | AI mode: Google sign-in gate + roles, commander/autopilot pilot, model switch (Haiku · Sonnet · Opus; Fable if the key allows), live cost meter, intent captions | 3–4 h | 1–2 |
| 4 | Experiments: replays + ghost ship, model league (on demand, headless), AI enemy commander, commentator voice | 3–4 h | 1–2 |
\* A sitting is one of my sessions under the 5-hour usage cap. Total roughly **10–14 hours of build time over 4–6
sittings**; Wave 1 playable the same day it starts. Each wave ships live before the next begins, so there is always a
working game at the address.
What "faithful" means here, so we can check it:
the top showing the whole planet, screen scrolls so the ship sits a third in from the edge it faces.
horizontal bolt that persists a few frames, 3 lives, 3 smart bombs, hyperspace with the original ~1 in 7 chance of death.
fast, homing, jittery), Baiter (arrives when a wave drags on, faster than you), Bomber (drops mines), Pod (bursts into
Swarmers when shot), Swarmer (small, fast, homing).
every Lander becomes a Mutant until wave 5 restores the planet; bonus per surviving humanoid at wave end; extra life and
smart bomb every 10,000.
sampled ROM audio.
Artwork is ours, drawn to match the silhouettes — no ROM assets (see §7).
gamepad; touch layout for the TriFold — left thumb column = up / down / reverse, right thumb = fire (hold) with
thrust as a second finger, bomb and hyperspace as small corner buttons you cannot hit by accident. Landscape locked
on phones. Haptics on Android only (iOS blocks web haptics, as found on Buzzer).
by default and marks the score.
same seed + inputs → same final state; a scripted 2-minute input log must end on the same score every run).
drawn as a lit ridge with parallax stars and a distant city glow, ship and enemies as high-resolution sprites with the
same silhouettes and hitboxes as retro so nothing plays differently.
?look=hd|retro sets the default; the choice isremembered per device.
against the retro silhouettes. Nothing generative runs during play.
(cheap, and it makes cheating require beating the sim rather than a form).
The honest design: the model is the commander, not the stick. A language model answers in 0.5–5 s; Defender ticks
60 times a second. So:
each humanoid (walking / being carried / falling, where); each enemy by type with position relative to the ship;
what the scanner shows off-screen.
bomb: bool, hyperspace: bool, why: "<one line>"}`.
fires on the policy. The autopilot alone, with a fixed heuristic, is also the attract mode and the "no model" baseline.
why line is shown as a HUD caption: "Opus: breaking right, Lander at 40 % height with a humanoid." That iswhat makes watching it fun and makes model differences visible.
Model switch: a menu (M) listing Haiku 5.5 · Sonnet 5.5 · Opus 5.5 · Fable 5.1 (if the key permits), plus
"Autopilot only" and "Human" — switchable mid-game, so you can hand the ship to Opus when you are about to die and take
it back. Later families (Gemini, GPT) are one adapter each.
Sign-in and roles — reuse the fleet's Google broker (auth.arnao.ai; cookie is valid on every arnao.ai host; api/role.js
forwards it to /api/verify exactly as brain.arnao.ai's api/lens.js does, no new auth code):
| Role | Who | Gets |
|---|---|---|
| anonymous | anyone | the whole game, both looks, local high scores |
| signed-in | any Google account | AI mode on Haiku, 3 AI games a day, scores on the shared board |
| owner | Byron | every model, mid-game switching, league runs; a daily dollar cap (default $5) that the meter enforces |
Cost, so it is never a surprise — the HUD shows a live meter and the game stops the model (autopilot takes over) at the
cap:
| Model | Roughly per order (≈1.5 K in / 100 out, cached system prompt) | 5-minute game at 1 order/s |
|---|---|---|
| Haiku 5.5 | $0.0002 | about $0.06 |
| Sonnet 5.5 | about a third of Opus | about $0.80 |
| Opus 5.5 | $0.008 | about $2.40 |
Server: api/pilot.js on the Vercel project, Anthropic key as a Vercel env var (the trust project already works this
way), 30 orders/min per account, hard daily cap per role. The key never reaches the browser.
20× speed, then publishes a table at /league — score, humanoids saved, waves reached, dollars spent, per model. Runs on
demand in the tab, so it is not a scheduled job (freeze-safe, §6).
Baiter is released). Opus flies, Haiku commands the enemies, or the reverse. One call per wave, so cheap enough for
signed-in guests too.
free; ElevenLabs if we want a real voice). Latency does not matter here, which is why it works.
Bros. Games. A public page at defender.arnao.ai using the name and look-alike graphics is a homage with real takedown
exposure, especially with sign-in and a scoreboard. Mitigations built into Wave 1: no ROM code, sprites or samples;
our own pixel art; a clear "unofficial homage, non-commercial" line; no Williams logos. Byron's call: keep the
name as a tribute (fine for a personal site, accept the small risk) or ship under a sibling name (e.g. Sentinel,
Defend) with the original credited. See §8.
cover screen in landscape is 900×412 logical; thumbs cover about 25 % of it. Wave 1 budgets real time for the touch
layout and tests it on both fold states before anything else is polished.
is impossible to add later.
labelled mode with its own board.
Anthropic key goes on the defender Vercel project the same way trust's does; I will copy it at Wave 3 and say so.
league runs on demand in the browser, not on a schedule; a nightly league is a January item.
api/pilot.js; the key neverleaves the server; the cap is enforced server-side, the meter is only the display.
retro font scaled up rather than kept at 8 px authenticity.
| Risk | Likelihood | Handling |
|---|---|---|
| Takedown over the name/look | low for a personal site, not zero | §3.1; rename is a one-line change; artwork is ours |
| Touch controls feel bad | medium | the whole of Wave 1 step 5 is this; two layouts to pick from on the real device |
| Model orders too slow to matter | medium | the autopilot handles reflexes; the order rate is tunable; captions make the model's role visible either way |
| Opus costs more than expected | low | hard server cap per role; meter on screen; Haiku default |
| WebGL 2 on the TriFold | low | BrainPhotos already runs WebGL 2 there; retro renderer is the fallback |
| Scope creep into Wave 4 before Wave 1 is solid | high (it is fun) | each wave ships before the next starts |
commander will look clumsy against it. Answer: that clumsiness is the experiment, shown honestly with captions; the
attract-mode autopilot gives a human-free baseline so the model's judgement is what varies.
it a repeatable experiment rather than a party trick; if Wave 3 is not fun on its own, Wave 4 should be reconsidered,
not assumed.
day one; HD sprites checked pixel-for-pixel against the retro ones.
determinism this plan needs; the sim is small (under 1,500 lines) and ours to own.