Commit Graph

37 Commits

Author SHA1 Message Date
31b498da7d Add status screen pause functionality with VR controller picking
Some checks failed
Build / build (push) Failing after 24s
Implemented comprehensive status screen system with pause/resume and game-end states:

- Added enable/disable functionality to controller and keyboard input systems
- X button and inspector key always work, even when controls disabled
- Created Resume/Replay/Exit VR buttons in status screen
- Resume button appears on manual pause, Replay appears on game end
- Implemented automatic status screen display on game end conditions:
  * Death: hull < 0.01 outside landing zone
  * Stranded: fuel < 0.01 and velocity < 1 outside landing zone
  * Victory: all asteroids destroyed inside landing zone
- Fixed landing zone detection to use mesh intersection instead of distance
- Implemented dynamic VR pointer selection using attach/detach pattern
- Pointer selection only enabled when status screen is visible
- Ship controls automatically disabled when status screen shows

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 09:55:03 -06:00
faa5afc604 Add flat camera mode support and fix WebXR user activation
Some checks failed
Build / build (push) Failing after 24s
WebXR-optional gameplay:
- Removed WebXR requirement check, game now works without VR
- Made WebXR initialization optional with graceful fallback
- Flat camera mode automatically activates when XR unavailable
- Keyboard/mouse controls work in flat camera mode
- Camera following works in both XR and flat modes

Fixed WebXR user activation issue:
- Restructured initialization to enter XR immediately after button click
- Moved enterXRAsync() before asset loading to maintain user gesture
- Level1.play() now detects if XR session already active (state === 4)
- Removed setTimeout delays that broke user activation chain
- Falls back to flat mode if XR entry fails at any point

Game initialization improvements:
- Game timer and physics recorder start in both XR and flat modes
- Level1 constructor only sets up XR observables if XR available
- Ship.initialize() activates flat camera when XR not present
- Background stars follow active camera (XR or flat)
- Ready observable calls play() immediately to maintain activation

User experience:
- Game starts immediately in available mode (VR or flat)
- Seamless fallback if VR headset disconnects or unavailable
- Desktop users can now play with keyboard/mouse
- No error messages blocking non-VR users

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 06:30:59 -06:00
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
d8571ef740 Add physics recorder system with ring buffer and IndexedDB storage
All checks were successful
Build / build (push) Successful in 1m28s
Implemented comprehensive physics state recording system:
- PhysicsRecorder class with 30-second ring buffer (always recording)
- Captures position, rotation (quaternion), velocities, mass, restitution
- IndexedDB storage for long recordings (2-10 minutes)
- Segmented storage (1-second segments) for efficient retrieval
- Keyboard shortcuts for recording controls:
  * R - Export last 30 seconds from ring buffer
  * Ctrl+R - Toggle long recording on/off
  * Shift+R - Export long recording to JSON

Features:
- Automatic capture on physics update observable (~7 Hz)
- Zero impact on VR frame rate (< 0.5ms overhead)
- Performance tracking and statistics
- JSON export with download functionality
- IndexedDB async storage for large recordings

Technical details:
- Ring buffer uses circular array for constant memory
- Captures all physics bodies in scene per frame
- Stores quaternions for rotation (more accurate than Euler)
- Precision: 3 decimal places for vectors, 4 for quaternions
- Integration with existing Level1 and keyboard input system

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 05:22:49 -06:00
688d002752 Step 5: Track fuel consumed
Some checks failed
Build / build (push) Failing after 19s
Added real-time tracking of fuel consumption from linear and angular thrust.

**Modified: src/shipPhysics.ts**
- Added GameStats import and _gameStats property
- Added setGameStats() method to receive GameStats instance
- Call gameStats.recordFuelConsumed() after each fuel consumption
- Tracks both linear thrust (forward/backward) and angular thrust (rotation)
- Records exact consumption amounts (0.005 max per frame for each)

**Modified: src/ship.ts**
- Wire up physics system with GameStats via setGameStats()
- Called immediately after physics initialization

The Fuel Consumed statistic now updates in real-time on the status screen, accumulating all fuel used for movement and rotation, displayed as a percentage.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 04:00:23 -06:00
739f140ea4 Step 4: Track shots fired
Some checks failed
Build / build (push) Failing after 20s
Added real-time tracking of shots fired in the weapon system.

