Vibe Coding, Demonstrated: We Rebuilt 1981's Defender From One Prompt

We handed an AI agent a one-page brief and got back a playable remaster of the 1981 arcade classic Defender. Play it, read the full prompt, build your own.

Last week, between client calls, we ran an experiment we have been meaning to run for months: write one careful brief, hand it to an AI coding agent, touch the keyboard as little as possible, and see whether what comes back is a demo — or a game you would actually keep playing.

What came back is playable right now at hypermind.tech/defender. It is a single 2,300-line HTML file: a horizontal-scrolling remaster of Williams' 1981 arcade classic Defender, with the scanner minimap, humanoid abductions and rescues, smart bombs, hyperspace, a combo system, power-ups, CRT scanlines, persistent high scores, and a game-over flow that reliably returns you to the title screen. No frameworks. No build step. No hand-written code.

This post is about what that experiment actually demonstrates — the term the industry has settled on for it, where the approach genuinely works, where it falls over, and the full prompt so you can run the same experiment yourself.

Williams Defender arcade cabinet

The original: Williams' Defender (1981), widely considered one of the hardest — and best — arcade games ever shipped. Photo via Wikimedia Commons; history at Wikipedia. Our version is a fan recreation for demonstration purposes, not affiliated with Williams or Midway.

What "vibe coding" actually means

Andrej Karpathy coined the phrase in early 2025, and it named something a lot of us were already doing: describing what you want in natural language, letting the model write essentially all of the code, and steering by running the result and reacting to it — rather than by reading every line. You stay in the loop as a director, not a reviewer. When something is wrong, you describe the wrongness and let the agent fix it.

The term has since been stretched to cover everything from "I built a startup without engineers" to "I asked ChatGPT for a regex." The useful definition sits in the middle: vibe coding is trading line-level control for speed, on software where that trade is safe. The last clause is the one that matters, and it is the one the hype usually drops. We will come back to it.

The experiment, honestly reported

Our brief was a single markdown document — the kind of spec we would write for a human contractor, minus the pleasantries. It defined the world model (a wrapping toroidal playfield five screens wide), the full enemy roster with scores, the abduction-to-mutant pipeline that makes Defender Defender, weapon feel ("traveling arcade beams with white tips," not hitscan), a combo economy, power-up drop rates, the exact game-state machine, and ten acceptance criteria. It also said what not to build: no copyrighted assets, no multiplayer, no pixel-perfect ROM accuracy.

One agent session later we had a playable build. Honest tally of what happened next:

  • Worked on the first run: flight model, terrain, scanner, landers abducting humanoids, laser feel, smart bombs, wave progression, the CRT toggle. Roughly 90 percent of the spec, playable in the first sitting.
  • Needed a second pass: the game-over flow — the one part of the spec we had marked "must work reliably," because arcade recreations chronically soft-lock there. The first build occasionally ate the death animation. We described the symptom in one sentence; the fix came back correct.
  • Needed taste, not typing: difficulty pacing and screen-shake intensity. We tuned numbers by playing, then told the agent which numbers to change. At no point did we open the file and edit code by hand.

Total wall-clock time was an afternoon, most of it spent playing the thing — which is either quality assurance or procrastination, depending on how generous you are feeling.

The unfashionable secret: it is mostly the spec

Here is the part the "I built an app while walking my dog" posts skip. The reason this worked in one session is not model magic. It is that the brief reads like a product requirements document written by someone who has shipped software: explicit mechanics, explicit scoring tables, explicit failure modes, explicit acceptance criteria, explicit non-goals.

We have spent two years telling clients that the quality ceiling of AI-assisted work is set by the clarity of what you feed it — in RAG systems, in Copilot rollouts, in agent deployments. This little game is the same lesson in a louder shirt. A vague prompt gets you a demo that falls apart at the edges. A spec with acceptance criteria gets you software that survives its own game-over screen.

If you take one transferable thing from this post, take that: the prompt is a spec, and spec-writing is still the job. The agent removed the typing, not the thinking.

Where vibe coding belongs — and where it does not

We would happily vibe-code: prototypes and proofs of concept, internal tools with no external users, one-off data utilities, marketing pages, and, evidently, arcade tributes. The blast radius of a bug is an eye-roll.

