80 lines
2.4 KiB
Markdown
80 lines
2.4 KiB
Markdown
# Phase 1: Foundation - Context
|
||
|
||
**Gathered:** 2026-03-10
|
||
**Status:** Ready for planning
|
||
|
||
<domain>
|
||
## Phase Boundary
|
||
|
||
Build the technical foundation: game loop, HiDPI-aware canvas rendering, Player 1 keyboard input (W/S), ball physics (continuous movement, wall bouncing, zone-based angle deflection, per-hit speed increase). No scoring, no AI, no UI screens yet.
|
||
|
||
</domain>
|
||
|
||
<decisions>
|
||
## Implementation Decisions
|
||
|
||
### File Structure
|
||
- Single HTML file — everything embedded (JS + CSS in one `.html` file)
|
||
- JavaScript organized into a module pattern: `GameLoop`, `Physics`, `Renderer`, `Input` objects within a single `<script>` tag
|
||
- No build tooling; runs directly from the filesystem
|
||
|
||
### Canvas Sizing
|
||
- Full-window canvas — fills the entire browser window
|
||
- Resizes immediately on window resize
|
||
- Maintains aspect ratio during resize; minimum 4:3 aspect ratio enforced
|
||
- No maximum size cap — grows unbounded to fill any screen
|
||
- Must be HiDPI/Retina aware (devicePixelRatio scaling)
|
||
|
||
### Ball Physics Feel
|
||
- Zone-based deflection: paddle divided into 5 zones
|
||
- Top edge → ~60° angle upward
|
||
- Upper zone → ~30° angle
|
||
- Center → ~5° angle (nearly flat)
|
||
- Lower zone → ~30° angle
|
||
- Bottom edge → ~60° angle downward
|
||
- Speed increases per paddle hit (small increment each rally)
|
||
- Speed resets on each point scored
|
||
- No maximum speed cap — ball accelerates indefinitely through long rallies
|
||
|
||
### Claude's Discretion
|
||
- Exact speed increment value per hit (tune for feel)
|
||
- Precise zone boundary definitions and angle values (within the ~5°–60° range)
|
||
- Game loop timing implementation (requestAnimationFrame + delta time)
|
||
- Serve direction and initial ball velocity for dev testing
|
||
- Input handling internals (keydown/keyup state tracking)
|
||
|
||
</decisions>
|
||
|
||
<specifics>
|
||
## Specific Ideas
|
||
|
||
- No specific requirements — open to standard approaches
|
||
|
||
</specifics>
|
||
|
||
<code_context>
|
||
## Existing Code Insights
|
||
|
||
### Reusable Assets
|
||
- None — fresh project, no existing code
|
||
|
||
### Established Patterns
|
||
- None yet — Phase 1 establishes the patterns all subsequent phases follow
|
||
|
||
### Integration Points
|
||
- Phase 2 will add scoring, Player 2 input, and AI — the game loop and physics module must be structured to accommodate adding a second paddle and score tracking without refactoring
|
||
|
||
</code_context>
|
||
|
||
<deferred>
|
||
## Deferred Ideas
|
||
|
||
- None — discussion stayed within phase scope
|
||
|
||
</deferred>
|
||
|
||
---
|
||
|
||
*Phase: 01-foundation*
|
||
*Context gathered: 2026-03-10*
|