Commit Graph

2 Commits

Author SHA1 Message Date
343fca4889 Refactor replay system to reuse Level1.initialize() and simplify UI
Major architectural improvements:
- Simplified replay system from ~1,450 lines to ~320 lines (78% reduction)
- Removed scene reconstruction complexity in favor of reusing game logic
- Added isReplayMode parameter to Level1 and Ship constructors
- Level1.initialize() now creates scene for both game and replay modes
- ReplayPlayer simplified to find existing meshes instead of loading assets

Replay system changes:
- ReplayManager now uses Level1.initialize() to populate scene
- Deleted obsolete files: assetCache.ts, ReplayAssetRegistry.ts
- Removed full scene deserialization code from LevelDeserializer
- Fixed keyboard input error when initializing in replay mode
- Physics bodies converted to ANIMATED after Level1 creates them

UI simplification for new users:
- Hidden level editor, settings, test scene, and replay buttons
- Hidden "Create New Level" link
- Filtered level selector to only show recruit and pilot difficulties
- Clean, focused experience for first-time users

Technical improvements:
- PhysicsRecorder now accepts LevelConfig via constructor
- Removed sessionStorage dependency for level state
- Fixed Color3 alpha property error in levelSerializer
- Cleaned up unused imports and dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 19:20:36 -06:00
128b402955 Add core replay system components (part 1/2)
Implemented 4 core classes for physics replay functionality:

1. ReplayAssetRegistry - Loads and caches mesh templates
   - Pre-loads ship, asteroid, and base meshes
   - Creates instances/clones based on object ID
   - Handles asset disposal and caching

2. ReplayPlayer - Frame-by-frame playback engine
   - Fixed timestep at 7.2 Hz with frame interpolation
   - Play/pause/scrub/step forward/step backward
   - Variable playback speed (0.5x, 1x, 2x)
   - ANIMATED physics bodies (kinematic control)
   - Observable events for state changes

3. ReplayCamera - Dual-mode camera system
   - Free camera (ArcRotateCamera user-controlled)
   - Ship-following mode with smooth lerp
   - Toggle between modes
   - Auto-framing to fit all objects
   - Camera limits and controls

4. ReplayControls - Full playback UI
   - Play/pause, step forward/backward buttons
   - Speed control (0.5x, 1x, 2x)
   - Progress slider for scrubbing
   - Time display (current/total)
   - Camera mode toggle button
   - Exit button

Next: ReplaySelectionScreen, ReplayManager, and integration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 06:05:38 -06:00