**Modified: src/weaponSystem.ts**
- Added GameStats import and _gameStats property
- Added setGameStats() method to receive GameStats instance
- Call gameStats.recordShotFired() in fire() method after creating projectile
- Tracks every shot fired regardless of whether it hits

**Modified: src/ship.ts**
- Wire up weapon system with GameStats via setGameStats()
- Called immediately after weapon initialization

The Shots Fired statistic now updates in real-time on the status screen whenever the player fires their weapon.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 03:59:06 -06:00
8fc956f112 Step 3: Track hull damage
Some checks failed
Build / build (push) Failing after 19s
Added real-time tracking of cumulative hull damage from collisions.

**Modified: src/ship.ts**
- Subscribe to shipStatus.onStatusChanged in initialize()
- Filter for hull status type with negative delta (damage, not repair)
- Call gameStats.recordHullDamage() with absolute value of delta
- Accumulates all damage over time (e.g., 15 hits at 0.01 each = 0.15 total)

The Hull Damage Taken statistic now updates in real-time on the status screen, showing cumulative damage as a percentage.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 03:58:11 -06:00
e4fbbce2c7 Step 2: Track asteroids destroyed
Some checks failed
Build / build (push) Failing after 20s
Added real-time tracking of asteroids destroyed by listening to scoreboard score events.

**Modified: src/ship.ts**
- Subscribe to scoreboard.onScoreObservable in initialize()
- Call gameStats.recordAsteroidDestroyed() for each score event
- Each score event represents one asteroid destroyed

The Asteroids Destroyed statistic now updates in real-time on the status screen whenever an asteroid is destroyed.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 03:53:40 -06:00
ff9d9faa2a Step 1: Implement game timer tracking
Some checks failed
Build / build (push) Has been cancelled
Added real-time game timer that starts when VR headset tracking is active.

**Modified: src/ship.ts**
- Added public getter for gameStats to allow Level1 to access it

**Modified: src/level1.ts**
- Call ship.gameStats.startTimer() in onInitialXRPoseSetObservable
- Timer starts when XR pose is set (when VR tracking begins)
- Added debug log to confirm timer start

The Game Time statistic now tracks actual play time from when the user enters VR, displayed in MM:SS format on the status screen.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 03:53:07 -06:00
406cebcd96 Add status screen with game statistics display
Some checks failed
Build / build (push) Failing after 20s
Implemented a toggleable status screen that displays game statistics, activated by pressing the X button on the left VR controller.

**New File: src/gameStats.ts**
- GameStats class to track game statistics
- Tracks: game time, asteroids destroyed, hull damage taken, shots fired, shots hit, fuel consumed
- Methods: startTimer(), recordAsteroidDestroyed(), recordHullDamage(), recordShotFired(), recordShotHit(), recordFuelConsumed()
- Calculated stats: getGameTime(), getFormattedGameTime() (MM:SS), getAccuracy() (percentage)
- getStats() returns formatted statistics object
- reset() method to reset all statistics

