From e2a47aba6bf20152898972ef379bddda19f00599 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Thu, 13 Aug 2026 08:50:41 +0200 Subject: [PATCH] (Body Snatcher) Prepare Pass 4 --- body-snatcher/AGENTS.md | 80 +- body-snatcher/PROMPT.md | 5 + body-snatcher/build.sh | 279 -- body-snatcher/build/_contract.md | 63 - body-snatcher/build/_fix.md | 13 - body-snatcher/build/_p1.md | 13 - body-snatcher/build/_p2.md | 22 - body-snatcher/build/_p3.md | 31 - body-snatcher/build/_p4.md | 22 - body-snatcher/build/_p5.md | 16 - body-snatcher/build/_review.md | 15 - body-snatcher/build/acorn_check.js | 18 - body-snatcher/build/bisect.js | 18 - body-snatcher/build/bisect2.js | 30 - body-snatcher/build/build.log | 177 -- body-snatcher/build/espree_check.js | 16 - body-snatcher/build/factory.out | 42 - body-snatcher/build/factory.pid | 1 - body-snatcher/build/findbrace.js | 43 - body-snatcher/build/findbrace2.js | 45 - body-snatcher/build/findbrace3.js | 44 - body-snatcher/build/findextra.js | 40 - body-snatcher/build/findextra2.js | 29 - body-snatcher/build/findinsert.js | 25 - body-snatcher/build/findone.js | 24 - body-snatcher/build/fix.log | 12 - body-snatcher/build/fix.pid | 1 - body-snatcher/build/index.broken.bak | 2652 ---------------- body-snatcher/build/index.passing.bak | 2653 ----------------- body-snatcher/build/phase1.attempt1.log | 9 - body-snatcher/build/phase2.attempt1.log | 16 - body-snatcher/build/phase3.attempt1.log | 3 - body-snatcher/build/phase4.attempt1.log | 3 - body-snatcher/build/phase4.attempt2.log | 17 - body-snatcher/build/phase5.attempt1.log | 1 - body-snatcher/build/review.log | 1 - body-snatcher/build/review.pid | 1 - body-snatcher/build/tokenmatch.js | 21 - .../plans/2026-08-12-body-snatcher-design.md | 13 + body-snatcher/index.html | 2653 ----------------- body-snatcher/verify.js | 316 -- 41 files changed, 61 insertions(+), 9422 deletions(-) delete mode 100755 body-snatcher/build.sh delete mode 100644 body-snatcher/build/_contract.md delete mode 100644 body-snatcher/build/_fix.md delete mode 100644 body-snatcher/build/_p1.md delete mode 100644 body-snatcher/build/_p2.md delete mode 100644 body-snatcher/build/_p3.md delete mode 100644 body-snatcher/build/_p4.md delete mode 100644 body-snatcher/build/_p5.md delete mode 100644 body-snatcher/build/_review.md delete mode 100644 body-snatcher/build/acorn_check.js delete mode 100644 body-snatcher/build/bisect.js delete mode 100644 body-snatcher/build/bisect2.js delete mode 100644 body-snatcher/build/build.log delete mode 100644 body-snatcher/build/espree_check.js delete mode 100644 body-snatcher/build/factory.out delete mode 100644 body-snatcher/build/factory.pid delete mode 100644 body-snatcher/build/findbrace.js delete mode 100644 body-snatcher/build/findbrace2.js delete mode 100644 body-snatcher/build/findbrace3.js delete mode 100644 body-snatcher/build/findextra.js delete mode 100644 body-snatcher/build/findextra2.js delete mode 100644 body-snatcher/build/findinsert.js delete mode 100644 body-snatcher/build/findone.js delete mode 100644 body-snatcher/build/fix.log delete mode 100644 body-snatcher/build/fix.pid delete mode 100644 body-snatcher/build/index.broken.bak delete mode 100644 body-snatcher/build/index.passing.bak delete mode 100644 body-snatcher/build/phase1.attempt1.log delete mode 100644 body-snatcher/build/phase2.attempt1.log delete mode 100644 body-snatcher/build/phase3.attempt1.log delete mode 100644 body-snatcher/build/phase4.attempt1.log delete mode 100644 body-snatcher/build/phase4.attempt2.log delete mode 100644 body-snatcher/build/phase5.attempt1.log delete mode 100644 body-snatcher/build/review.log delete mode 100644 body-snatcher/build/review.pid delete mode 100644 body-snatcher/build/tokenmatch.js delete mode 100644 body-snatcher/index.html delete mode 100644 body-snatcher/verify.js diff --git a/body-snatcher/AGENTS.md b/body-snatcher/AGENTS.md index d134c68..5119785 100755 --- a/body-snatcher/AGENTS.md +++ b/body-snatcher/AGENTS.md @@ -1,4 +1,4 @@ -# CLAUDE.md — Body Snatcher +# Body Snatcher — Build Spec (AGENTS.md) You are building a browser-based roguelike game called **Body Snatcher**. Read this file completely before writing any code. Refer back to it at every phase. @@ -16,22 +16,24 @@ You are a ghost. 1 HP. No attack. You explore a procedurally generated dungeon. ## Visual Style - Top-down 2D grid, tile-based (each tile = 32px) -- Dark dungeon background, grid lines visible -- Entities are colored shapes with distinct silhouettes (no sprites needed): - - Ghost: white translucent circle with eyes - - Brute: large red square - - Skitterer: small orange triangle - - Sentinel: purple hexagon - - Shielder: blue square with front line - - Bomber: dark red circle with fuse - - Healer: green cross - - Phaser: cyan diamond - - Turret: gray octagon - - Charger: yellow arrow shape - - Siren: pink circle with rings - - Mimic: looks like a chest until provoked - - Leech: dark purple teardrop -- Minimal but readable. Color + shape communicates everything. +- **High-polish, intricate vector art drawn entirely on ``** — NO external image, sprite, or font assets (the zero-dependency rule still applies). Every entity and tile is composed from many canvas primitives (linear/radial gradients, layered shapes, highlights, bevels, outlines, soft drop shadows, eyes, equipment) so the game looks hand-crafted — never flat single-rect placeholders. +- Atmospheric dungeon: dark stone walls with beveled edges, cracks and mortar lines; subtly lit floor flagstones; glowing runic exit stairs; ornate gilded chests; warm torch-light color grading and a soft vignette. Faint grid lines as structure only. +- Each entity has a DISTINCT, DETAILED silhouette with personality: eyes that track movement/facing, equipment, a gentle idle bob/breath animation, and (on the player's current body) a possession aura. Color still signals faction/type at a glance, but every shape is layered and shaded. +- Smooth radial fog of war (soft gradient falloff, not a hard circle); explored-but-unseen tiles dimmed with a cool memory tint. +- Quick color/silhouette reference (full per-enemy sprite breakdown in §Enemy Roster): + - Ghost: translucent wisp, glowing tracking eyes, tattered tail + - Brute: hulking crimson armored body + - Skitterer: orange insectile carapace + - Sentinel: purple floating crystal pod + - Shielder: blue body behind a tower-shield + - Bomber: dark-red iron shell with a sparking fuse + - Healer: green hooded robe with an ankh sigil + - Phaser: cyan faceted crystal + - Turret: gray bolted octagon with a swivel barrel + - Charger: yellow coiled beast with a forward horn + - Siren: pink orb with concentric lure-rings + - Mimic: ornate chest that splits into a fanged maw + - Leech: dark-purple bulbous sucker ## Grid + Rendering @@ -42,12 +44,13 @@ You are a ghost. 1 HP. No attack. You explore a procedurally generated dungeon. - Before play starts, the title screen MUST show a concise controls panel explaining movement, possession/attack, facing, confirm, and pause. - During play, the HUD MUST show a short contextual hint for SPACE (possess while ghost; current body attack/special while possessed). - The pause and shop screens MUST show the controls needed to leave or confirm those screens. +- **Render quality rules:** use sub-pixel entity positions, anti-aliased layered primitives, gradients for bodies and lighting, soft shadows under entities, and subtle idle/breathing animation. Draw tiles with depth (beveled walls casting onto floor, lit center / darker edges). The title, HUD, shop, and pause overlays must be equally polished — bordered panels, icons, and accent colors, not bare text. ## Player States ### Ghost State - 1 HP, no attack -- Movement: arrow keys / WASD, one tile per turn +- Movement: arrow keys / WASD, one tile per turn (snappy ~85ms interpolation; HOLD a direction to move continuously at the turn cadence) - Cannot walk through walls (unless Ghost Tree T3 unlocked) - Hold SPACE adjacent to enemy → possession (takes 1 turn) - Ghost timer: 15s real-time countdown (20s with Ghost T1) @@ -74,67 +77,67 @@ The default feel must be EXPLORATORY, not a swarm. Honor ALL of these — they a ## Enemy Roster -Each enemy is a **dual system**: it behaves one way as an opponent and differently when you possess it. Define each as a data object with both AI behavior and player kit. +Each enemy is a **dual system**: it behaves one way as an opponent and differently when you possess it. Define each as a data object with both AI behavior and player kit. The **Sprite** line describes the intricate canvas-vector art to draw (layered/shaded, no external assets). ### 1. Brute - **Enemy AI:** Slow chase (moves every 2 turns). A* pathfinding toward player. Heavy melee (2 damage) on adjacent tile. - **Player kit:** High HP (8), slow movement (every 2 turns), high damage (3 per hit). -- **Color:** Red. **Shape:** Large square (28px). +- **Color:** Crimson. **Sprite:** Hulking armored brute — beveled plate-body, heavy brow, glowing eyes, dragging knuckle-fists, subtle idle sway (~28px). ### 2. Skitterer - **Enemy AI:** Moves every 2 turns. Loose swarm — drifts toward other Skitterers and flanks the player once aggroed. Weak melee (1 damage). - **Player kit:** Low HP (2), fast movement, rapid weak hits (1 damage per turn). -- **Color:** Orange. **Shape:** Small triangle (16px). +- **Color:** Orange. **Sprite:** Insectile skitterer — segmented carapace, three pointed legs, twitching mandibles, quick leg-shuffle animation (~16px). ### 3. Sentinel - **Enemy AI:** Keeps distance (maintains 4-tile range). Fires a BURST of 3 shots (1 per turn) toward the player, then OVERHEATS for 3 turns — it cannot fire while overheated and only repositions slowly, giving the player a clear window to close or possess. Moves away if the player gets close. Projectiles hit the player only, never other enemies. - **Player kit:** Medium HP (4). Shoot projectiles in facing direction. Cannot melee. Same burst/overheat rhythm as the enemy (3 shots, then a short cooldown) so it cannot infinitely stunlock. -- **Color:** Purple. **Shape:** Hexagon. +- **Color:** Purple. **Sprite:** Floating crystalline hex pod — faceted shell, single aiming eye, energy coils, muzzle that glows before each burst. ### 4. Shielder - **Enemy AI:** Slow chase. Frontal shield blocks all damage from the direction it's facing. Takes damage from sides/back. - **Player kit:** Medium HP (5). Frontal shield active. Must rotate (Q/E keys) to face threats. -- **Color:** Blue. **Shape:** Square with front line indicator. +- **Color:** Blue. **Sprite:** Stocky body behind a tall embossed tower-shield (rotates with facing), crest + rivets, narrow visor slit. ### 5. Bomber - **Enemy AI:** Chase player when aggroed. On death or when adjacent, explodes (3x3 AoE, 3 damage **to the player only — never other enemies**). - **Player kit:** Low HP (3). Press SPACE to detonate (suicide, 3x3 AoE, 4 damage). Ejects you as ghost. -- **Color:** Dark red. **Shape:** Circle with fuse indicator. +- **Color:** Dark red. **Sprite:** Round cast-iron shell with an exposed fuse; the sparking tip intensifies as it nears detonation; small soot puffs trailing. ### 6. Healer - **Enemy AI:** Stays near other enemies. Heals nearby enemies (+1 HP per turn within 3 tiles). Fleees from player. - **Player kit:** Low HP (3). Press SPACE for AoE heal pulse (heal self +2, all allies +1 within 3 tiles). Low offensive capability. -- **Color:** Green. **Shape:** Cross. +- **Color:** Green. **Sprite:** Hooded robe with a glowing ankh/cross sigil on the chest, soft healing motes drifting up, raised hands. ### 7. Phaser - **Enemy AI:** Teleports toward player every 3 turns (within line of sight). Materializes, attacks, dematerializes. - **Player kit:** Medium HP (4). Press SPACE to blink 5 tiles in facing direction (through walls). 2-turn cooldown. -- **Color:** Cyan. **Shape:** Diamond. +- **Color:** Cyan. **Sprite:** Faceted crystal diamond that fractures/scatters when dematerializing, sharp edges, faint afterimage trail on teleport. ### 8. Turret - **Enemy AI:** Stationary. 360° fire at an aggroed player in a BURST (3 shots, 1 every 2 turns), then OVERHEATS for 3 turns — fully silenced and vulnerable during overheat, the window to rush it. Projectiles hit the player only, never other enemies. - **Player kit:** Medium HP (4). Rooted — cannot move. Press SPACE to fire in facing direction (Q/E to rotate). High DPS in bursts, with the same overheat cooldown so it cannot fire forever. -- **Color:** Gray. **Shape:** Octagon. +- **Color:** Gray. **Sprite:** Bolted octagonal base mounting a swivel barrel that tracks facing; cooling vents glow red as it nears overheat. ### 9. Charger - **Enemy AI:** When aggroed, telegraphs (flashes for 1 turn), then charges in a straight line toward the player's position at telegraph time. Collision with the player = 3 damage. Hits walls = stunned 2 turns. The charge does NOT damage other enemies. - **Player kit:** Medium HP (5). Press SPACE to dash-charge 4 tiles in facing direction. Damages enemies in path (2 per enemy hit). -- **Color:** Yellow. **Shape:** Arrow. +- **Color:** Yellow. **Sprite:** Coiled beast with a forward horn/arrow crest; telegraph flash + paw-stomp windup; motion streak on the charge. ### 10. Siren - **Enemy AI:** Stationary or slow drift. Emits pull field (drags player 1 tile toward it per turn if within 5 tiles). Weak melee. - **Player kit:** Low HP (3). Press SPACE to pull all enemies within 4 tiles one tile toward you. Useful for grouping. -- **Color:** Pink. **Shape:** Circle with ring animation. +- **Color:** Pink. **Sprite:** Eerie floating orb-entity with concentric pulsing lure-rings and trailing wisps around a hollow glowing core. ### 11. Mimic - **Enemy AI:** Disguised as a chest. When player is adjacent, reveals true form and bursts (2 damage in cross pattern). - **Player kit:** Medium HP (4). Passive: enemies don't aggro you while disguised. Press SPACE for surprise burst (2 damage 3x3 cross). -- **Color:** Brown (disguised) / dark gold (revealed). **Shape:** Chest → reveal. +- **Color:** Brown (disguised) / dark gold (revealed). **Sprite:** Ornate treasure chest (gold trim, lock, wood grain) that splits open into a fanged maw with a lolling tongue on reveal. ### 12. Leech - **Enemy AI:** Slow chase. On hit, drains 1 HP from player and heals self +1. - **Player kit:** Medium HP (4). Every hit deals 1 damage and heals you +1. Sustain machine. -- **Color:** Dark purple. **Shape:** Teardrop. +- **Color:** Dark purple. **Sprite:** Bulbous segmented body tapering to a sucker maw, glossy wet highlight, drip trail; puffs red when it drains. ## Enemy Legend (in-game bestiary) @@ -195,11 +198,12 @@ Present 3 random upgrades from the pool below. Player picks one or skips. ## Game Feel -- Screen shake on explosions and big hits -- Particle effects on death, possession, essence pickup -- Hit flash (entity flashes white for 100ms on damage) -- Smooth movement interpolation between tiles (150ms ease) -- Sound: use Web Audio API to generate simple tones (no audio files needed). Hit sound, possess sound, death sound, pickup sound, explosion sound. Procedural beeps. +- **Snappy movement.** Smooth movement interpolation between tiles is a quick ~85ms ease (down from 150ms) so the player feels responsive. Holding a movement key auto-repeats at the turn cadence for continuous travel. The real-time live loop advances turns at a brisk ~600ms cadence (down from 1000ms) so the dungeon feels alive without swarming. NOTE: this is presentation/cadence only — the core turn model stays one-tile-per-turn and `tick(n)` stays deterministic for the headless harness; never tie game state to wall-clock time. +- Screen shake on explosions and big hits (scaled to intensity) +- Particle effects on death, possession, essence pickup, and light footstep/dust on movement +- Hit flash (entity flashes white ~100ms on damage) plus hit sparks / small damage numbers +- Polished possession VFX: an aura on the player's current host; dissolve/flash on possess and eject +- Sound: use Web Audio API to generate tones (no audio files). Hit, possess, death, pickup, explosion, plus subtle UI blips. Guard if AudioContext is unavailable. ## Achievements (localStorage-tracked) @@ -216,7 +220,7 @@ Present 3 random upgrades from the pool below. Player picks one or skips. These controls must be explained on the title screen before the run starts, not only documented here: -- **WASD / Arrow Keys:** Move one tile per turn. +- **WASD / Arrow Keys:** Move one tile per turn (hold to move continuously). - **SPACE while ghost:** Possess an enemy within range. Explain that the ghost cannot attack. - **SPACE while possessed:** Use the current host's attack or special ability. Show the current action in the HUD. - **X while possessed:** Abandon your current host — eject as a ghost (the host survives, briefly pacified; see Possessed State). Show this in the contextual HUD hint while possessed. @@ -255,6 +259,7 @@ The game MUST meet ALL of these. Do not consider yourself done until every one p 23. Enemies idle until the player enters their aggro radius (≈6 tiles, line of sight); the whole floor does not swarm the player on spawn 24. An in-game enemy legend (bestiary) is reachable before play and explains each enemy's behavior + possessed kit 25. The ghost can voluntarily abandon a host (press X while possessed): returns to ghost form with the timer resumed (>0), the former host survives in the enemy list, and that host cannot be immediately re-possessed (short lockout) +26. **Visual polish:** entities and tiles are intricate layered/shaded canvas-vector art per §Visual Style and each enemy's Sprite line — not flat single-rect placeholders. Movement feels snappy (~85ms interpolation, hold-to-move). ## Testability (REQUIRED) @@ -286,5 +291,6 @@ The game MUST expose its state for automated testing. Expose ALL of this on `win - DO NOT write more code than needed. Bloat is penalized. - DO NOT skip the fog of war, audio, or save/load — they are completion criteria. - DO NOT use placeholder art or "TODO" comments. Everything must work. +- DO NOT use flat single-rect entities or bare-text overlays — draw the intricate vector sprites and polished panels described in §Visual Style and §Grid + Rendering. - DO NOT add multiplayer, online features, or any server component. - DO NOT stop until all completion criteria pass. diff --git a/body-snatcher/PROMPT.md b/body-snatcher/PROMPT.md index bef8fd9..02ec764 100755 --- a/body-snatcher/PROMPT.md +++ b/body-snatcher/PROMPT.md @@ -20,6 +20,11 @@ Read AGENTS.md. That is the full game spec for "Body Snatcher" — a browser-bas Your task: Build the complete game as a single index.html file. Follow the spec exactly. +## Build Priorities (this run) + +- **High-polish visuals.** Draw intricate, layered/shaded canvas-vector art for every entity and tile per AGENTS.md §Visual Style, §Grid + Rendering, and each enemy's Sprite line — gradients, bevels, highlights, soft shadows, animated details. No flat single-rect placeholders, no bare-text overlays. +- **Snappy movement.** ~85ms tile interpolation, hold-to-move continuous travel, ~600ms live-tick cadence (AGENTS.md §Game Feel). Keep the deterministic one-tile-per-turn `tick(n)` model for the headless harness — the quickness is presentation/cadence only. + ## ARCHITECTURE: You are building a self-orchestrating software factory. Do NOT write the game directly in this conversation. Instead, write two scripts — `build.sh` and `verify.js` — then run `build.sh` and let it orchestrate the entire build using `pi -p` as the primitive. This gives you subagent isolation, mechanical verification gates, and retry loops. diff --git a/body-snatcher/build.sh b/body-snatcher/build.sh deleted file mode 100755 index 71773e5..0000000 --- a/body-snatcher/build.sh +++ /dev/null @@ -1,279 +0,0 @@ -#!/usr/bin/env bash -# build.sh — self-orchestrating factory for Body Snatcher. -# Drives the build in phases via `pi -p` (fresh isolated context each phase), -# gated mechanically by `node verify.js `. Max 3 retries + targeted fix. -set -uo pipefail -cd "$(dirname "$0")" - -MAX_RETRIES=3 -MODEL="--model openai/gpt-5.2 --thinking high" -mkdir -p build -LOG=build/build.log -: > "$LOG" - -if [ ! -f verify.js ]; then echo "FATAL: verify.js missing" >&2; exit 1; fi - -# ---- shared contract + phase scopes written to build/_*.md ------------------ -cat > build/_contract.md <<'EOF' -You are building "Body Snatcher" — a single index.html browser possession roguelike. -STEP 0: Read AGENTS.md in THIS directory COMPLETELY. It is the authoritative spec. -Then, if index.html already exists, read ALL of the current index.html before editing. -After phase 1, NEVER rewrite index.html from scratch — edit it incrementally and -PRESERVE every working system from earlier phases. - -HARD CONSTRAINTS (every phase): -- Single index.html. Zero external dependencies: no CDN, no npm, no ES `import`, - no - - diff --git a/body-snatcher/build/index.passing.bak b/body-snatcher/build/index.passing.bak deleted file mode 100644 index ec365e9..0000000 --- a/body-snatcher/build/index.passing.bak +++ /dev/null @@ -1,2653 +0,0 @@ - - - - - - Body Snatcher - - - - - - - - diff --git a/body-snatcher/build/phase1.attempt1.log b/body-snatcher/build/phase1.attempt1.log deleted file mode 100644 index abd4463..0000000 --- a/body-snatcher/build/phase1.attempt1.log +++ /dev/null @@ -1,9 +0,0 @@ -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -Created `./index.html` implementing Phase 1 core engine only (canvas + HUD, deterministic `tick(n)` ghost timer, grid + walls + collision, fog-of-war, title screen controls + legend toggle `l`, `window.GAME` contract w/ safe stubs for later phases). - -Verification: -```bash -node verify.js 1 -# Phase 1: PASS (8/8) -``` diff --git a/body-snatcher/build/phase2.attempt1.log b/body-snatcher/build/phase2.attempt1.log deleted file mode 100644 index 46a7090..0000000 --- a/body-snatcher/build/phase2.attempt1.log +++ /dev/null @@ -1,16 +0,0 @@ -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -Implemented Phase 2 incrementally in `index.html` (no rewrite): - -- Possession: `Space` while ghost, adjacent enemy (orthogonal; diagonal via Chebyshev fallback) → `state='possessed'`, `player.host` set, player moved onto host tile -- Voluntary abandon: `x` while possessed → back to ghost (`state='playing'`), host returned to `enemies`, `pacify=2`, `lockout=2`, ghost timer resumes (not reset), immediate re-possess blocked -- Enemies implemented: **Brute**, **Skitterer**, **Sentinel** with required stats -- Deterministic `tick(n)` now advances AI + projectiles + ghost timer (paused while possessed); host death checked every tick; host death ejects with fresh timer and does **not** decrement that fresh timer in the same step -- BFS pathfinding around walls toward player for melee enemies -- Sentinel burst (3 shots) + overheat window (3 turns), projectiles damage **player only** (no friendly fire) - -Self-checks (per instructions) both pass: -```bash -node verify.js 1 && node verify.js 2 -``` diff --git a/body-snatcher/build/phase3.attempt1.log b/body-snatcher/build/phase3.attempt1.log deleted file mode 100644 index cdd6121..0000000 --- a/body-snatcher/build/phase3.attempt1.log +++ /dev/null @@ -1,3 +0,0 @@ -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' diff --git a/body-snatcher/build/phase4.attempt1.log b/body-snatcher/build/phase4.attempt1.log deleted file mode 100644 index cdd6121..0000000 --- a/body-snatcher/build/phase4.attempt1.log +++ /dev/null @@ -1,3 +0,0 @@ -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' diff --git a/body-snatcher/build/phase4.attempt2.log b/body-snatcher/build/phase4.attempt2.log deleted file mode 100644 index a17fba8..0000000 --- a/body-snatcher/build/phase4.attempt2.log +++ /dev/null @@ -1,17 +0,0 @@ -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' -Implemented Phase 4 systems (procgen/progression/shop/save-load) and fixed a Phase 3 regression that was breaking verify: - -- AI aggro now uses **path distance** (so melee navigates around walls); **Sentinel/Turret still require LOS** before shooting (prevents stray ranged fire during tests). -- Enemy placement min spawn distance increased to **9** (keeps spawn area calm + prevents random test interference). -- Shop between floors + debug `openShop()` stipend + `G.choices` exposure already in place; save/load validates + restores `_exit` coords-based descend. - -Tests run (multiple times due to procgen randomness): - -```bash -for run in 1 2 3 4 5; do - for i in 1 2 3 4 5; do node verify.js $i || exit 1; done -done -``` - -All phases 1–5 PASS. diff --git a/body-snatcher/build/phase5.attempt1.log b/body-snatcher/build/phase5.attempt1.log deleted file mode 100644 index 04f6c57..0000000 --- a/body-snatcher/build/phase5.attempt1.log +++ /dev/null @@ -1 +0,0 @@ -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' diff --git a/body-snatcher/build/review.log b/body-snatcher/build/review.log deleted file mode 100644 index 04f6c57..0000000 --- a/body-snatcher/build/review.log +++ /dev/null @@ -1 +0,0 @@ -supacode: OSC emit failed: code=ENXIO errno=-6 message=ENXIO: no such device or address, open '/dev/tty' diff --git a/body-snatcher/build/review.pid b/body-snatcher/build/review.pid deleted file mode 100644 index b5631cd..0000000 --- a/body-snatcher/build/review.pid +++ /dev/null @@ -1 +0,0 @@ -44170 diff --git a/body-snatcher/build/tokenmatch.js b/body-snatcher/build/tokenmatch.js deleted file mode 100644 index 3c32c4f..0000000 --- a/body-snatcher/build/tokenmatch.js +++ /dev/null @@ -1,21 +0,0 @@ -const fs=require('fs'); -const espree=require('/opt/homebrew/lib/node_modules/eslint/node_modules/espree/dist/espree.cjs'); -const src=fs.readFileSync('index.html','utf8'); -const m=src.match(/]*>([\s\S]*?)<\/script>/i); -const code=m[1]; -const base=src.slice(0,src.indexOf(' FILE line '+(s.line+base-1)); } diff --git a/body-snatcher/docs/plans/2026-08-12-body-snatcher-design.md b/body-snatcher/docs/plans/2026-08-12-body-snatcher-design.md index c341b63..f9c43d2 100755 --- a/body-snatcher/docs/plans/2026-08-12-body-snatcher-design.md +++ b/body-snatcher/docs/plans/2026-08-12-body-snatcher-design.md @@ -26,6 +26,19 @@ Browser-based roguelike. You are a ghost with 1 HP and no attack. Possess enemie - **Slow baseline:** most chasers move every 2 turns; Skitterer every 2 turns; Turret fires every 2 turns. The player chooses engagements. - **Spawn safety:** the area around spawn is kept clear of enemies. +## Art Direction (high-polish vector art) + +- Everything is drawn on `` with layered primitives — gradients, beveled edges, highlights, outlines, soft drop shadows. NO external image/sprite/font assets (zero-dependency rule holds). +- Atmospheric dungeon: beveled cracked stone walls, lit floor flagstones, glowing runic exit stairs, ornate gilded chests, torch-light color grading, soft vignette. Smooth radial fog (gradient falloff, not a hard circle). +- Each entity is a detailed, personality-rich sprite (eyes tracking facing, equipment, idle bob, possession aura on the current host) — see AGENTS.md §Visual Style and each enemy's Sprite line. Never flat single-rect placeholders. +- Polished UI: bordered panels with icons and accent colors for title, HUD, shop, and pause — not bare text. + +## Movement Feel (snappy) + +- Movement interpolation is a quick ~85ms ease (down from 150ms); HOLD a direction to move continuously at the turn cadence. +- The real-time live loop advances turns at a brisk ~600ms cadence (down from 1000ms) so the dungeon feels alive. +- Presentation/cadence only — the core model stays one-tile-per-turn and `tick(n)` stays deterministic for the headless harness. Never tie game state to wall-clock. + ## Player Guidance and Forgiveness - The title screen explains every control before the player starts: WASD/arrows to move, SPACE to possess or attack, Q/E to face, X to abandon host, ENTER to confirm, and ESC to pause. diff --git a/body-snatcher/index.html b/body-snatcher/index.html deleted file mode 100644 index ec365e9..0000000 --- a/body-snatcher/index.html +++ /dev/null @@ -1,2653 +0,0 @@ - - - - - - Body Snatcher - - - - - - - - diff --git a/body-snatcher/verify.js b/body-snatcher/verify.js deleted file mode 100644 index d3bfd4c..0000000 --- a/body-snatcher/verify.js +++ /dev/null @@ -1,316 +0,0 @@ -#!/usr/bin/env node -'use strict'; -/* - verify.js — headless test harness for Body Snatcher (single index.html). - Uses only Node builtins: fs, vm, path. - Usage: node verify.js (phase 1..5). Exit 0 = pass, 1 = fail. -*/ -const fs = require('fs'); -const path = require('path'); -const vm = require('vm'); - -const PHASE = parseInt(process.argv[2] || '1', 10); -const HTML = path.join(__dirname, 'index.html'); -const SAVE_KEY = 'bodysnatcher_save'; - -const ENEMIES = ['Brute','Skitterer','Sentinel','Shielder','Bomber','Healer','Phaser','Turret','Charger','Siren','Mimic','Leech']; -const VALID_STATES = ['title','playing','possessed','shop','paused','won','lost']; - -function fail(msg){ const e = new Error(msg || 'assertion failed'); e._assert = true; throw e; } -function assert(c, m){ if (!c) fail(m || 'assertion failed'); } - -// ---------------------------------------------------------------- read source -if (!fs.existsSync(HTML)) { console.error(`FAIL: index.html not found`); process.exit(1); } -const SRC = fs.readFileSync(HTML, 'utf8'); - -const scriptRe = /]*)>([\s\S]*?)<\/script>/gi; -let mm, SCRIPT = '', externalSrc = false; -while ((mm = scriptRe.exec(SRC))) { - if (/\bsrc\s*=/.test(mm[1] || '')) externalSrc = true; - SCRIPT += '\n' + (mm[2] || ''); -} -if (!SCRIPT.trim()) { /* maybe the game is all inline anyway; keep going */ } - -// ----------------------------------------------------------------- mocks -function noop(){ return undefined; } -const grad = { addColorStop: noop, addColorStop: noop }; -const texts = []; - -function makeCtx(canvas){ - const base = { - canvas, - fillStyle:'#000', strokeStyle:'#000', shadowColor:'#000', font:'10px sans-serif', - textAlign:'left', textBaseline:'alphabetic', globalAlpha:1, lineWidth:1, lineCap:'butt', - lineJoin:'miter', miterLimit:10, shadowBlur:0, shadowOffsetX:0, shadowOffsetY:0, - globalCompositeOperation:'source-over', imageSmoothingEnabled:true, lineDashOffset:0, - save:noop, restore:noop, scale:noop, rotate:noop, translate:noop, transform:noop, - setTransform:noop, resetTransform:noop, - beginPath:noop, closePath:noop, moveTo:noop, lineTo:noop, bezierCurveTo:noop, - quadraticCurveTo:noop, arc:noop, arcTo:noop, rect:noop, ellipse:noop, fill:noop, - stroke:noop, clip:noop, isPointInPath:()=>false, - clearRect:noop, fillRect:noop, strokeRect:noop, drawImage:noop, - fillText:(t)=>{ texts.push(String(t)); }, strokeText:(t)=>{ texts.push(String(t)); }, - measureText:(s)=>({ width: ((String(s)||'').length*7)+2 }), - getImageData:(x,y,w,h)=>({ data: new Uint8ClampedArray(Math.max(1,(w||1))*(h||1)*4) }), - putImageData:noop, createImageData:(w,h)=>({ data: new Uint8ClampedArray((w||1)*(h||1)*4) }), - createLinearGradient:()=>({addColorStop:noop}), createRadialGradient:()=>({addColorStop:noop}), - createPattern:()=>({}), setLineDash:noop, getLineDash:()=>[], drawFocusIfNeeded:noop, - }; - return new Proxy(base, { - get(t,p){ return (p in t) ? t[p] : noop; }, - set(t,p,v){ t[p]=v; return true; }, - }); -} - -function makeCanvas(id){ - const canvas = { id, width:800, height:640, clientWidth:800, clientHeight:640, - style:{}, tabindex:0, addEventListener:noop, removeEventListener:noop, focus:noop, blur:noop, - getBoundingClientRect:()=>({left:0,top:0,right:800,bottom:640,width:800,height:640,x:0,y:0}) }; - const ctx = makeCtx(canvas); - canvas.getContext = (type)=> (/2d/i.test(String(type)) ? ctx : {}); - return canvas; -} - -const els = {}; -['game','canvas','screen','board','c','main','stage','view','bg','overlay','hud'].forEach(id=>{ els[id] = makeCanvas(id); }); -function genericEl(){ - return { style:{}, addEventListener:noop, removeEventListener:noop, appendChild:noop, - removeChild:noop, setAttribute:noop, getAttribute:()=>null, getContext:()=>({}), - innerHTML:'', textContent:'', firstChild:null, lastChild:null, childNodes:[], children:[], - parentElement:null, focus:noop, click:noop, blur:noop, - classList:{add:noop,remove:noop,toggle:noop,contains:()=>false}, dataset:{}, append:noop, - prepend:noop, insertBefore:noop, replaceChild:noop }; -} -const keyHandlers = []; -const loadHandlers = []; -const documentMock = { - getElementById:(id)=> (els[id] !== undefined ? els[id] : null), - createElement:(tag)=> (String(tag).toLowerCase()==='canvas' ? makeCanvas() : genericEl()), - createElementNS:(_n,tag)=> documentMock.createElement(tag), - createTextNode:(t)=>({ textContent:String(t), nodeType:3 }), - addEventListener:(ev,cb)=>{ if (/key/i.test(ev)) keyHandlers.push(cb); if (/load|domcontent/i.test(ev)) loadHandlers.push(cb); }, - removeEventListener:noop, - body: Object.assign(genericEl(), { addEventListener:noop }), - documentElement: Object.assign(genericEl(), { clientWidth:800, clientHeight:640, addEventListener:noop }), - head: genericEl(), - readyState:'complete', querySelector:()=>null, querySelectorAll:()=>[], - getElementsByTagName:()=>[], getElementsByClassName:()=>[], - createEvent:()=>({ initEvent:noop, initCustomEvent:noop }), - title:'', hidden:false, visibilityState:'visible', hasFocus:()=>true, -}; - -const store = {}; -const setItemCalls = []; -const localStorageMock = { - getItem:(k)=> Object.prototype.hasOwnProperty.call(store,k) ? store[k] : null, - setItem:(k,v)=>{ store[k]=String(v); setItemCalls.push(String(k)); }, - removeItem:(k)=>{ delete store[k]; }, - clear:()=>{ Object.keys(store).forEach(k=>delete store[k]); }, - key:(i)=> Object.keys(store)[i] || null, - get length(){ return Object.keys(store).length; }, -}; - -const audioMethods = {}; -let audioCreated = 0; -function makeAudioNode(){ return { - connect:()=>({}), disconnect:noop, start:noop, stop:noop, frequency:{value:440,setValueAtTime:noop,linearRampToValueAtTime:noop,exponentialRampToValueAtTime:noop}, - gain:{value:1,setValueAtTime:noop,linearRampToValueAtTime:noop,exponentialRampToValueAtTime:noop}, - detune:{value:0,setValueAtTime:noop}, type:'', playbackRate:{value:1,setValueAtTime:noop}, - Q:{value:1,setValueAtTime:noop}, buffer:null, loop:false, destination:{} -}; } -class MockAudioContext { - constructor(){ audioCreated++; this.currentTime=0; this.state='running'; this.sampleRate=44100; - this.destination={ connect:()=>({}) }; this.listener={}; } - createOscillator(){ audioMethods.createOscillator=1; return makeAudioNode(); } - createGain(){ audioMethods.createGain=1; return makeAudioNode(); } - createBufferSource(){ audioMethods.createBufferSource=1; return makeAudioNode(); } - createDynamicsCompressor(){ return makeAudioNode(); } - createAnalyser(){ return makeAudioNode(); } - createBiquadFilter(){ return makeAudioNode(); } - createDelay(){ return makeAudioNode(); } - createBuffer(){ return { getChannelData:()=>new Float32Array(1024) }; } - decodeAudioData(){ return Promise.resolve({}); } - resume(){ audioMethods.resume=1; return Promise.resolve(); } - suspend(){ return Promise.resolve(); } - close(){ return Promise.resolve(); } -} - -let perfNow = 0; -const sb = {}; -sb.setTimeout = (fn)=>{ const id=Math.random(); return id; }; // no-op (deterministic loop via tick) -sb.clearTimeout = noop; sb.setInterval = ()=>1; sb.clearInterval = noop; -sb.queueMicrotask = (fn)=>{ Promise.resolve().then(fn); }; -sb.requestAnimationFrame = ()=>1; sb.cancelAnimationFrame = noop; -sb.requestIdleCallback = ()=>1; sb.cancelIdleCallback = noop; -sb.performance = { now:()=>(perfNow+=16), timeOrigin:0, mark:noop, measure:noop }; -sb.Date = Date; -sb.localStorage = localStorageMock; -sb.AudioContext = MockAudioContext; sb.webkitAudioContext = MockAudioContext; -sb.document = documentMock; -sb.console = { log:noop, debug:noop, info:noop, trace:noop, - warn:(...a)=>process.stderr.write('[game.warn] '+a.map(String).join(' ')+'\n'), - error:(...a)=>process.stderr.write('[game.err] '+a.map(String).join(' ')+'\n') }; -sb.navigator = { userAgent:'node.js', platform:process.platform, language:'en' }; -sb.location = { href:'file:///', reload:noop }; -sb.screen = { width:800, height:640 }; -sb.matchMedia = ()=>({ matches:false, addListener:noop, removeListener:noop, addEventListener:noop, removeEventListener:noop }); -sb.innerWidth = 800; sb.innerHeight = 640; sb.devicePixelRatio = 1; -['Math','JSON','Object','Array','String','Number','Boolean','RegExp','Map','Set','WeakMap','WeakSet','Symbol','Error','TypeError','RangeError','SyntaxError','Promise','Reflect','Proxy','Uint8Array','Uint8ClampedArray','Int8Array','Int16Array','Uint16Array','Int32Array','Uint32Array','Float32Array','Float64Array','ArrayBuffer','DataView','Number','parseInt','parseFloat','isNaN','isFinite','encodeURIComponent','decodeURIComponent','encodeURI','decodeURI'].forEach(k=>{ if (global[k]!==undefined) sb[k]=global[k]; }); -sb.btoa = (s)=> Buffer.from(s,'binary').toString('base64'); -sb.atob = (s)=> Buffer.from(s,'base64').toString('binary'); -sb.window = sb; sb.self = sb; sb.globalThis = sb; - -// ----------------------------------------------------------------- run script -vm.createContext(sb); -try { - vm.runInContext(SCRIPT, sb, { filename:'index.html-inline', timeout:8000 }); -} catch (e) { - console.error('FAIL: index.html inline script threw on load:\n' + (e && e.stack || e)); - process.exit(1); -} -for (const h of loadHandlers) { try { h({type:'load'}); } catch(_){} } - -const G = sb.GAME; -if (!G) { console.error('FAIL: window.GAME is not defined after load'); process.exit(1); } - -// ----------------------------------------------------------------- helpers -const H = {}; -H.inBounds = (x,y)=>{ const g=G.grid; return !!(g && y>=0 && y=0 && x{ if(!H.inBounds(x,y)) return -1; const t=G.grid[y][x]; return (t && typeof t==='object') ? (t.type!==undefined?t.type:0) : t; }; -H.isWall = (x,y)=>{ if(H.tileType(x,y)===1) return true; const t=G.grid && G.grid[y] && G.grid[y][x]; return !!(t && typeof t==='object' && t.solid); }; -H.setTile = (x,y,type,solid)=>{ if(!H.inBounds(x,y)) return; const cur=G.grid[y][x]; const sol = solid!==undefined?solid:(type===1); - if (cur && typeof cur==='object') { cur.type=type; cur.solid=sol; } else { G.grid[y][x]=type; } }; -H.floor = (x,y)=> H.setTile(x,y,0,false); -H.wall = (x,y)=> H.setTile(x,y,1,true); -H.clearRow = (y,x1,x2)=>{ for(let x=x1;x<=x2;x++) if(H.inBounds(x,y)) H.floor(x,y); }; -H.clearCol = (x,y1,y2)=>{ for(let y=y1;y<=y2;y++) if(H.inBounds(x,y)) H.floor(x,y); }; -H.manhattan = (a,b)=> Math.abs(a.x-b.x)+Math.abs(a.y-b.y); -H.cheby = (a,b)=> Math.max(Math.abs(a.x-b.x),Math.abs(a.y-b.y)); -H.ppos = ()=> ({ x:G.player.x, y:G.player.y }); -H.start = ()=>{ if (typeof G.start==='function') G.start(); }; -H.newRun = ()=>{ if (typeof G.newRun==='function') { G.newRun(); } else { if(typeof G.start==='function')G.start(); G.input('Enter'); } }; -H.findExit = ()=>{ if (G._exit && G._exit.x!==undefined) return {x:G._exit.x,y:G._exit.y}; - const g=G.grid; for(let y=0;y{ for(let rad=0;rad<=(r||6);rad++) for(let dy=-rad;dy<=rad;dy++) for(let dx=-rad;dx<=rad;dx++){ const nx=x+dx,ny=y+dy; if(H.inBounds(nx,ny)&&!H.isWall(nx,ny)) return {x:nx,y:ny}; } return null; }; -H.spawnAt = (type,x,y)=>{ if(H.inBounds(x,y)) H.floor(x,y); return G.spawn(type,x,y); }; -H.maxHp = (e)=> e && (e.maxHp!==undefined?e.maxHp:e.hp); -H.statVal = (e,keys)=>{ for(const k of keys) if(e && e[k]!==undefined) return e[k]; return undefined; }; -H.countAch = ()=>{ const a=G.achievements; if(!a) return 0; - if(Array.isArray(a)) return a.filter(x=>x && (x.unlocked||x.done||x.unlockedAt)).length; - return Object.values(a).filter(v=> v===true || (v && v.unlocked)).length; }; -H.descend = ()=>{ // step the player onto the exit tile; returns resulting state - const ex = H.findExit(); if(!ex) return null; - // place player on a floor neighbour of the exit - const neigh=[[-1,0],[1,0],[0,-1],[0,1]].find(([dx,dy])=>H.inBounds(ex.x+dx,ex.y+dy)); - if(!neigh) return G.state; - const sx=ex.x+neigh[0], sy=ex.y+neigh[1]; H.floor(sx,sy); - G.player.x=sx; G.player.y=sy; - // move onto exit - if(ex.x>sx) G.input('ArrowRight'); else if(ex.xsy) G.input('ArrowDown'); else G.input('ArrowUp'); - return G.state; -}; -H.projectilesAt = ()=> (Array.isArray(G.projectiles)?G.projectiles.length:(G.projectiles?Object.keys(G.projectiles).length:0)); -H.tankHost = ()=>{ const h=G.player&&G.player.host; if(h){ h.hp=999; if(h.maxHp!==undefined)h.maxHp=999; } }; - -// ----------------------------------------------------------------- phase defs -function p1(){ - const checks = []; - checks.push(['index.html has and