Files
gijs_pong/.planning/STATE.md
2026-03-10 20:50:52 +01:00

136 lines
5.1 KiB
Markdown

---
gsd_state_version: 1.0
milestone: v1.0
milestone_name: milestone
status: unknown
stopped_at: Phase 2 context gathered
last_updated: "2026-03-10T19:50:48.489Z"
progress:
total_phases: 5
completed_phases: 1
total_plans: 2
completed_plans: 2
---
# STATE: Super Pong Next Gen
**Project Reference**
- **Core Value:** Pong reimagined with juice and depth — spectacular visuals, rich mechanics, complete game experience
- **Current Focus:** Phase 1 — executing plans
- **Key Constraint:** Coarse granularity (5 phases max), HTML5 Canvas + vanilla JS, static deployment
---
## Current Position
| Attribute | Value |
|-----------|-------|
| **Phase** | 01-foundation |
| **Plan** | Plan 2/2 — COMPLETE |
| **Status** | Phase 01 complete — ball physics, wall bounce, zone deflection, speed increment, serve logic done |
| **Progress** | 10% (2/2 plans complete in Phase 1; Phase 1 of 5 complete) |
```
[== ] 10% — Phase 1: Complete (2/2 plans)
```
---
## Performance Metrics
| Metric | Target | Status |
|--------|--------|--------|
| **Phase Coverage** | 100% (37/37 requirements mapped) | ✓ Complete |
| **Success Criteria** | 2-5 per phase | ✓ Complete |
| **Dependency Chain** | Linear (P1 → P2 → P3 → P4 → P5) | ✓ Validated |
| **01-01 Duration** | — | 1 min (2 tasks, 1 file) |
| **01-02 Duration** | — | 1 min (2 tasks, 1 file) |
---
## Accumulated Context
### Key Decisions Made
1. **Coarse Granularity Compression:** Research suggested 10 phases; compressed to 5 by merging:
- Game loop + input + physics = Phase 1
- Second paddle + AI = Phase 2
- Menus + audio + pause = Phase 3
- Visual effects + power-ups + arenas = Phase 4
- Performance + testing = Phase 5
2. **Phase 5 (Release) Has No Requirements:** All 37 v1 requirements covered by phases 1-4. Phase 5 is purely validation (cross-browser, performance, pitfall mitigation).
3. **Success Criteria Grounded in Research Pitfalls:** Each phase's criteria address critical pitfalls from research:
- Phase 1: DPI scaling, game loop timing
- Phase 2: Ball tunneling, input lag, AI balance
- Phase 3: Audio autoplay policy
- Phase 4: Power-up balance
- Phase 5: Performance, memory leaks, cross-browser
4. **deltaTime Cap at 50ms:** Game loop caps deltaTime to prevent physics explosion when tab loses focus and resumes — without this a single large delta would fling the ball off screen.
5. **Logical vs Bitmap Coordinate Separation:** canvas.width/height = logical * devicePixelRatio; ctx.scale(dpr, dpr) makes all game draw calls use logical pixels — correct HiDPI approach for sharp rendering on Retina displays.
6. **Module-Object Pattern Established:** GameLoop, Renderer, Input, Physics, GameState are plain JS objects with init() methods in a single script tag. No classes, no modules, no build step — runs directly from filesystem.
7. **e.code over e.key for Input:** Using e.code === 'KeyW' makes W/S detection layout-independent (works on AZERTY and other non-QWERTY keyboards).
8. **Zone angles [-60, -30, 5, 30, 60] degrees:** Center zone uses 5 deg not 0 to prevent infinite horizontal ball loops; top/bottom edges at 60 degrees for dramatic deflection.
9. **GameConfig centralizes tunable constants:** initialBallSpeed (220px/s), speedIncrement (18px/s), paddleSpeed (400px/s) — all adjustable without touching Physics logic.
10. **vx/vy recomputed from speed+angle each paddle hit:** Prevents compound rounding drift from repeated scaling; speed and direction always cleanly separated.
### Coverage Validation
**Total v1 Requirements:** 37
- CORE (8): All mapped to Phase 1-2
- AI (4): All mapped to Phase 2
- SCRN (4): All mapped to Phase 3
- VFX (5): All mapped to Phase 1 (DPI) and Phase 4 (particles/glow/trails/shake)
- PWR (7): All mapped to Phase 4
- ARENA (4): All mapped to Phase 4
- AUD (5): All mapped to Phase 3
**Unmapped Requirements:** 0 ✓
**Coverage:** 100% ✓
### Research Alignment
- Phase 1 addresses Research Pitfalls: #1 (Game Loop Timing), #2 (Canvas DPI Scaling)
- Phase 2 addresses Research Pitfalls: #3 (Ball Tunneling), #4 (Input Lag), #5 (AI Difficulty Balance)
- Phase 3 addresses Research Pitfall: #6 (WebAudio Autoplay Policy)
- Phase 4 addresses Research Pitfalls: #7 (Power-Up Balance)
- Phase 5 addresses Research Pitfall: #8 (Memory Leaks)
---
## Session Continuity
### What Just Happened
Phase 01 complete. Plan 01-02 executed: Ball physics added to index.html — ball serves from center at 220px/s in random direction, bounces off top/bottom walls, deflects off Player 1 paddle with 5-zone angle control (-60 to +60 degrees), and accelerates by 18px/s per paddle hit. On-canvas speed debug display confirms speed increments and resets. Requirements CORE-01, CORE-02, CORE-03, CORE-04 satisfied. All 6 Phase 1 success criteria met.
### What Comes Next
1. Execute Phase 2 — Second paddle (Player 2 / AI), scoring system, ball tunneling safeguards
2. Continue through phases 3-5 after Phase 2 complete
### Known Blockers
None.
### Decisions Pending
None.
### Last Session
Stopped at: Phase 2 context gathered
---
*State initialized: 2026-03-10*