# Build Log: COMPUTE! AI Game Jam entry

Working title: Tank Front

## Jam rules (as given by the developer)
- The game must be original. It may be inspired by other games, but must not
  copy their code, graphics, sound, levels, names, or characters.
- It must run on real hardware or a standard emulator.

## Log format
Each session records: date, what Claude did, what the developer did or
decided, and any mistakes of Claude's that the developer caught.

---

## Session 1: 2026-12-05

**Claude did**
- Started this build log.
- Searched the web for the published COMPUTE! AI Game Jam rules. No official
  page turned up, so this log uses the rules exactly as the developer stated
  them. Deadline, theme, size limits and submission format are still unknown.

**Developer did or decided**
- Entering COMPUTE!'s AI Game Jam with a new, original game.
- Set the two rules above.
- Asked for this running build log, updated after every session.

**Open questions (to be settled next)**
- Target platform and emulator (for example C64/VICE, Atari 8-bit/Altirra,
  Apple II/AppleWin, VIC-20, ZX Spectrum, NES).
- Language: BASIC type-in, assembly, or a cross-compiled language (cc65,
  KickAssembler, etc.).
- Game concept and genre.
- Jam deadline, theme, and any size or format limits.

**Mistakes caught by the developer**
- None yet.

---

## Session 1 (continued): 2026-12-05, design received

**Developer did or decided**
- Supplied the full design document for **Tank Front**: a top-down,
  single-screen tactical tank game for the Commodore 64, written in Kick
  Assembler. One player tank against 3 to 7 CPU tanks; machine gun, missile
  and super missile; hills (fog of war), logs, pits and wrecks; keyboard
  (WASD, T, Space, 1/2/3, P) or joystick; original march music and SFX.
- First playable target: one map, three CPU tanks, all three weapons, hills,
  logs, pits, basic fog of war, sound effects, one music loop.
- This answers all of Session 1's open questions except the jam's deadline,
  theme and size/format limits.

**Claude did**
- Checked the build toolchain in Claude's cloud workspace. Java is present.
  The Kick Assembler download site is blocked from there, and VICE isn't
  available either, so Claude cannot assemble or run the game in the cloud.
- Checked the developer's PC through the desktop app. It's reachable, but no
  project folder is connected yet.
- Ran a quick web search on the name "Tank Front". No existing game with that
  exact name turned up, but similar names exist ("FrontLine [Tanks]",
  "Steel Front"). Worth one more check before the final submission.
- Reviewed the design for C64-specific problems (see below).

**Design notes from Claude's review (for the developer to accept or reject)**
1. Joystick in **port 2**. Port 1 shares lines with the keyboard matrix and
   would produce phantom key presses while WASD is in use.
2. Joystick "hold fire + push up = change weapon" clashes with "hold fire,
   then release = select target". Proposed rule: if up was pushed while fire
   was held, the release does nothing. A hold shorter than about 12 frames
   (0.25 s) counts as a shot.
3. Sprites: the eight tanks use all eight hardware sprites, so missiles,
   bullets and explosions will be character graphics in v1, as the design
   already suggests. The super missile blast can be a short character-based
   burst.
4. Turret and body facing apart: plan on 8 body directions x 8 turret
   directions = 64 sprite frames (4 KB). That fits easily in memory.
5. Tab can't be read separately on a real C64, so T stays as the native key,
   as the design says.

**Blocked on**
- A working Kick Assembler (and ideally VICE) that Claude can run: either
  KickAss.jar attached here, or the developer's project folder connected
  through the desktop app.

---

## Session 2: 2026-12-05, first playable build

**Developer did or decided**
- Told Claude to build the game rather than wait on the toolchain question,
  and said they would upload Kick Assembler.
- Supplied a screen mockup (title bar, battlefield, two-line status panel,
  targeting bracket, fog on the far side) as the visual target.

**Claude did**
- Wrote `tools/gen_assets.py`, which generates everything visual and musical
  from scratch: an original 5x7 bold font (not the C64 ROM font), terrain
  tiles (grass, pebbles, hills, logs, pits, wrecks), explosion and projectile
  characters, 128 tank sprite frames (8 hull x 8 turret directions, plain and
  with the target bracket), the battlefield map, cover points, the PAL SID
  frequency table, and an original 16-bar march in D minor (melody, oom-pah
  bass, snare pattern).
- The generator checks the map: no enemy spawn point has line of sight to the
  player's start, so neither side begins with a clear shot. Two routes (north
  and south of the central ridge) connect the starting areas.
- Wrote the game in Kick Assembler (about 4,300 lines across 14 files, all tuning
  values in `src/config.asm`): raster-split status bars, keyboard and
  joystick-in-port-2 input with the agreed hold rules, tank movement and
  collision, turrets that track the selected target, Bresenham line of sight
  through hills, fog of war with dim last-known markers, three weapons with
  reload/burst/one-missile-in-flight rules, super-missile blast radius,
  wrecks, CPU tanks with advance/engage/seek-cover/search, a two-attacker limit,
  reaction delay and aim error, battle progression from 3 to 7 enemies, title,
  intro, pause, win and lose screens, music and ten sound effects.
- Kick Assembler still wasn't available, so Claude wrote a stand-in assembler
  for the subset of Kick syntax the game uses (`tools/minikick.py`) and a
  6502 test harness (`tools/c64sim.py`: py65 CPU, raster interrupts, keyboard
  matrix, joystick, screenshot renderer, SID register log). The test build
  ends at $3469, leaving room below the graphics at $4000.
- Tested in the harness: title, intro, play screenshots; targeting bracket
  and target armour readout; explosions; music decoded from the SID log
  matches the score note for note; a 9,000-frame robot soak test (keyboard and
  joystick play) won battle 1, lost battle 2, restarted, with no crashes and
  a stable stack.

**Bugs Claude found and fixed in its own code during testing**
- CPU tanks boxed in by a wreck, a pit and a teammate stepped north-south
  forever (each step "succeeded", so the stuck counter never fired). Replaced
  with committed detours plus a no-progress check that picks a new goal.
- Tank sprites were drawn one pixel too low (sprites appear one raster line
  below their Y register).
- Several branches out of range after code grew; restructured.
- Message box text (ground colour on blue) was hard to read; boxes are now
  black.
- Tank sprites in the first draft were mostly black and unreadable; redrawn
  with a light grey turret dome.

**Mistakes caught by the developer**
- Claude stopped and asked how to get a toolchain instead of starting the
  build; the developer had to tell it to go ahead and build.

**Known limits and open items**
- Not yet assembled with real Kick Assembler. The stand-in follows Kick syntax
  but the release build must come from KickAss.jar, then be run in VICE.
- Raster-split timing, sprite positions and sound have only been checked in
  the harness, not in VICE or on real hardware. Watch for a flickering seam at
  the edges of the status bars.
- An enemy choosing cover can cost one frame (the cover search runs several
  line-of-sight checks at once).
- The mockup's shaded fog over unseen ground is not drawn; hidden enemies
  vanish and leave dim markers, which is what the design requires.
- Difficulty settings, scoring, more maps: still to do, as planned.

---

## Session 3: 2026-12-05, staggered arrivals and cursor keys

**Developer did or decided**
- Enemy tanks started too close. Asked for 5 seconds between enemy entrances.
- Asked for the cursor keys to steer the tank as well.

**Claude did**
- Enemies now enter one at a time at the right edge of the field: the first
  1 second into the battle, then one every 5 seconds (250 frames on PAL;
  about 4.2 s on an NTSC machine). If something is parked on an entry point,
  that arrival waits until it's clear. Timings are `FIRST_ARRIVAL` and
  `ARRIVAL_GAP` in `src/config.asm`. The ENEMIES counter still shows every
  tank in the battle, including those not yet arrived, so a battle is only won
  once all have come in and been destroyed.
- Entry points moved to the right-hand column; the generator re-checked that
  none has line of sight to the player's start.
- Cursor keys steer: CRSR right/down, and SHIFT + CRSR for left/up (which is
  what VICE sends for the PC arrow keys). Title screen and README updated.
- Tested in the harness: arrivals at 1.0 s, 6.0 s and 11.0 s; all four cursor
  directions move the tank; a 6,000-frame soak test ran without crashes.

**Known limit**
- On a C64 one SHIFT applies to both cursor keys, so diagonals that mix up
  with right, or down with left, can't come from the cursor keys (holding
  up + right reads as up + left). W A S D and the joystick do all eight
  directions.

**Mistakes caught by the developer**
- The enemies' starting positions (inside the right-hand third, all at once)
  were too close; the design asked for no immediate clear shot but Claude
  hadn't considered spacing in time.

---

## Session 4: 2026-12-05, hill speed

