I will list the files in the project to understand its current structure.
I will read the contents of src/App.tsx to understand the starting codebase.
I will read the package.json file to check the dependencies available in this project.
I will install three (the 3D library), @types/three (types for TypeScript), and lucide-react (for icons) to construct our 3D FPS game using standard WebGL in React.
I will create src/utils/audio.ts which uses the Web Audio API to procedurally generate high-quality sound effects for gunshots, reload, headshots, bomb ticks, explosions, footfalls, and rounds. This ensures instant loading and high performance.
I will read the last section of src/utils/audio.ts to see and resolve the TypeScript warnings.
I will edit src/utils/audio.ts to capture this.ctx in local variables in playRoundWin, playRoundLose, and any other similar places. This resolves the TypeScript compiler errors regarding nullability inside callbacks.
I will create src/types/game.ts to define the TypeScript interfaces for our game state, including Weapons, Enemies, Particles, Bullet Impacts, Game Wave settings, and Scores. This ensures type safety and clean modularity.
I will create src/utils/weapons.ts which defines the stats for all weapons (Knife, USP-S, Desert Eagle, AK-47, M4A4, and AWP). This includes their names, types, damage parameters, fire rates, ammunition counts, weights, recoils, prices, and detailed descriptions, matching CS standards.
I will create the src/components/HUD.tsx file. This component handles the head-up display including health, armor, money, ammo counts, weapon selection, dynamic crosshair (that reacts to recoil), round timer, wave indicators, and a fully functional 2D minimap/radar displaying live player, enemy, and bomb positions. It also includes comprehensive virtual touch overlays for mobile.
I will edit src/components/HUD.tsx to resolve the linting errors by using the settings prop to dynamically style the crosshair (color, thickness, and sizing) and removing the unused onBuyWeapon prop, making the code warning-free and more robust.
I will read lines 220 to 260 of src/components/HUD.tsx to find where the crosshair is rendered and style it using the settings object.
I will read lines 280 to 330 of src/components/HUD.tsx to inspect the crosshair styling and incorporate the settings variable.
I will read lines 330 to 360 of src/components/HUD.tsx to find the remaining crosshair layout code.
I will edit src/components/HUD.tsx to read the settings prop. It will dynamically apply the settings.crosshairColor and adjust crosshair dimensions based on settings.crosshairSize, which resolves the unused variable compiler error while adding a polished customization layer.
I will create the src/components/MainMenu.tsx start screen component. This provides a CS-style dashboard containing:
- Title banner with tactical scanning grids.
- Difficulty selector (Casual, Competitive, Global Elite).
- Weapon loadout details.
- High score tables loaded from LocalStorage.
- Fully interactive Settings page (controlling Mouse Sensitivity, Volume, Crosshair Customization).
- Visual keyboard/touch instructions.
I will edit src/components/MainMenu.tsx to remove the unused import Target to resolve the TypeScript compilation warning.
I will create src/components/PauseMenu.tsx to display a clean, semi-transparent overlays when players press ESC or tap Pause. It includes:
- Instant "Resume" and "Abandon Match" buttons.
- Real-time adjustment of mouse sensitivity, master volume, and crosshair styles.
- Live player weapon and ammo summary.
I will create the game over component src/components/GameOver.tsx. This screen loads upon player elimination, round loss, or explosive detonation. It includes:
- Animated title card (Mission Failed vs. Tactical Victory).
- CS Skill Rank Assignment based on total performance metrics.
- High-score saver to log entries directly into LocalStorage.
- Detailed accuracy, headshot, and wave summaries.
- One-click instant restart.
I will create the core game engine component src/components/GameCanvas.tsx. This file contains the complete high-performance WebGL environment using Three.js, including:
- Dynamic desert concrete wall and classic stenciled wooden crate procedural textures.
- Full collision detection and fluid "sliding" physics.
- High-fidelity weapon muzzle flash, shell ejection, and bullet impact particle mechanics.
- Modular waypoint-based pathfinding bot AI for Long A and Catwalk rushes, with active weapon aiming and target shooting.
- Tactical C4 bomb planting and interactive wire-defusing loop with dynamic timing.
- Pointer lock API support for mice alongside touch-screen drag-look rotation.
I will read lines 1140 to 1180 of src/components/GameCanvas.tsx to find the occurrences of isMobile and correct its references.
I will read lines 10 to 45 of src/components/GameCanvas.tsx to inspect the props structure and ensure isMobile is properly defined.
I will read lines 45 to 65 of src/components/GameCanvas.tsx to view the rest of the destructured parameters.
I will read lines 675 to 705 of src/components/GameCanvas.tsx to inspect the damage-to-enemy calculation and resolve the warning.
I will read lines 525 to 585 of src/components/GameCanvas.tsx to find where the enemies are initialized, and see how we can set up their armor to match our design.
I will read lines 835 to 905 of src/components/GameCanvas.tsx to inspect where the enemies are spawned.
I will read lines 930 to 1010 of src/components/GameCanvas.tsx to find triggerWaveSpawning.
I will read lines 1010 to 1050 of src/components/GameCanvas.tsx to view the enemy initialization details.
I will read lines 25 to 55 of src/types/game.ts to find the exact place to add the armor field to the Enemy interface.
I will edit src/types/game.ts to add the armor property to the Enemy interface. This allows us to track enemy protective gear and handle armor-piercing calculations.
I will read lines 580 to 625 of src/components/GameCanvas.tsx to see where we can integrate the brass casing ejection function spawnBrassShell(scene) when shooting.
I will read lines 760 to 795 of src/components/GameCanvas.tsx to inspect the code that spawns bullet holes and replace the reference to DecalGeometry (which is not in core THREE) with direct CircleGeometry.
I will read lines 1450 to 1495 of src/components/GameCanvas.tsx to find the declaration of collided and see how to safely remove it.
I will edit the imports, props, and destructuring of src/components/GameCanvas.tsx to add isMobile support, remove the unused useState import, and remove unused state variables from destructuring to avoid compiler warnings.
I will read lines 70 to 80 of src/components/GameCanvas.tsx to find weaponSway and remove its declaration.
I will edit src/components/GameCanvas.tsx to remove the unused weaponSway ref.
I will read lines 760 to 780 of src/components/GameCanvas.tsx to inspect the bullet hole mesh generator and resolve the DecalGeometry issue.
I will edit src/components/GameCanvas.tsx to replace DecalGeometry with CircleGeometry for rendering flat bullet hole meshes directly on surface hits, preventing any compilation issues.
I will read lines 600 to 615 of src/components/GameCanvas.tsx to locate the active shooting block where we will invoke the bullet shell casing visual effect.
I will edit src/components/GameCanvas.tsx to invoke the spawnBrassShell(scene) function immediately after the audio gunshot is triggered, adding visual polish as casings eject and fly into the scene.
I will read lines 1000 to 1040 of src/components/GameCanvas.tsx to find where the bot initialization takes place and add the missing armor field.
I will edit src/components/GameCanvas.tsx to add the missing armor field to the enemy bot initializer. Bots in higher waves will spawn with armor protection.
I will read lines 1470 to 1490 of src/components/GameCanvas.tsx to verify where collided is declared.
I will edit src/components/GameCanvas.tsx to remove the unused collided boolean variable inside the physics collision-sliding loop, resolving the final TypeScript warning in the canvas component.
I will now update src/App.tsx with a fully featured tactical state controller. This integrates our main menu, high-octane 3D canvas, real-time HUD, paused settings, game-over summaries, and adds:
- A fully simulated tactical CS economy/buy menu (accessible by pressing [B] or tapping Buy). Starting with 800,playersearnbountypayo700), AK-47 (3100), AWP (1000).
I will read lines 135 to 160 of src/App.tsx to inspect diff and remove it to clean up the code.
I will read lines 220 to 240 of src/App.tsx to locate the unused hasWeapon variable.
I will read lines 270 to 290 of src/App.tsx to find the unused completed parameter inside handleGameOver.
I will edit src/App.tsx to resolve the unused variable warnings for diff, hasWeapon, and completed. This will make the app compile cleanly.
I will edit src/App.tsx to remove the unused hasWeapon variable on line 227 and rename the unused completed parameter to _completed on line 280, resolving the remaining compiler warnings.
I will edit src/App.tsx to rename the unused parameter completed to _completed in handleGameOver to clear the final linting warning.
Files built: src/utils/audio.ts, src/types/game.ts, src/utils/weapons.ts, src/components/HUD.tsx, src/components/MainMenu.tsx, src/components/PauseMenu.tsx, src/components/GameOver.tsx, src/components/GameCanvas.tsx, src/App.tsx