Skip to content

Slice 17.5: Playable browser game (InteractiveActionSource + game content) #56

Description

@Jamerrone

What to build

Build the playable browser game on top of Slice 17. The player can place, sell, and upgrade Towers; drag rally points; override targeting strategies; and send waves manually. Player input is buffered into a new InteractiveActionSource that implements the same ActionSource interface Slice 17 introduces — so the loop, renderers, and engine are unchanged.

The game has its own content directory (e.g. demos/game/data/, one map is fine for this slice) with zero overlap with demos/shared-data/, which is consumed by tests and the CLI/replay demos. Gameplay tuning must not destabilise tests.

The game records the player's actions into a transcript that can be exported (JSON download). This closes the bug-report loop: a player encountering a bug can hit "export transcript", attach it to an issue, and the maintainer replays it deterministically via the transcript-replay browser demo from Slice 17, loaded with the game's content set.

UX decisions to pin in grilling:

  • Tower picker pattern (sidebar palette vs click-to-cycle vs tile-context-menu)
  • Upgrade tree visualization (DAG of prerequisites + exclusiveGroup labels)
  • Rally-point drag affordance (per ADR-0010 / Guard plugin)
  • Targeting / attack-selection strategy controls per Tower
  • Wave-send button placement and feedback for WaveTrigger.kind === "manual" vs "hybrid"
  • Placement preview UX (PlacementMode validation feedback before commit)
  • Error feedback for failed PlayerAction dispatches per ADR-0014
  • Entry flow: default route is the game; replay demo is a secondary route (/replay) used for bug-repro
  • Project layout: one Vite project with two HTML entries (recommended) vs two Vite projects
  • Script naming: consistent and clear about what each script produces (game / replay / CLI). Derived from the project-layout decision.

Acceptance criteria

  • A grilling session (/grill-with-docs) is run on this issue before implementation to pin the UX decisions above. The decisions are posted as an Agent Brief comment, after which the issue moves from ready-for-human to ready-for-agent.
  • An InteractiveActionSource class implements the ActionSource interface introduced in Slice 17. It buffers PlayerAction values produced from DOM input handlers and dispenses them on the next tick boundary via actionsForTick(tickIndex).
  • The full built-in PlayerAction set is wired: placeTower, sellTower, purchaseUpgrade, moveRallyPoint, overrideTargeting, sendNextWave.
  • No engine or BrowserDemoLoop changes are required — only new UI / renderer additions and the new ActionSource.
  • The game ships its own content directory, separate from demos/shared-data/. Tests and the CLI demo continue to consume shared-data/ unchanged.
  • package.json scripts are renamed so each script's name makes clear what artifact it produces (game vs replay browser demo vs CLI transcript demo). Specific names pinned in grilling alongside the project-layout decision.
  • The playable game and the transcript replay demo coexist — either as routes within one Vite project, or as separate Vite projects. Pinned in grilling.
  • Recorded player input can be exported as a transcript.json matching the shape used by the CLI demo and Slice 17.
  • An exported transcript loaded into the replay demo produces the same outcome on replay (closes the bug-report loop end-to-end). Replay loads from whichever content directory the transcript was recorded against.
  • All ADR-0014 ActionResult feedback (ok: true, effect / ok: false, code, message, hint) is surfaced to the player in the HUD.
  • Headless test covers a minimal interactive flow (e.g., place one Tower via simulated click, dispatch one wave, assert state changes) — proves the input path works end-to-end without needing a human.
  • No regressions on tests from earlier slices.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions