# Project Context

Quick reference for agents to restore context. Updated after significant actions.

---

## Project Summary

**Type:** Roguelite platformer (browser-based)
**Tech Stack:** Phaser 3 + TypeScript + Vite
**Current Phase:** Phase 1 - Core Loop (in progress)

---

## Key Documents

| Document | Purpose |
|----------|---------|
| `CLAUDE.md` | Agent instructions, project structure |
| `docs/REQUIREMENTS.md` | Full game design, mechanics, upgrades |
| `docs/ARCHITECTURE.md` | Technical architecture, patterns, interfaces |
| `docs/ROADMAP.md` | Development phases, task checklists |
| `docs/CONTEXT.md` | This file - action log for agents |

---

## Core Mechanics (Quick Reference)

- **One-hit kill** platformer (by default)
- **Stun projectiles** - 3 max, 3s cooldown each, stun enemies for 3s
- **Collect all coins** to complete level
- **GasCoins** - meta-currency earned from collected coins
- **Shop** - buy upgrades between runs
- **Procedural generation** - Spelunky-style room grid (4x4)

---

## Game Feel Constants

```
Coyote Time: 100ms
Input Buffer: 100ms
Edge Correction: 4px
Stun Duration: 3s (base)
Projectile Cooldown: 3s (base)
Max Projectiles: 3 (base)
```

---

## Action Log

### 2025-01-17

**Phase 1 Core Implementation Started**

1. **Project Initialized**
   - Vite + TypeScript + Phaser 3 configured
   - `package.json`, `tsconfig.json`, `vite.config.ts` created
   - Path aliases (`@/`) configured

2. **Config Files Created**
   - `src/config/game.config.ts` - Phaser config (1280x720, Arcade Physics)
   - `src/config/physics.config.ts` - Movement speeds, gravity, timings
   - `src/config/controls.config.ts` - Key bindings, game feel constants
   - `src/config/balance.config.ts` - Scoring, level progression, spawn rates

3. **Type Definitions Created**
   - `src/types/game-state.ts` - RunState, MetaState interfaces
   - `src/types/entities.ts` - Enemy, Hazard, Player configs

4. **Base Scenes Implemented**
   - `BootScene` - Initializes registry with state
   - `PreloadScene` - Generates placeholder textures
   - `GameScene` - Core gameplay with test level
   - `UIScene` - HUD (coins, projectiles, score)
   - `GameOverScene` - Death screen with stats, GasCoin conversion

5. **Entities Implemented**
   - `Player` - Movement, jump with game feel (coyote time, input buffer, variable jump)
   - `Enemy` - Patroller with stun mechanic, visual indicator
   - `Coin` - Collection with animation
   - `Projectile` - Firing and collision

6. **Core Systems Working**
   - Player movement with responsive controls
   - Projectile system with cooldowns
   - Enemy stunning with timer
   - Coin collection and level completion
   - Death/restart cycle
   - HUD updates
   - GasCoin earning on death
   - LocalStorage save/load

### 2025-01-16

**Documentation Phase Complete**

1. Created `docs/ARCHITECTURE.md`
2. Created `docs/ROADMAP.md`
3. Created `docs/CONTEXT.md`

---

## Current State

```
[x] Requirements defined (REQUIREMENTS.md)
[x] Architecture designed (ARCHITECTURE.md)
[x] Roadmap created (ROADMAP.md)
[x] Project initialized (Vite + Phaser + TS)
[x] Config files created
[x] Type definitions created
[x] Base scenes implemented
[x] Player with game feel
[x] Patroller enemy with stun
[x] Coins and collection
[x] Projectile system
[x] Basic HUD
[x] Game Over with GasCoins
[ ] Particles and visual juice
[ ] Audio system
[ ] Shop scene
[ ] More enemy types
[ ] Procedural level generation
```

---

## Project Structure (Current)

```
src/
├── main.ts              # Entry point
├── vite-env.d.ts        # Vite types
├── config/
│   ├── game.config.ts
│   ├── physics.config.ts
│   ├── controls.config.ts
│   └── balance.config.ts
├── types/
│   ├── index.ts
│   ├── game-state.ts
│   └── entities.ts
├── scenes/
│   ├── BootScene.ts
│   ├── PreloadScene.ts
│   ├── GameScene.ts
│   ├── UIScene.ts
│   └── GameOverScene.ts
└── entities/
    ├── Player.ts
    ├── Enemy.ts
    ├── Coin.ts
    └── Projectile.ts
```

---

## Next Actions

1. Add particles (dust, stun stars, coin sparkle)
2. Add screen shake options
3. Add basic sound effects
4. Implement ShopScene
5. Add more enemy types (Jumper, Flyer)
6. Implement procedural level generation

---

## Commands

```bash
npm run dev      # Start dev server (http://localhost:3000)
npm run build    # Production build
npm run preview  # Preview production build
```

---

## Key Decisions Made

| Decision | Rationale |
|----------|-----------|
| Phaser 3 Arcade Physics | Simple, performant, good for platformers |
| Dual-state pattern | Clean separation of run vs persistent data |
| Placeholder textures | Quick iteration, real assets later |
| Registry for state | Shared state between scenes |
| Arrow function callbacks | Cleaner collision handling |

---

## Known Issues

- None critical at this point

---

## How to Use This File

**For agents starting work:**
1. Read this file first for quick context
2. Check "Current State" for project status
3. Check "Next Actions" for immediate tasks
4. Read relevant docs (ARCHITECTURE.md, ROADMAP.md) as needed

**After completing work:**
1. Add entry to "Action Log" with date
2. Update "Current State" checkboxes
3. Update "Next Actions" if changed
4. Note any "Known Issues" discovered
