(Body Snatcher) Prepare Pass 4

This commit is contained in:
AlexKucera committed 2026-08-13 08:56:50 +02:00
1 parent 47c630801a
commit e2a47aba6b
41 files changed
+61 -9422

No files matched your search

+43 -37
View File
@@ -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 `<canvas>`** — 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.