**Developer did or decided**
- Hills slow tanks to quarter speed while crossing them (was half speed).
  Considered making them crushable trees, then decided hills stay as they are.
- Asked whether maps should be random, or a few fixed maps picked at random.

**Claude did**
- Tanks on a hill now move at 1/4 speed (player: 8 frames per step instead of
  2; enemies: 12 instead of 3). Measured in the harness: 20 steps per 40
  frames on open ground, 5 per 40 frames on a hill.
- Recommended hand-made maps chosen at random, each also randomly mirrored
  top-to-bottom, over fully generated maps (decision pending).

**Mistakes caught by the developer**
- None this session.

---

## Session 5: 2026-12-05, five maps chosen at random

**Developer did or decided**
- Maps: the first map plus a mirror of it; a second map with a very narrow
  crossing area; one more designed by Claude plus its mirror. Maps load
  randomly.

**Claude did**
- Five maps, picked at random for every battle (including a retry), never
  the same map twice in a row. The title screen always shows The Ridge.
  1. **The Ridge**: the original map.
  2. **Ridge Reversed**: mirrored left to right. The Ridge is already nearly
     symmetric top to bottom, so that flip would have looked the same; the
     left-right mirror puts the big ridge on the player's side instead.
  3. **The Crossing**: a barrier of pits and logs down the middle. Tanks can
     only cross through two one-tank-wide lanes either side of a log; shots
     fly over the pits, so the barrier can be fought across. Hills flank the
     lanes on both sides for ambushes.
  4. **The Slope**: a broken diagonal line of hills from corner to corner,
     with scattered logs and pits.
  5. **Slope Reversed**: mirrored left to right.
- The intro box now shows the map name.
- Maps are stored as tiles (220 bytes each) and expanded at battle start
  instead of as full screens (880 bytes each), so all five fit.
- The generator checks every map: no enemy entry point has line of sight to
  the player's start, every entry point can drive to the player, and each map
  has cover points (40 per map).
- CPU tanks on The Crossing head for the nearer lane when their goal is on the
  other side, line up, and drive straight through. Tested: all three enemies
  crossed within about 22 seconds.
- Soak test (12,000 frames) exposed a lone enemy patrolling the left side for
  over two minutes while the robot player sat on the far right: patrols only
  ever went to the player's starting third. Patrols now go there half the time
  and anywhere on the field otherwise. Re-run: battles keep ending, maps rotate
  with no repeats, no crashes.

**Note on the design rules**
- The design asks for at least two routes between the starting areas. The
  Crossing keeps two, but both lanes are in the same narrow crossing area, as
  requested.

**Mistakes caught by the developer**
- None this session. (The patrol weakness above was found by Claude's own
  soak test.)

---

## Session 6: 2026-12-05, wrap-up

**Developer did or decided**
- Considered adding a mirrored Crossing and a hills-only map (plus its
  mirror), then decided five maps is enough for now. No changes made.

**Still to do**
- Assemble with real Kick Assembler (waiting on KickAss.jar), then test the
  release build in VICE: raster-split seams, sprite alignment, sound by ear.

**Mistakes caught by the developer**
- None this session.

---

## Session 7: 2026-12-05, F1 menu

**Developer did or decided**
- Asked for an F1 menu with Quit, Restart, New map and Sound off.

**Claude did**
- F1 opens a menu during a battle (or its intro) and freezes the game:
  **Resume, Restart battle, New map, Sound: on/off, Quit to title**.
  Up/down (W/S, cursor keys or joystick) moves a blue highlight; SPACE or
  fire picks; F1 again resumes. Claude added Resume so joystick players can
  get back without the keyboard.
  - Restart battle: same battle, same map, armour and ammunition restored.
  - New map: same battle on a different random map.
  - Sound: silences music and all effects (SID volume 0, no writes); the
    setting lasts until switched back on, across battles and the title.
  - Quit to title: back to the title screen (stack reset there).
- Tanks are hidden while the menu is open so they don't cover its text.
- Status panel shows "F1 MENU"; the title screen lists P PAUSE and F1 MENU.
- Tested in the harness: every option, keyboard, cursor and joystick
  navigation with wrap-around, sound off produced no SID writes for 100
  frames; 5,000-frame soak test with no crashes.

**Note**
- Opening the menu needs the F1 key; a joystick-only player can use it once
  it's open, but can't open it from the stick.

**Mistakes caught by the developer**
- None this session. (Claude spotted the tank sprites drawing over the menu
  in its own screenshot and fixed it.)