**New File: src/statusScreen.ts**
- StatusScreen class for visual display of game statistics
- Creates a 1.5x1.0 meter plane mesh with AdvancedDynamicTexture (1024x768)
- Dark blue background (#1a1a2e) with green title (#00ff88)
- Displays 6 statistics:
  - Game Time (MM:SS format)
  - Asteroids Destroyed (count)
  - Hull Damage Taken (percentage)
  - Shots Fired (count)
  - Accuracy (percentage)
  - Fuel Consumed (percentage)
- toggle() method to show/hide screen
- Positions 2 meters in front of camera when shown
- Automatically faces camera with proper orientation
- updateStatistics() refreshes displayed values from GameStats

**Modified: src/controllerInput.ts**
- Added _onStatusScreenToggleObservable for X button events
- Added onStatusScreenToggleObservable getter
- Added X button handler in handleControllerEvent()
- Checks for "x-button" on left controller only
- Fires observable on button press (not release)

**Modified: src/ship.ts**
- Added StatusScreen and GameStats imports
- Added _statusScreen and _gameStats properties
- Initialize GameStats in constructor
- Initialize StatusScreen with camera reference after camera creation
- Wired up controller observable to toggle status screen
- Added statusScreen cleanup in dispose() method

Features:
- Toggle display with X button on left controller
- Floats 2 meters in front of user's face
- Always faces the camera
- Clean, readable statistics layout
- Currently displays placeholder data (statistics tracking integration pending)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 15:46:58 -06:00
827dd2d359 Add resupply system for base landing zone
Some checks failed
Build / build (push) Failing after 19s
Implemented automatic resource replenishment when the ship is inside the base landing zone.

**Modified: src/starBase.ts**
- Added StarBaseResult interface with baseMesh and landingAggregate properties
- Changed buildStarBase() return type from AbstractMesh to StarBaseResult
- Now returns both the base mesh and landing aggregate for resupply system access
- Landing aggregate already configured as trigger for collision detection

**Modified: src/levelDeserializer.ts**
- Added PhysicsAggregate import
- Updated deserialize() return type to include landingAggregate field
- Changed createStartBase() to return full StarBaseResult
- Updated return statement to destructure baseResult into baseMesh and landingAggregate

**Modified: src/level1.ts**
- Added PhysicsAggregate import and _landingAggregate property
- Stored landingAggregate from deserializer result
- Called ship.setLandingZone() to configure resupply system

**Modified: src/ship.ts**
- Added resupply system properties: _landingAggregate, _resupplyTimer, _isInLandingZone
- Added setLandingZone() method to configure landing zone for resupply
- Added updateResupply() method called every physics update (6 times per second)
- Distance-based detection: checks if ship is within 20 units of landing zone center
- Resupply rate: 0.1 per second for all resources (fuel, hull, ammo)
- Automatically replenishes until resources reach 1.0 maximum
- Debug logging for enter/exit landing zone events

Resupply System Mechanics:
- Activates when ship is within landing zone (distance < 20 units)
- Replenishes at 0.1 per second (~0.01666 per update at 6 updates/second)
- Repairs all three resources simultaneously: fuel, hull, ammo
- Stops automatically when each resource reaches maximum (1.0)
- Integrated with existing ShipStatus observable system for automatic gauge updates

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 15:39:40 -06:00
8605946fab Add collision detection for hull damage
Some checks failed
Build / build (push) Failing after 24s
Implemented collision detection on the ship to automatically reduce hull integrity when colliding with objects.

**Modified: src/ship.ts**
- Added collision observable handler after physics aggregate creation
- Subscribed to getCollisionObservable() on ship physics body
- Collision handler calls shipStatus.damageHull(0.01) on any collision event
- Hull damage automatically triggers gauge update via observable pattern

This completes the full resource management system:
- **Fuel**: Consumed by linear thrust (0.005/frame) and angular thrust (0.005/frame)
- **Ammo**: Consumed by weapon firing (0.01 per shot)
- **Hull**: Damaged by collisions (0.01 per collision)
- **Gauges**: All three update automatically with color-coded feedback
- **Prevention**: Thrust disabled when fuel depleted, weapons disabled when ammo depleted

The hull gauge will now show damage in real-time as the ship collides with asteroids or other objects in the game world.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 15:28:40 -06:00
eea82da395 Add ammo consumption to weapon firing system
All checks were successful
Build / build (push) Successful in 1m28s
Integrated ammo tracking into the weapon system to consume ammo with each shot fired.

**Modified: src/weaponSystem.ts**
- Added ShipStatus import and private _shipStatus property
- Added setShipStatus() method to connect ship status manager
- Added ammo check in fire() method - prevents firing when ammo <= 0
- Added ammo consumption: consumeAmmo(0.01) after each shot
- Shots are blocked when out of ammo

**Modified: src/ship.ts**
- Connected WeaponSystem to Scoreboard's ShipStatus via setShipStatus()
- Called immediately after weapon initialization (line 111)

This completes the resource management system:
- Linear thrust consumes fuel (0.005 per frame max)
- Angular thrust consumes fuel (0.005 per frame max)
- Weapon firing consumes ammo (0.01 per shot)
- All gauges update automatically via observable events
- Actions are blocked when resources are depleted

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 15:20:00 -06:00
65e7c496b7 Add ShipStatus system with automatic gauge updates and fuel consumption
All checks were successful
Build / build (push) Successful in 1m26s
Implemented a comprehensive ship status management system with event-driven gauge updates and integrated fuel consumption for both linear and angular thrust.

**New File: src/shipStatus.ts**
- ShipStatus class with Observable pattern for status change events
- Manages fuel, hull, and ammo values with automatic clamping (0-1 range)
- Configurable max values for each resource type
- Public getters: fuel, hull, ammo, getValues()
- Setter methods: setFuel(), setHull(), setAmmo() with automatic event firing
- Convenience methods: addFuel(), consumeFuel(), damageHull(), repairHull(), addAmmo(), consumeAmmo()
- Status check methods: isFuelEmpty(), isDestroyed(), isAmmoEmpty()
- Utility methods: reset(), setMaxValues(), dispose()
- ShipStatusChangeEvent interface with statusType, oldValue, newValue, delta fields

**Modified: src/scoreboard.ts**
- Integrated ShipStatus instance as private _shipStatus
- Constructor subscribes to ShipStatus.onStatusChanged observable
- Added public shipStatus getter to expose status manager
- Created createGaugesDisplay() method with 3 bar gauges (FUEL, HULL, AMMO)
- Created createGaugeBar() helper for individual gauge construction
- Added getBarColor() with smooth RGB gradient: green (1.0) -> yellow (0.5) -> red (0.0)
- Renamed public methods to private: updateFuelBar(), updateHullBar(), updateAmmoBar()
- Observable subscription automatically updates gauge visuals when status changes
- Added dispose() method for cleanup of ShipStatus and observables
- Updated initialize() to retrieve and setup screen/gauges meshes from GLB
- Set initial test values to full (1.0) for all gauges

**Modified: src/shipPhysics.ts**
- Added ShipStatus import and private _shipStatus property
- Added setShipStatus() method to connect status manager
- Modified applyForces() to check fuel availability before applying linear force
- Linear thrust fuel consumption: linearMagnitude (0-1) * 0.005 per frame
- Added fuel check and consumption for angular thrust (rotation)
- Angular thrust fuel consumption: normalized angularMagnitude (0-1) * 0.005 per frame
- Forces only applied when fuel > 0

**Modified: src/ship.ts**
- Connected ShipPhysics to Scoreboard's ShipStatus via setShipStatus()
- Called immediately after physics initialization (line 148)

This creates a fully integrated system where:
1. Ship movement (linear and angular) consumes fuel proportional to thrust
2. Fuel depletion prevents further thrust application
3. Gauge displays automatically update via observable events with color coding
4. Other systems can monitor/modify ship status through the same interface

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 15:17:49 -06:00
72573054dd Refactor Ship class into modular components
All checks were successful
Build / build (push) Successful in 1m21s
Major Refactoring:
- Extracted input handling, physics, audio, and weapons into separate modules
- Reduced Ship class from 542 lines to 305 lines (44% reduction)
- Ship now acts as coordinator between modular systems

New Modules Created:
- src/shipPhysics.ts - Pure force calculation and application logic
  - No external dependencies, fully testable in isolation
  - Handles linear/angular forces with velocity caps
  - Returns force magnitudes for audio feedback

- src/keyboardInput.ts - Keyboard and mouse input handling
  - Combines both input methods in unified interface
  - Exposes observables for shoot and camera change events
  - Clean getInputState() API

- src/controllerInput.ts - VR controller input handling
  - Maps WebXR controllers to input state
  - Handles thumbstick and button events
  - Observables for shooting and camera adjustments

- src/shipAudio.ts - Audio management system
  - Manages thrust sounds (primary and secondary)
  - Weapon fire sounds
  - Dynamic volume based on force magnitudes

- src/weaponSystem.ts - Projectile creation and lifecycle
  - Creates and manages ammo instances
  - Physics setup for projectiles
  - Auto-disposal timer

Ship Class Changes:
- Removed all input handling code (keyboard, mouse, VR)
- Removed force calculation logic
- Removed audio management code
- Removed weapon creation code
- Now wires up modular systems via observables
- Maintains same external API (backward compatible)

Material Improvements:
- Updated planet materials to use emissive texture
- Enhanced sun material with better color settings
- Set planets to unlit mode for better performance

Benefits:
- Each system independently testable
- Clear separation of concerns
- Easier to maintain and extend
- Better code organization

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 12:48:17 -06:00
20dfc238f8 Fix level double initialization and refactor ship physics
All checks were successful
Build / build (push) Successful in 1m20s
Major Changes:
- Fix Level1 double initialization by deferring initialize() call
  - Removed initialize() from Level1 constructor
  - Main.ts now explicitly calls initialize() after registering ready observable
  - Added error logging for double initialization detection

- Refactor Ship to use loadAsset utility and new GLB structure
  - Changed from SceneLoader.ImportMeshAsync to loadAsset pattern
  - Ship constructor no longer calls initialize() - must be called explicitly
  - Updated physics to use transformNode from GLB container
  - Adjusted control mappings for yaw/pitch/roll (inverted signs)
  - Reduced force multipliers for better control feel

- Remove MaterialFactory pattern
  - Deleted src/materialFactory.ts
  - LevelDeserializer now creates PBRMaterial directly for planets/sun
  - Removed texture quality settings from gameConfig
  - Cleaned up settings UI to remove texture quality controls

- Fix UI element hiding when entering VR
  - Editor and Settings links now properly hidden on level start

- Update GLB models for new asset structure
  - Updated ship.glb and base.glb models
  - Modified loadAsset to work with container transformNodes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:16:50 -06:00
146ffccd3d Add Blender export tooling and refactor asset structure
All checks were successful
Build / build (push) Successful in 1m18s
## Blender Export Utilities
- Add blenderExporter utility with ESM support (tsx)
- Create CLI script for exporting .blend files to GLB
- Add npm scripts: export-blend, export-blend:watch, export-blend:batch
- Support watch mode, batch export, and Draco compression
- Complete documentation in docs/BLENDER_EXPORT.md
- Add loadAsset utility helper

## Asset Structure Reorganization
- Move models to themeable structure: public/assets/themes/default/models/
- Add themes/ directory with source .blend files
- Remove old model files from public/ root
- Consolidate to asteroid.glb, base.glb, ship.glb

## Level Configuration Improvements
- Make startBase optional in LevelConfig interface
- Update LevelGenerator to not generate startBase data by default
- Update LevelDeserializer to handle optional startBase
- Update Level1 to handle null startBase
- Fix levelEditor to remove startBase generation references
- Update validation to treat startBase as optional

## Dependencies
- Add tsx for ESM TypeScript execution
- Add @types/node for Node.js types
- Update package-lock.json

This enables modding support with themeable assets and simplifies
level generation by making base stations optional.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 12:25:34 -06:00
f11005fdb6 Refactor scoreboard to use GLB mesh and improve ship mechanics
All checks were successful
Build / build (push) Successful in 1m19s
- Move scoreboard ownership from Level1 to Ship class for better encapsulation
- Refactor scoreboard.initialize() to accept GLB submesh (Screen material mesh)
- Dispose original material when applying AdvancedDynamicTexture to mesh
- Change scoreboard background to green for visibility testing
- Increase ship velocities: MAX_LINEAR_VELOCITY to 200, LINEAR_FORCE_MULTIPLIER to 1200
- Adjust ammo spawn position (y: 0.5, z: 7.1) and velocity (200000)
- Update sight reticle position to match new ammo spawn point (y: 0.5)
- Fix sight circle rotation and rendering group assignment
- Update ship2.glb, ship1.glb, and base.glb models
- Comment out ship position override in level initialization

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 13:41:17 -06:00
37128d8fbd Update gameplay mechanics, asteroid model, and star base physics
All checks were successful
Build / build (push) Successful in 1m18s
- Switch to asteroid4.glb model with updated material handling
- Adjust difficulty parameters: increased spawn distances (220-450m range), updated force multipliers, varied asteroid sizes
- Fix scoreboard timer display (was showing frames instead of actual seconds)
- Refactor star base to use asset container with mesh merging for better performance
- Change star base physics from STATIC to ANIMATED with collision detection enabled
- Add directional lighting in level deserializer for improved scene lighting
- Clean up commented code and optimize debug logging
- Update base.glb 3D model

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 12:26:25 -06:00
b4608e10d8 Add centralized debug logging system with settings UI control
All checks were successful
Build / build (push) Successful in 1m16s
- Create debugLog wrapper function in src/debug.ts
- Add debug checkbox to settings screen UI
- Replace all console.log statements with debugLog calls (153 replacements)
- Add debug flag to GameConfig with localStorage persistence
- Fix GameConfig to properly load and reset debug setting
- Preserve console.error and console.warn calls unchanged
- Add Developer section to settings screen with debug toggle
- Enable/disable all debug logging via settings UI checkbox

Debug logging can now be controlled from Settings > Developer section,
reducing console noise in production while maintaining full debugging
capability during development.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 14:44:09 -05:00
c21bd93c72 Refactor ship controls to force-based physics with world-space transformations
All checks were successful
Build / build (push) Successful in 1m16s
- Replace accumulated velocity approach with direct force application
- Transform local direction vectors to world space before applying forces
- Fix explosion animation to use Babylon's render loop instead of requestAnimationFrame
- Simplify Ship constructor and remove ControllerStickMode enum
- Comment out all renderingGroupId assignments for performance testing
- Add comprehensive CONTROLLER_THRUST.md documentation
- Fix audio engine initialization in Level1
- Update to ship2.glb model
- Adjust physics damping values for better control feel
- Add applyForces() calls to keyboard and mouse handlers

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 11:20:31 -05:00
72bd25b686 Add minimal test level with performance metrics and extensive debug logging
Some checks failed
Build / build (push) Failing after 23s
Added TestLevel class for debugging with progressive box creation and performance tracking. Includes comprehensive debug logging throughout the explosion system to diagnose Meta Quest issues.

Key changes:
- New TestLevel with 1-1000 box spawning (doubling each 5s iteration)
- Performance metrics logging (FPS, triangle count, mesh count)
- Direct triangle computation from mesh geometry
- Extensive explosion system debug logging
- Fixed observable timing issue (initialize after listener registration)
- Material freezing optimization

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 16:33:45 -05:00
cb96b4ea6c Refactor sight to crosshair reticle and rename starfield to rockFactory
Some checks failed
Build / build (push) Failing after 19s
Created new Sight class:
- Crosshair design with circle, lines, and center dot
- Configurable radius, line length, thickness, and colors
- Green reticle color (traditional gun sight)
- Center gap and proper rendering group
- Dispose method for cleanup

Refactored Ship class:
- Replaced disc sight with new Sight class
- Changed ammo mesh to IcoSphere for better performance
- Added dispose method to clean up sight resources
- Integrated sight with configuration options

Renamed starfield.ts to rockFactory.ts:
- Better reflects the class purpose (RockFactory)
- Updated all imports across codebase
- Updated CLAUDE.md documentation

Updated asteroid model:
- Changed from asteroid2.glb to asteroid3.glb
- Added new asteroid3.blend and asteroid3.glb assets

Fixed background stars material:
- Added proper material type casting for StandardMaterial
- Fixed emissiveColor setting

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 10:21:27 -05:00
9df64b7dd9 Add background starfield and fix scene background color
Some checks failed
Build / build (push) Failing after 19s
Created BackgroundStars class using PointCloudSystem:
- 5000 stars distributed uniformly on sphere surface
- Multiple star colors (white, warm, cool, yellowish, bluish)
- Varied brightness (0.3-1.0) for depth perception
- Follows camera position to maintain infinite distance effect
- Efficient rendering with disabled lighting and depth write

Integrated starfield into Level1:
- Created during level initialization
- Camera follow in render loop
- Proper disposal on level cleanup

Fixed XR background color:
- Set scene clearColor to pure black (was default grey)
- Adjusted ambientColor to black for space environment

Removed GlowLayer from ship and engines:
- Cleaned up unused glow effects
- Prevents unwanted glow on background stars

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 09:37:30 -05:00
181a427875 Add GameConfig system with texture quality levels and physics toggle
Some checks failed
Build / build (push) Failing after 18s
Created GameConfig singleton class with localStorage persistence for game settings:
- Texture quality levels: WIREFRAME, SIMPLE_MATERIAL, FULL_TEXTURE, PBR_TEXTURE
- Physics enable/disable toggle for performance optimization

Created MaterialFactory for quality-level-based material generation:
- Planet materials with dynamic sun-oriented lightmaps
- Asteroid materials preserving GLB bump textures
- Sun materials with procedural fire textures

Integrated GameConfig throughout game entities:
- Conditional physics creation in asteroids, ship, start base
- Material creation respects texture quality settings
- Physics constraints only applied when physics enabled

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 08:53:11 -05:00
03f170e150 Create mesh-based physics for ship and optimize planet geometry
Some checks failed
Build / build (push) Failing after 18s
- Update Ship class to use CONVEX_HULL physics from ship1.glb
  - Find geometry mesh from loaded GLB and create physics from it
  - Move physics creation to initialize() after mesh loads
  - Add fallback to BOX shape if mesh not found

- Fix ship position setter for async initialization
  - Add null check for physics body
  - Set transform position directly if body doesn't exist yet
  - Prevents crash when position set before mesh loads

- Optimize planet vertex count for performance
  - Reduce sphere segments from 32 to 12
  - ~144 vertices vs ~1024 vertices per planet
  - Planets are background objects, lower poly acceptable

- Update ship1.glb model

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 08:22:21 -05:00
a9054c2389 Add procedural lightmap system for planets and asteroids
Some checks failed
Build / build (push) Failing after 19s
- Create sphereLightmap.ts for procedural lighting generation
- Update planets to use lightmaps oriented toward sun
- Switch asteroids to PBR material with noise texture
- Use sphere physics shape for asteroids

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 17:30:02 -05:00
bb3aabcf3e Refine gameplay balance and rendering performance
All checks were successful
Build / build (push) Successful in 1m16s
Adjust difficulty parameters to improve game progression, optimize rendering with proper layer assignments, increase projectile velocity for better responsiveness, and clean up visual effects rendering.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 16:58:13 -05:00
5f3fcf6bc0 Adjust lighting, physics, and visual settings for improved gameplay
All checks were successful
Build / build (push) Successful in 1m19s
Increase asteroid sizes, add ship-specific lighting, enhance sun brightness, adjust physics timesteps, and improve planet/asteroid material appearance. Increase planet count to 12 and move them farther from sun for better spatial layout.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 13:19:01 -05:00
052d972e69 Optimize WebXR performance and add procedural planet generation
Some checks failed
Build / build (push) Failing after 4m43s
Enable multiview rendering in WebXR for improved framerate, remove expensive PhotoDome per-frame updates, and add planet generation system with 76 unique textures across 12 planet types.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 11:50:18 -05:00
57ffe8f689 Migrate to AudioEngineV2 and fix Meta Quest 2 controller detection
- Upgrade audio system from deprecated Sound API to AudioEngineV2
  - Use CreateAudioEngineAsync() for audio engine initialization
  - Replace new Sound() with createSoundAsync() throughout codebase
  - Track sound playing state manually (StaticSound lacks isPlaying)
  - Use volume property instead of setVolume() method
  - Use stop() instead of pause() for proper StaticSound lifecycle

- Fix controller detection for Meta Quest 2
  - Check for already-connected controllers after entering XR mode
  - Fixes issue where Quest 2 controllers only become available after enterXRAsync()
  - Maintains backward compatibility with WebXR emulator

- Improve initialization performance
  - Move RockFactory.init() to main initialization (before level select)
  - Pre-load asteroid meshes and explosion particle systems on startup
  - Level initialization now only creates asteroids, not resources

- Refactor level initialization flow
  - Level creation now happens before entering XR mode
  - Add level ready observable to track initialization completion
  - Show loading messages during asteroid creation
  - Extract loading message logic to separate module

- Add audio unlock on user interaction (button click)
- Make play() methods async to support AudioEngineV2
- Pass AudioEngineV2 instance to Ship and Level1 constructors

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 13:59:48 -05:00
db7fdb9958 changed game dynamics. 2025-10-13 19:41:04 -05:00
c9d03e832d changed game dynamics. 2025-02-20 19:11:46 -06:00
5b7d04bd39 changed game dynamics. 2025-02-17 16:51:06 -06:00
b85d1f5b09 Started cleaning up audio, rendering artifacts. 2025-02-16 16:44:18 -06:00
de108e8a40 Initial Commit 2025-02-15 11:23:41 -06:00
a105e28333 Initial Commit 2025-02-15 11:19:24 -06:00