We would not vibe-code — in the "nobody reads the code" sense — anything that touches customer data, money, identity, or compliance. Not because models write bad code, but because unreviewed code with real blast radius is a liability whoever wrote it. In production work the AI still writes most of the lines; what changes is everything around the lines: threat models before GA, evaluation harnesses, security review, rollback plans, an owner who can be paged. We wrote about that discipline all through 2024 and 2025, and a fast agent does not repeal any of it.

That is the honest frame for the game below: it is a demonstration of velocity, published with exactly the seriousness a space shooter deserves — and none of the controls we would insist on for your billing system.

The full prompt

Everything below is the verbatim brief that produced the game. It is free to use. Paste it into Claude Code, Cursor, or whatever agent you run, with an instruction like: "Implement this as a single index.html. Match the acceptance criteria. Prefer a complete playable game over incomplete perfection."

# Prompt: Build “Defender” (1981 Arcade) — HTML5 Remaster

Use this document as a single brief for building the game from scratch.

---

## Goal

Build a **single-file HTML5 Canvas game** inspired by **Williams Electronics’ Defender (1981 arcade)**. It should feel like the classic horizontal scrolling shooter: protect humanoids, use the scanner, reverse and thrust, smart bombs, hyperspace — while adding **modern remaster polish** (combos, power-ups, CRT, pause, high scores, juice) without losing the arcade vibe.

**Deliverable:** one `index.html` with embedded CSS + JS (no frameworks, no assets required beyond optional Google Fonts). Playable by double-clicking the file or serving statically.

**Tone:** fan recreation / remaster — not an official port. Small footer: “Fan recreation · not affiliated with Williams / Midway.”

---

## Visual & presentation

- Canvas **960×600**, black space, pixel-ish feel (`image-rendering: pixelated` ok).
- Font: **Press Start 2P** (or similar bitmap font).
- Top strip: **scanner / minimap** (~56px) showing the whole wrap-around world: terrain silhouette, humans, enemies, pickups, ship, base, and a white “view window” for the camera.
- Playfield below: stars, planet surface, ships, lasers.
- Title header outside canvas optional: **DEFENDER** in red neon; subtitle “1981 ARCADE · REMASTERED”.
- External HUD under canvas: SCORE, WAVE, LIVES, BOMBS, COMBO, HI.
- Optional **CRT mode**: scanlines, vignette, subtle RGB edge fringe (toggleable, default on).
- Dense **multi-layer parallax starfield** (~400–500 stars), twinkling.
- Green jagged **terrain** line with dark fill; flattened pad under the base.
- **Screen shake** on hits/explosions/smart bomb (toggleable).
- **Hit-stop** micro-freeze on kills for juice.

---

## World & camera

- World width ≈ **5× screen width**, **wraps horizontally**.
- Camera follows ship; bias slightly ahead based on facing (more space in front of the ship).
- `wrapX`, `worldDelta`, `distX` helpers for toroidal X math.
- Terrain generated from a height array; `terrainY(worldX)` for collision/landing.
- When all humans die: **planet destroyed** — terrain becomes void, mutants flood; clearing that wave **restores planet + humans**.

---

## Classic controls (keyboard)

| Input | Action |
|--------|--------|
| ↑ / W · ↓ / S | Altitude |
| ← / A · → / D | Face that direction **and** thrust |
| Shift | Thrust in current facing (arcade-style) |
| Z | Reverse flip only (baiter trick) |
| Space (hold) | Fire laser rapidly |
| B / X | Smart bomb |
| H / C | Hyperspace |
| Enter | Start / confirm |
| P / Esc | Pause / options |
| M | Mute sound |

Prevent arrow/space default scrolling.

---

## Player ship

- Start with **3 lives**, **3 smart bombs**.
- Extra life **and** bomb every **10,000** points.
- Physics: thrust accelerates in facing direction; coast/friction when not thrusting; vertical move is direct (joystick-style).
- Clamp altitude between scanner bottom and terrain.
- Invulnerability frames after spawn / hyperspace / shield break (blink sprite).
- **Thrust flame** + optional **engine trails**.
- Death: big multi-layer explosion, shake, flash; drop carried human as falling if any.

### Weapons

