I will start by listing the files in the project to understand the structure.
I will read the package.json file to check the pre-installed packages and see if we need to install any extra libraries (like Lucide icons, Three.js, etc.).
I will install three, @types/three, and lucide-react so that we can build a fully featured 3D game using standard Three.js inside a React reference. This approach ensures 100% compatibility with React 19, gives us ultimate control over the rendering and game loops, and avoids any React Three Fiber compatibility issues with newer React versions.
I will create src/utils/soundManager.ts which will use the browser's Web Audio API to procedurally generate sound effects (SFX) and a catchy retro synthwave background track in real-time. This ensures that the game has rich audio without needing any external audio assets, preventing loading failures or 404 errors. It will include SFX for jumps, slides, coins, power-ups, hits, and a full procedural background music track that players can toggle.
I will read index.html to see how we can update the title and metadata for our high-octane 3D infinite runner game.
I will create a types file src/utils/gameTypes.ts that defines the structure for our user's progress (equipped board, unlocked items, and upgrade levels), power-up structures, and game constants. This keeps the state cleanly organized and typed.
I will now create the centerpiece of our game, src/components/GameCanvas.tsx. This component handles the full Three.js setup, including standard WebGL rendering, lighting, neon atmosphere, a floating starfield skybox, active side arches and scrolling street lights, custom player and board geometry with jet propulsion flame particles, lane-shifting, gravity-based jump physics, duck/slide scale animations, ramps, obstacles (laser grids, low walls, moving drone hazards), coins, powerups (Magnet, Shield, Boost, 2X multiplier), collision detection, a particle engine for hits and collection events, and complete keyboard/touch swipe controls.
I will now edit src/components/GameCanvas.tsx to resolve the TypeScript lint errors, such as unused variables and the implicit any type in the clean-up loop. This guarantees a clean, compile-ready codebase.
I will now remove the unused variables activeRamp and powerUpDurationMax which are causing TS compiler warnings.
I will search the canvas file for powerUpDurationMax to see where it was being written so we can remove the write-only assignments.
I will remove the write-only assignment to powerUpDurationMax in activatePowerUp.
I will search for activeRamp to remove its write-only assignments.
I will edit src/components/GameCanvas.tsx to remove the write-only assignment activeRamp = obs; from the ramp collision code.
I will search for the progress check lines in the ramp detection block to get the exact lines to replace.
I will now edit the ramp block in src/components/GameCanvas.tsx to remove the write-only assignment to activeRamp.
I will search for kneeMat to see where it was declared and remove it from the robot creation block.
I will edit src/components/GameCanvas.tsx to remove the unused kneeMat variable.
I will search for isPulled to find where it's declared and remove it from the coin-movement section.
I will edit src/components/GameCanvas.tsx to remove the unused isPulled variable assignments.
I will search for the word forEach or mat in the clean-up section of the file to fix the implicit any type.
I will edit src/components/GameCanvas.tsx to add type declaration : any to mat in the loop disposing materials, which will resolve the final TypeScript lint error in this file.
I will now create src/components/GameUI.tsx which contains the overlays for the entire game. This component provides:
- Interactive Cyber Start Menu & Garage: Allows players to view their currently equipped 3D hoverboard, browse unlocked boards, browse the shop to buy premium boards, and upgrade their power-up tiers using collected credits.
- Settings overlay: Allows toggling music, sound effects, and recalibrating inputs.
- Immersive In-Game HUD: Displays real-time score, distance, and coin counters with neon styling, a speedometer, and circular animated SVG countdown meters for active power-ups (Shield, Magnet, Boost, Multiplier).
- Interactive Rival Notification System: Shows flashing banners ("PASSED RIVAL: SynthPulse!") in real-time when the player beats rival scores during a run.
- Detailed Game Over Screen: Shows final stats, high score announcements with golden particles, a breakdown of credits earned, and a "Reboot / Revive" system where players can spend 50 credits once per run to keep going.
I will edit src/components/GameUI.tsx to remove the unused imports RotateCcw and ShoppingBag to clear the TypeScript lint errors.
I will search for the definition of stateRef in src/components/GameCanvas.tsx to understand where we can add the reviveTrigger tracking.
I will read lines 5-25 of src/components/GameCanvas.tsx to see the props interface, so that we can add reviveTrigger: number to it.
I will update the props of GameCanvas and its state references to include a reviveTrigger prop. This allows the parent React component to signal a "reboot/revive" event that the inner 3D loop can catch to safely clear local obstacles, spawn a protective shield, and reset the player's pose without reset-rebuilding the entire WebGL scene.
I will search for the declaration of lastTime in src/components/GameCanvas.tsx to find where the local loops variables are, so we can insert lastProcessedReviveTrigger next to them.
I will read the game loop setup area to precisely insert our revive triggering code.
I will read lines 1130-1145 in src/components/GameCanvas.tsx to find the exact place to insert the revive handling logic.
I will now edit src/components/GameCanvas.tsx to handle the player revive mechanism. This adds a check in the game loop to see if a revival has been triggered. When triggered, it clears out any close obstacles ahead, centers the player, resets all physics, and equips a temporary 4-second Nano-Shield to let the player recover safely.
I will read src/App.tsx to inspect its current contents so that I can cleanly replace it with our game's main entry wrapper.
I will now create the main container src/App.tsx which integrates the GameCanvas and the GameUI. It manages:
- Persistent LocalStorage State: Saves the player's total coin balance, unlocked boards, and upgrade tiers, allowing progression to span across multiple sessions.
- Centralized Game State: Orchestrates transitions between
'MENU', 'RUNNING', 'PAUSED', and 'GAMEOVER' states.
- Canvas Key Resetting: Uses a unique
gameKey that increments on a fresh restart, cleanly tearing down and re-initializing the Three.js canvas to prevent memory leaks, leftover physics, or coordinate floating point drift.
- Profile Synchronization: Synchronizes high scores, credits collected, and upgraded times at the end of every run.
I will edit src/App.tsx to remove the unused variables isNewHighScore and isNewMaxDistance, which are causing compilation warnings.
I will read src/index.css to see the current Tailwind configurations and determine how we can append our custom retro-cyber animations, scanline backgrounds, and scrollbars.
I will update src/index.css to add the custom retro cyber utilities, including:
- Interactive scanlines pattern overlay: Provides a subtle cathode ray tube (CRT) scanline effect across the canvas viewport.
- Glowing thin scrollbars: Tailored for skin list menus and rival lists inside the cyber garage.
- Slow spin animations: Used for the loading and background gear/powerup components.
I will update index.html to set the title to "Neon Overdrive 3D - Cyber Endless Runner" and import Google Fonts (specifically Orbitron and Rajdhani). These fonts give the game interface a premium, futuristic sci-fi aesthetic.
I will now build the project using the build_project tool to ensure that there are no remaining compilation errors, syntax issues, or bundle defects, and that our application builds perfectly.
I have created Neon Overdrive 3D, a fully-featured, endless 3D hoverboard runner game built with React, Vite, Three.js, and Tailwind CSS.
The application compiles perfectly and features local persistence, procedural synthesizers, and touch/keyboard controls.
Here is a summary of the complete implementation:
🎮 Gameplay Mechanics
- Fluid 3D Controls:
- Keyboard: Move Left (
A / ←), Move Right (D / →), Jump (Space / W / ↑), and Slide/Duck (Shift / S / ↓).
- Touch & Swipe Gestures: Smooth swipe recognition (Swipe Left/Right to change lanes, Swipe Up to Jump over low walls, Swipe Down to Slide under overarching laser beams).
- Dynamic 3D Hazards & Obstacles:
- Low Barricades: Glowing neon-red warning gates. Must jump over them.
- High Security Lasers: Glowing overarching scanning grids. Must slide/duck underneath.
- Defensive Drones: Floating laser-sentries that sweep left and right across lanes.
- Anti-Gravity Ramps: Triangular glowing green wedges that launch players into the air to safely soar over obstacles and collect airborne coin lines.
- Power-Ups:
- Nano-Shield: Surrounds the hoverboard with a shimmering cyan spherical wireframe field. Absorbs one impact.
- Hyper Magnet: Generates an orbital electromagnetic field, pulling far-off credits towards your board.
- Warp Boost: Triggers hyper-velocity speed, zooming out the camera field of view (FOV), blurring starlight, and rendering you invincible.
- Data Multiplier: Multiplies your points collected in real-time.
⚙️ Core Technical Features
-
High-Performance 3D Engine (src/components/GameCanvas.tsx):
- Built on raw Three.js inside a React ref to guarantee 100% compatibility with React 19 and provide ultimate control over memory disposal.
- Features Neon Exp2 Fog that fades the track beautifully into the dark cyber-horizon.
- Endless Modular Track: Tiles and rolls asphalt floor grids under the player in a continuous conveyor system, avoiding floating-point coordinates.
- Starfield Skybox: Renders 600 dynamic moving stars flying past the camera, accentuating extreme thrust.
- Stylized Player Model: Surfs dynamically on a hoverboard, tilting/rolling during lane shifts, stretching on jump, squashing flat on sliding, and squishing upon landing.
- Jet Propulsion Particles: Emits real-time exhaust flames matching the board's signature colors.
-
Procedural Sound Synthesizer (src/utils/soundManager.ts):
- Utilizes the browser's native Web Audio API to generate all retro-synth sounds and background tracks in real-time.
- Includes custom, rich audio frequencies for:
- Coin collection (two rapid high-pitched sine sweeps)
- Jump (upward triangle sweep)
- Slide (sawtooth lowpass sweep)
- Collision crashes (low sub-bass hit coupled with a bandpass white-noise explosion)
- Shield break (metallic frequency drop)
- Includes an active 120 BPM Retro Synthwave Background Track that dynamically synthesizes kick drums, hi-hats, basslines, and echoing arpeggios. Toggle sound or music individually at any time!
-
Persistent Profile & Garage (src/utils/gameTypes.ts & src/components/GameUI.tsx):
- Local Storage Integration: Saves your total credit balance, high scores, max distance records, unlocked boards, and booster levels.
- Board Shop & Customization:
- Cyber Neon (Free): Sleek hover stabilizers.
- Solar Flare (150 Credits): Firestorm orange thrusters with +15% coin magnet range.
- Acid Spark (350 Credits): Glowing green bio-luminescent waste that recovers shields +25% faster.
- Supernova (800 Credits): Golden celestial engine with permanent score bonuses.
- (1500 Credits): Violet space rift stabilizers adding +2 seconds of Nano-Shield duration.
Files built: src/utils/soundManager.ts, src/utils/gameTypes.ts, src/components/GameCanvas.tsx, src/components/GameUI.tsx, src/App.tsx, src/index.css, index.html