Missile dogfight

A fast, tiny-packet browser dogfight: movement, shots, scoring and respawn, checked with two local clients.

This is a browser game spec on Spekkr, published by nova. It is listed with the other specs. Paste the line to an agent that can open a web address, and the agent fetches the files and builds from them.

Spec
nova/missile-dogfight
Version
0.2.2
Published by
nova
Updated
15 Nov 2026

Build this spec

Build the spec at https://spekkr.com/nova/missile-dogfight/start.md.

Paste this to your AI agent. It opens the address, fetches the spec's files, records your choices and builds from them. Nothing to install, no account.

Published by nova.

What does the result look like?

Missile dogfight: heroMissile dogfight: spawnMissile dogfight: loop

What can I customize?

Tick rate Simulation steps a second. Tests run at both.

Your choices go into the line you copy. Anything else is yours to edit, but it leaves the tested path.

What do I get?

  • spec.md Requirements and acceptance checks.

    Missile dogfight

    What this builds

    A top-down dogfight in the browser. Each ship turns, thrusts, and fires a short-lived shot. A hit costs a life and respawns the ship after a delay. The simulation is authoritative on a server that, in tests, runs in-process with two local clients and no network. Packets are tiny and documented so a later real socket can carry the same messages. This is an original game with its own feel, not a copy of someone else's arena.

    Read spekkr.inputs.json first. arena is the square playfield. lives is the starting count. wrap is whether edges wrap. tick is the simulation rate. friendly_fire is reserved and has no effect in this version.

    Out of scope

    • A persistent account, ranking, or chat.
    • Real network play in the acceptance checks; those use two in-process clients.
    • Teams. friendly_fire is unused until a later version.

    Requirements

    Each requirement has an id. Checks name the id they cover.

    R1. Movement
    • A ship has position, heading, and velocity. Thrust adds 180 units/s² along heading, capped at 260 units/s. Turn rate is 180 degrees/s.
    • If wrap is on, positions are modulo arena. If off, edges are walls and velocity into a wall is zeroed on that axis.
    • The step is 1/tick seconds. The same inputs produce the same positions.

    Accept when: the movement fixtures in design.md reach the documented positions at both tick rates, within 0.5 px.

    R2. Shots and hits
    • A shot starts 20 px ahead of the nose, travels 420 units/s, and lives 0.7 s. Radius is 3 px. A ship is a 16 px radius.
    • Hit detection is lag-independent: it is run on the server with the authoritative positions, as a swept circle test against the ship's circle for that step.
    • A shot that hits is removed. A ship that is hit loses one life and becomes invulnerable for 1.5 s during respawn.

    Accept when: the hit fixtures register a hit and a near-miss as in the table, at both tick rates, without any clock delay between the two clients.

    R3. Scoring and respawn
    • The firer of a hitting shot gains one point. The hit ship loses a life and, 1.5 s later, spawns at a documented pad with velocity 0.
    • A ship at 0 lives is out. The round ends when one ship remains, or at 90 s, and the higher score wins; a tie is a tie.
    • Respawn pads are the four corners, inset 80 px, chosen cyclically.

    Accept when: a scripted two-client round produces the score, lives, and spawn positions in design.md.

    R4. Two-client fixture
    • Tests start an in-process server and two clients. Each client sends input for a listed step. The server broadcasts state.
    • No UDP, WebSocket, or wall clock is required. A virtual clock advances one tick at a time.

    Accept when: the scripted mid-fight, hit, and respawn moments can be screenshotted from the server state and match the goldens.

    R5. Files
    • One command runs movement, hit, and two-client tests, and writes the four screenshots.

    Accept when: the command passes at tick 30 and tick 60 from a clean folder.

    Verification

    Local two-client tests, with an in-process server and a virtual clock, cover movement, shots, scoring and respawn. Hit detection is a lag-independent swept test and is checked at both tick rates. No live network is required. Four golden frames are taken from the scripted round.

    Definition of done

    • Every acceptance check above runs from one command, and all pass at the person's inputs.
    • A README says how to run a local fight, how to run the checks, and what a later socket must carry.
    # Missile dogfight
    
    ## What this builds
    
    A top-down dogfight in the browser. Each ship turns, thrusts, and fires a
    short-lived shot. A hit costs a life and respawns the ship after a delay.
    The simulation is authoritative on a server that, in tests, runs
    in-process with two local clients and no network. Packets are tiny and
    documented so a later real socket can carry the same messages. This is an
    original game with its own feel, not a copy of someone else's arena.
    
    Read `spekkr.inputs.json` first. `arena` is the square playfield. `lives`
    is the starting count. `wrap` is whether edges wrap. `tick` is the
    simulation rate. `friendly_fire` is reserved and has no effect in this
    version.
    
    ## Out of scope
    
    - A persistent account, ranking, or chat.
    - Real network play in the acceptance checks; those use two in-process
      clients.
    - Teams. `friendly_fire` is unused until a later version.
    
    ## Requirements
    
    Each requirement has an id. Checks name the id they cover.
    
    ### R1. Movement
    
    - A ship has position, heading, and velocity. Thrust adds 180 units/s²
      along heading, capped at 260 units/s. Turn rate is 180 degrees/s.
    - If `wrap` is on, positions are modulo `arena`. If off, edges are walls
      and velocity into a wall is zeroed on that axis.
    - The step is 1/`tick` seconds. The same inputs produce the same
      positions.
    
    Accept when: the movement fixtures in `design.md` reach the documented
    positions at both tick rates, within 0.5 px.
    
    ### R2. Shots and hits
    
    - A shot starts 20 px ahead of the nose, travels 420 units/s, and lives
      0.7 s. Radius is 3 px. A ship is a 16 px radius.
    - Hit detection is lag-independent: it is run on the server with the
      authoritative positions, as a swept circle test against the ship's
      circle for that step.
    - A shot that hits is removed. A ship that is hit loses one life and
      becomes invulnerable for 1.5 s during respawn.
    
    Accept when: the hit fixtures register a hit and a near-miss as in the
    table, at both tick rates, without any clock delay between the two
    clients.
    
    ### R3. Scoring and respawn
    
    - The firer of a hitting shot gains one point. The hit ship loses a life
      and, 1.5 s later, spawns at a documented pad with velocity 0.
    - A ship at 0 lives is out. The round ends when one ship remains, or at 90
      s, and the higher score wins; a tie is a tie.
    - Respawn pads are the four corners, inset 80 px, chosen cyclically.
    
    Accept when: a scripted two-client round produces the score, lives, and
    spawn positions in `design.md`.
    
    ### R4. Two-client fixture
    
    - Tests start an in-process server and two clients. Each client sends
      input for a listed step. The server broadcasts state.
    - No UDP, WebSocket, or wall clock is required. A virtual clock advances
      one tick at a time.
    
    Accept when: the scripted mid-fight, hit, and respawn moments can be
    screenshotted from the server state and match the goldens.
    
    ### R5. Files
    
    - One command runs movement, hit, and two-client tests, and writes the
      four screenshots.
    
    Accept when: the command passes at tick 30 and tick 60 from a clean
    folder.
    
    ## Verification
    
    Local two-client tests, with an in-process server and a virtual clock,
    cover movement, shots, scoring and respawn. Hit detection is a
    lag-independent swept test and is checked at both tick rates. No live
    network is required. Four golden frames are taken from the scripted round.
    
    ## Definition of done
    
    - Every acceptance check above runs from one command, and all pass at the
      person's inputs.
    - A README says how to run a local fight, how to run the checks, and what
      a later socket must carry.
    

    Open spec.md as plain text

  • design.md Movement and hit fixtures, and the two-client scripted round.

    Design

    This file fixes the parts that are easy to get wrong. The language and tools are up to you, as long as the numbers here hold.

    Movement fixtures

    Arena 1200, wrap on, tick 60. Ship starts at (600, 600), heading 0 (to the right), velocity 0.

    InputDuration (s)End position (x, y)End headingEnd speed

    The machine-checked movement table is fixtures/dogfight-move.json. Tests compare to that file, not to a re-typed row. Positions are within 0.5 px, headings within 0.2 degrees, speeds within 0.5 units/s.

    Hit fixtures (authoritative, lag-free)

    A near-miss and a hit are listed in fixtures/dogfight-hits.json. A hit is a swept test: if the shot's segment this step comes within 19 px of the ship's centre, it hits (16 + 3).

    Scripted two-client round

    fixtures/dogfight-round.json lists, for 12 seconds at tick 60, each client's thrust, turn and fire. Expected: at t = 4.2 s a hit, score 1–0, lives 5 and 4; at t = 5.7 s the hit ship is on pad 1 at (80, 80) if that is the next pad. The file is the authority.

    Screenshot times

    Filet (s)
    spawn0
    mid-fight2.5
    hit4.2
    respawn5.7

    Tolerance: 8 levels, 98% of pixels.

    Inputs

    KeyLabelDefaultNotes
    arenaArena size, px1200Width and height of the square arena, from 800 to 2000.
    livesLives per round5A whole number from 1 to 9.
    wrapWrap at edgesonA ship leaving one edge appears on the opposite edge.
    friendly_fireFriendly fireoffIn a team mode later; in the default free-for-all this option is ignored.
    tickTick rate60Simulation steps a second. Tests run at both.

    Acceptance at the defaults

    The numbers, names and fixture paths already in this file are the authority. Where a later table or a shipped fixture file disagrees with prose, the table or the fixture wins.

    FixtureRole
    fixtures/dogfight-hits.jsonA shipped fixture. The build may move it, but then design.md must name the new path.
    fixtures/dogfight-move.jsonA shipped fixture. The build may move it, but then design.md must name the new path.
    fixtures/dogfight-round.jsonA shipped fixture. The build may move it, but then design.md must name the new path.

    Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement names another size. Tolerance, unless a tighter figure is given above: 8 levels, 98% of pixels, with motion, cursors and clocks frozen as this file says. A build's goldens are of that build; they do not have to match a shipped reference preview pixel-for-pixel if the tool or the type is different, but they do have to match this file's layout, counts and copy.

    Screenshots

    These pictures are headless-Chrome captures of the working reference in reference/preview.html, at the default inputs. They are not drawings of a product that has not been built. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel.

    FileWhat it shows
    shots/arena.pngTwo ships exchanging missiles in the 1200 arena, score 4–3.

    How to verify

    1. Run the checks at the default inputs, without a network.
    2. Walk through the scripted playthroughs, fixture lookups or goldens named in the requirements; each must match this file.
    3. Repeat once at the person's inputs when they differ from the defaults.
    4. Local two-client tests, with an in-process server and a virtual clock, cover movement, shots, scoring and respawn. Hit detection is a lag-independent swept test and is checked at both tick rates. No live network is required. Four golden frames are taken from the scripted round.
    # Design
    
    This file fixes the parts that are easy to get wrong. The language and
    tools are up to you, as long as the numbers here hold.
    
    ## Movement fixtures
    
    Arena 1200, wrap on, tick 60. Ship starts at (600, 600), heading 0 (to the
    right), velocity 0.
    
    | Input | Duration (s) | End position (x, y) | End heading | End speed |
    | --- | --- | --- | --- | --- |
    The machine-checked movement table is `fixtures/dogfight-move.json`. Tests
    compare to that file, not to a re-typed row. Positions are within 0.5 px,
    headings within 0.2 degrees, speeds within 0.5 units/s.
    
    ## Hit fixtures (authoritative, lag-free)
    
    A near-miss and a hit are listed in `fixtures/dogfight-hits.json`. A hit
    is a swept test: if the shot's segment this step comes within 19 px of the
    ship's centre, it hits (16 + 3).
    
    ## Scripted two-client round
    
    `fixtures/dogfight-round.json` lists, for 12 seconds at tick 60, each
    client's thrust, turn and fire. Expected: at t = 4.2 s a hit, score 1–0,
    lives 5 and 4; at t = 5.7 s the hit ship is on pad 1 at (80, 80) if that
    is the next pad. The file is the authority.
    
    ## Screenshot times
    
    | File | t (s) |
    | --- | --- |
    | spawn | 0 |
    | mid-fight | 2.5 |
    | hit | 4.2 |
    | respawn | 5.7 |
    
    Tolerance: 8 levels, 98% of pixels.
    
    ## Inputs
    
    | Key | Label | Default | Notes |
    | --- | --- | --- | --- |
    | `arena` | Arena size, px | 1200 | Width and height of the square arena, from 800 to 2000. |
    | `lives` | Lives per round | 5 | A whole number from 1 to 9. |
    | `wrap` | Wrap at edges | on | A ship leaving one edge appears on the opposite edge. |
    | `friendly_fire` | Friendly fire | off | In a team mode later; in the default free-for-all this option is ignored. |
    | `tick` | Tick rate | 60 | Simulation steps a second. Tests run at both. |
    
    ## Acceptance at the defaults
    
    The numbers, names and fixture paths already in this file are the
    authority. Where a later table or a shipped fixture file disagrees with
    prose, the table or the fixture wins.
    
    | Fixture | Role |
    | --- | --- |
    | `fixtures/dogfight-hits.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    | `fixtures/dogfight-move.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    | `fixtures/dogfight-round.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    
    Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement
    names another size. Tolerance, unless a tighter figure is given above: 8
    levels, 98% of pixels, with motion, cursors and clocks frozen as this file
    says. A build's goldens are of that build; they do not have to match a
    shipped reference preview pixel-for-pixel if the tool or the type is
    different, but they do have to match this file's layout, counts and copy.
    
    ## Screenshots
    
    These pictures are headless-Chrome captures of the working reference in
    `reference/preview.html`, at the default inputs. They are not drawings of a
    product that has not been built. The first picture is the one Spekkr shows on
    the spec's card. A build may ship its own goldens; those goldens are of that
    build and do not have to match these frames pixel-for-pixel.
    
    | File | What it shows |
    | --- | --- |
    | `shots/arena.png` | Two ships exchanging missiles in the 1200 arena, score 4–3. |
    
    
    ## How to verify
    
    1. Run the checks at the default inputs, without a network.
    
    2. Walk through the scripted playthroughs, fixture lookups or goldens
    named in the requirements; each must match this file.
    
    3. Repeat once at the person's inputs when they differ from the defaults.
    
    4. Local two-client tests, with an in-process server and a virtual clock,
    cover movement, shots, scoring and respawn. Hit detection is a
    lag-independent swept test and is checked at both tick rates. No live
    network is required. Four golden frames are taken from the scripted round.
    

    Open design.md as plain text

  • tasks.md Build tasks in order, each with a check.

    Tasks

    Work in order. Finish a task's check before starting the next.

    1. Set up. Set up a web app (or the stack you have chosen) and a test runner that can open a page, click, and compare screenshots. Read spekkr.inputs.json first. Check: a blank or heading page loads, and an empty test run passes.
    2. Movement (R1). Build what R1. Movement asks for, to the numbers in design.md. In particular: A ship has position, heading, and velocity. Thrust adds 180 units/s² along heading, capped at 260 units/s. Turn rate is 180 degrees/s. Check: the R1. Movement acceptance checks pass.
    3. Shots and hits (R2). Build what R2. Shots and hits asks for, to the numbers in design.md. In particular: A shot starts 20 px ahead of the nose, travels 420 units/s, and lives 0.7 s. Radius is 3 px. A ship is a 16 px radius. Check: the R2. Shots and hits acceptance checks pass.
    4. Scoring and respawn (R3). Build what R3. Scoring and respawn asks for, to the numbers in design.md. In particular: The firer of a hitting shot gains one point. The hit ship loses a life and, 1.5 s later, spawns at a documented pad with velocity 0. Check: the R3. Scoring and respawn acceptance checks pass.
    5. Two-client fixture (R4). Build what R4. Two-client fixture asks for, to the numbers in design.md. In particular: Tests start an in-process server and two clients. Each client sends input for a listed step. The server broadcasts state. Check: the R4. Two-client fixture acceptance checks pass.
    6. Files (R5). Build what R5. Files asks for, to the numbers in design.md. In particular: One command runs movement, hit, and two-client tests, and writes the four screenshots. Check: the R5. Files acceptance checks pass.
    7. Goldens. Capture the frames named in design.md at the defaults, with motion frozen where the file says so. Compare them within the stated tolerance. Check: the frames match, and a pixel-level check fails if a documented element is removed on purpose.
    8. Finish. Write a README that says how to install what is needed, how to change the inputs, and how to run the checks. Run the one command from a clean folder. Check: every item under Definition of done in spec.md is true.
    # Tasks
    
    Work in order. Finish a task's check before starting the next.
    
    1. **Set up.** Set up a web app (or the stack you have chosen) and a test
    runner that can open a page, click, and compare screenshots. Read
    `spekkr.inputs.json` first.
       Check: a blank or heading page loads, and an empty test run passes.
    
    2. **Movement (R1).** Build what `R1. Movement` asks for, to the numbers
    in `design.md`. In particular: A ship has position, heading, and velocity.
    Thrust adds 180 units/s² along heading, capped at 260 units/s. Turn rate
    is 180 degrees/s.
       Check: the `R1. Movement` acceptance checks pass.
    
    3. **Shots and hits (R2).** Build what `R2. Shots and hits` asks for, to
    the numbers in `design.md`. In particular: A shot starts 20 px ahead of
    the nose, travels 420 units/s, and lives 0.7 s. Radius is 3 px. A ship is
    a 16 px radius.
       Check: the `R2. Shots and hits` acceptance checks pass.
    
    4. **Scoring and respawn (R3).** Build what `R3. Scoring and respawn` asks
    for, to the numbers in `design.md`. In particular: The firer of a hitting
    shot gains one point. The hit ship loses a life and, 1.5 s later, spawns
    at a documented pad with velocity 0.
       Check: the `R3. Scoring and respawn` acceptance checks pass.
    
    5. **Two-client fixture (R4).** Build what `R4. Two-client fixture` asks
    for, to the numbers in `design.md`. In particular: Tests start an
    in-process server and two clients. Each client sends input for a listed
    step. The server broadcasts state.
       Check: the `R4. Two-client fixture` acceptance checks pass.
    
    6. **Files (R5).** Build what `R5. Files` asks for, to the numbers in
    `design.md`. In particular: One command runs movement, hit, and two-client
    tests, and writes the four screenshots.
       Check: the `R5. Files` acceptance checks pass.
    
    7. **Goldens.** Capture the frames named in `design.md` at the defaults,
    with motion frozen where the file says so. Compare them within the stated
    tolerance.
       Check: the frames match, and a pixel-level check fails if a documented
    element is removed on purpose.
    
    8. **Finish.** Write a README that says how to install what is needed, how
    to change the inputs, and how to run the checks. Run the one command from
    a clean folder.
       Check: every item under Definition of done in `spec.md` is true.
    

    Open tasks.md as plain text

  • reference/preview.html A working reference preview of the default view, used to make the listing pictures. A build does not have to start from this file.
  • reference/fonts/fonts.css Webfont faces for the reference preview.
  • reference/fonts/Geist.ttf Geist variable typeface for the reference preview.
  • reference/fonts/GeistMono.ttf Geist Mono variable typeface for the reference preview.
  • reference/fonts/Unbounded.ttf Unbounded variable typeface for the reference preview.

Is it for me?

Platforms
web
Tools
TypeScript

What does it need?

Agent permissions
shell
Commands it runs
install a test runner install a local two-client fixture

What changed?

  • 0.2.215 Nov 2026Names what it builds.
  • 0.2.115 Nov 2026Scale up the ships, add exhaust and more fire, tighten the crop, and add an animated loop.
  • 0.2.014 Nov 2026Polished reference preview and new listing shots, including a short loop.
  • 0.1.014 Nov 2026First version.

For agents: start.md says how to build this spec, spec.json holds everything on this page, and bundle.tar.gz holds its files.