- **Laser:** traveling horizontal bolts (not pure hitscan), ~arcade feel:
  - Pink → cyan beam body, **bright white tip**, soft glow.
  - Travel across screen; destroy **first** enemy hit; impact sparks.
  - Hold-to-fire ~10–12 shots/sec; **rapid power-up** faster; **multi** fires 3 parallel beams.
- **Smart bomb:** destroys all enemies (and enemy bullets) **currently on screen**; mines stay; flash + heavy shake; limited stock.
- **Hyperspace:** random teleport; **~25% chance of death** on re-entry (Asteroids-style risk).

---

## Humanoids, base, rescue

- **10 humanoids** on the surface, walk slowly.
- **Landers** seek free humans, descend, grab, ascend; if they reach the top of the screen → human dies and a **Mutant** spawns.
- Player can:
  1. Shoot a lander mid-abduction → human **falls**.
  2. **Catch** falling human (500 pts) or let them land gently (250) / splat if too fast (dead).
  3. **Pick up humans from the ground** by flying low over them (remaster QoL).
  4. **Deliver** carried human to a visible **BASE** (landing pad with towers, beacons, “BASE” label, scanner green blip) for **500** and deposit them safely.
- On-screen hints: “CARRY TO BASE” / “LOWER TO DELIVER”; drop zone highlight when near base while carrying.
- Scanner: humans pulse red while abducted; **HUMANS n** counter (red if ≤3).
- Edge warning: **⚠ ABDUCTION** when any lander is carrying someone.
- Every **5** successful rescues/deliveries: **+1000 rescue streak** bonus.
- Wave clear with all humans still alive: **PERFECT WAVE +2000**; otherwise survivor bonus.

---

## Enemies (classic roster)

| Enemy | Behavior | Score |
|--------|----------|-------|
| **Lander** | Seeks/grabs humans, shoots player | 150 |
| **Mutant** | Aggressive chaser + shots (abducted human or planet-dead wave) | 150 |
| **Bomber** | Flies horizontally, drops **indestructible mines** | 250 |
| **Pod** | Floats; when shot releases **4–7 Swarmers** (smart bomb may skip spawn + bonus) | 1000 |
| **Swarmer** | Small fast chasers | 150 |
| **Baiter** | Spawns under time pressure late in wave; very fast pursuer + shots | 200 |

- Wave scaling: more landers over waves; bombers from wave 2; pods from wave 2–3+.
- **Baiter timer** pressure if the player lingers; wave clears when non-baiter aliens are gone (baiters discarded on clear).
- Being hit by enemy bullet awards **+25** (classic oddity) then kills the ship (unless shield).

---

## Scoring (base values × combo mult)

- Enemy values as table above.
- Catch falling human 500; safe fall 250; deliver to base 500.
- Combo: each kill extends a ~2.4s timer; multiplier rises (up to **x8**); combo bar under scanner; floating “COMBO xN”.
- Floating combat text: `+150`, `+500 DELIVER`, etc.
- Track max combo, rescues, wave for game-over stats / high scores.

---

## Modern remaster systems

### Power-ups (drop ~14–25% on kill, slightly higher with combo)

| Type | Effect |
|------|--------|
| **Shield (S)** | Bubble; absorbs one fatal hit then breaks |
| **Rapid (R)** | Faster fire rate for several seconds |
| **Multi (M)** | Triple beam for several seconds |
| **Bomb (B)** | +1 smart bomb (cap ~9) |
| **Magnet/Tractor (T)** | Larger pickup radius; pulls pickups toward ship |

Pickups bob, glow, blink near expiry; HUD timers bottom-left.

### Meta / UX

- **Attract / title:** scrolling stars + terrain + base; big DEFENDER title; blinking PRESS ENTER; feature rotation text; **Hall of Fame** top scores.
- **Pause menu:** Resume; toggle CRT, Sound, Screen Shake, Ship Trails (persist in `localStorage`).
- **Mute** with M (persist sound preference).
- **First-wave tutorial tips** (controls, pickup, base, bomb, combo, power-ups).
- **Game over flow (must work reliably):**
  1. Last life lost → short death beat → freeze/clear threats.
  2. Full-screen dramatic **GAME OVER** (large red title, score, wave, max combo, rescues).
  3. ~0.9s input lock so death key doesn’t skip.
  4. Auto-return to title after ~6.5s (countdown bar) **or** Enter/Space/Esc.
  5. If high score: **initials entry** (3 chars) then clean return to title.
  6. `returnToTitle()` fully resets entities so Enter starts a fresh run.
