axiom-ai

Tower Defense

A small, complete tower defense game with waves, upgrades and a procedural map.

Build log

Status

Not started. This log is written by Claude Code during the cloud session that builds the demo, then lightly edited.

The brief

The prompt the session received, verbatim, and a link to the cloud session and PR.

Approach

What was chosen and why. Alternatives considered. Anything reused from open source, with license and link.

Timeline

Short dated entries as the work progressed: what was tried, what broke, what fixed it.

Numbers

Rough wall-clock time, number of turns, tokens or cost if known, bundle size, frames per second on a laptop and a phone.

What I would do next

Known gaps, stretch goals, ideas.

Original spec

Tower Defense

Build a small, complete, polished tower defense game in projects/tower-defense/demo/index.ts following the demo contract in CLAUDE.md.

Goal

A game a visitor can play to a win or a loss in 5 to 10 minutes, that feels finished: readable visuals, satisfying feedback, no dead ends.

Technology

Vanilla TypeScript with Canvas 2D is preferred. Phaser 3 is allowed if you judge it saves significant time; if you use it, lazy-load it inside mount() so other pages do not pay for it. No external asset downloads at runtime: draw everything procedurally (shapes, gradients) or inline tiny SVG/PNG under demo/assets/.

Must have

  • Procedurally generated map on each new game: a grid (about 20 x 12 cells) with one winding path from entrance to exit, generated so it is always solvable and visually interesting. Buildable cells are the rest.
  • Three tower types with distinct roles: a fast single-target tower, a slow splash tower, and a slowing or debuff tower. Each has 3 upgrade levels that change stats and look.
  • Three enemy types: basic, fast and tanky. Enemy health bars.
  • 20 waves with escalating counts and mixes, a boss on waves 10 and 20. A “send next wave early” button that grants bonus gold.
  • Economy: starting gold, gold per kill, tower cost, upgrade cost, sell for 70 percent.
  • Lives: enemies reaching the exit cost lives; zero lives is game over. Win screen after wave 20 with score and time.
  • Input: click or tap a cell to open a build menu; click a tower to upgrade or sell; keyboard shortcuts 1/2/3 for towers, space to send wave, p to pause.
  • Game speed toggle 1x / 2x / 3x. Pause and restart.
  • Juice: projectile animations, hit flashes, death particles, floating gold numbers, screen shake on boss death. Keep it light.
  • Sound: optional, off by default, generated with the Web Audio API (no audio files). A mute toggle.
  • Works on a phone in portrait: the map scales to fit, touch targets are large enough.

Should have

  • Local high score and best wave in localStorage.
  • A short in-game “how to play” overlay on first launch.

Stretch

  • A second map style or themed palette.
  • Tower targeting modes (first, strongest, closest).

Acceptance

  • npm run check and npm run build pass.
  • Can be played start to finish without a bug; losing and winning both work and restart cleanly.
  • 60 fps at 3x speed on a laptop during a large wave.
  • project.json status set to live, BUILD-LOG.md complete per CLAUDE.md, with a GIF or screenshot in media/ if you can produce one.