- **High scores:** top 8 in `localStorage` (name, score, wave, max combo).

### Juice

- Layered explosions: particle bursts + expanding rings + noise SFX.
- Color-coded flashes (rescue green, bomb white, death orange/red).
- Off-screen threat chevrons left/right when enemies are just outside the view.
- Web Audio API beeps/noise only (no external audio files): fire, explode, bomb, rescue, UI, combo, death.

---

## Game states

`ATTRACT | PLAY | DEAD | WAVE | PLANET_BOOM | PAUSE | GAMEOVER | NAME`

- **DEAD:** short timer; if lives remain, respawn with invuln; if not, enter GAME OVER.
- **WAVE:** brief banner “WAVE n”, then PLAY.
- **PLANET_BOOM:** planet destroy sequence then continue.
- Never leave the player stuck: game over must always return to start.

---

## Implementation constraints

- Vanilla JS, one canvas, `requestAnimationFrame` loop, dt clamped (~0.05).
- No external game engines.
- Readable structure: input, audio, terrain, entities, update, draw.
- Performance: filter dead entities; culling with `screenX` before draw.
- Accessibility of controls: document on-screen; keyboard only is fine.

---

## Acceptance criteria

1. Can fly **left and right** fluidly with ←/→ thrust.
2. Scanner matches world and is useful for hunting landers/abductions.
3. Landers abduct → mutant path works; planet destroy/restore works.
4. Pick up humans from ground **and** mid-air; deliver only at **visible base**.
5. Lasers look like traveling arcade beams with white tips.
6. Smart bomb and hyperspace behave as specified.
7. Combos, power-ups, CRT, pause, mute all work.
8. On last death: **big GAME OVER**, then **auto or key return to title**, clean restart.
9. High scores persist across reloads.
10. Feels hard but fair; classic identity remains obvious in a 10-second glance.

---

## Optional stretch (if time)

- Wave-5 mini-boss variant.
- Difficulty select (Cadet / Arcade / Nightmare).
- Attract-mode demo AI.
- Touch controls for mobile.

---

## Non-goals

- Exact ROM pixel accuracy or original audio samples.
- Online multiplayer.
- Using copyrighted Williams assets/sprites.

---

## Reference

Classic behavior reference: Williams Defender (1981) — horizontal scrolling planet defense, scanner, thrust/reverse/fire/smart bomb/hyperspace, landers/humanoids/mutants/baiters/bombers/pods/swarmers. Remaster additions (base delivery, ground pickup, combos, power-ups, CRT, polished game over) are intentional modernizations on top of that fantasy.

---

## How to use this prompt

Paste it into an agent with something like:

> Implement this as a single `index.html` in the empty project folder. Match acceptance criteria. Prefer complete playable game over incomplete perfection.

For a **strict classic-only** build, omit the “Modern remaster systems” section and base-delivery/ground-pickup QoL; keep pure arcade deposit-on-any-ground and no combos/power-ups/CRT.

Now build yours

Run the experiment. Feed the brief to your agent of choice and see what lands — no two builds come back identical, and the differences are the interesting part: laser feel, difficulty curves, how each model interprets "juice." Strip the remaster section for a purist 1981 build, or bolt on a mini-boss. If you ship a variant, we would honestly love to see it — send a link.

And if the experiment leaves you wondering what a well-specified agent could do to your actual backlog — the internal tool nobody has time to build, the workflow that eats a half-day every week — that is the conversation we have for a living, with the production discipline included.

If you're facing this

If your team is somewhere between "we should try this AI coding thing" and "we tried it and the demo scared legal," we run AI-assisted delivery with specs, evals, and security review built in — the fun parts of vibe coding without the unreviewed-code hangover. Tell us what you want to build, or just go beat our high score first.

// related notes
// still relevant?

Facing a migration, platform, or AI build like this one?

If you are shipping something adjacent — RAG, agents, evals, Azure platform — send a brief. We reply within one business day with an honest read on fit.

Start a project →

← Back to notes