create a fill counter strike clone in browser
- User
create a fill counter strike clone in browser
Assistant
I'll create a full Counter-Strike clone in the browser with Three.js for 3D rendering, FPS controls, enemy bots, weapons, a HUD, buy menu, and round system. Let me start building this step by step.
First, let me install Three.js:
Now let me create all the game files. I'll start with the type definitions and weapon configurations.
Now creating the Enemy class with AI behavior:
Let me fix the lint errors in the Enemy file:
Now I'll create the main GameEngine class - the core of the game with scene, player, shooting, AI, and round management:
Let me fix the lighting setup error:
Now let me update the types to include the additional state fields:
Now creating the React App with all UI overlays - main menu, HUD, buy menu, minimap, crosshair, and more:
Let me fix the unused variable:
Now let me update the CSS and HTML:
Now let me build the project to check for errors:
The build succeeded! Let me fix the CSS warning about the invalid pseudo-class and make the cursor handling cleaner:
The build works! Now let me fix some important gameplay issues - the buy menu key conflicts, and I should make the buy menu keyboard-only (no pointer lock release needed, more CS-like):
Now update the buy menu toggle to keep pointer locked (CS-style keyboard-only buy menu):
Now update the buy menu to be keyboard-only (remove mouse interaction):
Remove the unused
onBuyprop from the BuyMenuOverlay:Fix the component usage to remove the
onBuyprop:Remove the unused
handleBuycallback:Let me build to verify everything compiles:
The build is clean with no errors or warnings! The Counter-Strike: Web clone is complete. Here's a summary of everything I built:
🎮 Counter-Strike: Web - Complete Browser FPS
Game Features:
- 3D FPS Engine using Three.js with full scene, camera, lighting, and shadows
- Dust2-Inspired Map with three lanes (A Long, Mid, B Tunnels), A/B sites with bomb markers, spawn areas, and 16+ cover crates
- 6 Weapons: Knife (free), USP-S (700), AK-47 (3100), AWP ($4750) — each with unique damage, fire rate, recoil, spread, and movement speed
- 5 Enemy Bots with state-machine AI (patrol → chase → attack → dead), health bars, and line-of-sight detection
- Full HUD: Health/armor display, ammo counter, crosshair, hit markers, damage flash, kill feed, weapon slots, and round timer
- Minimap with real-time player/enemy tracking and wall outlines
- Buy Menu (press B) with keyboard shortcuts (1-7) for CS-style purchasing
- Round System: 15s buy phase → 1:55 play phase → round end → next round
- Money System: 100-$1500), round win/loss bonuses
- Procedural Audio: Gunshots, hit markers, headshot dings, knife swipes, reload clicks, damage sounds
- First-Person Weapon Models: Unique 3D models for each weapon type with recoil and reload animations
- Muzzle Flash effects with dynamic point lights
- Player Controls: WASD movement, jump, walk (shift), weapon switching (1-5/scroll), reload (R)
- Collision Detection: AABB-based wall/box collision for both player and enemies
- Raycasting: Accurate hit detection with headshot support (4x damage for rifles/pistols)
File Structure:
src/types.ts— Type definitions, weapon configs, buy menu itemssrc/game/Enemy.ts— Enemy AI class with patrol/chase/attack statessrc/game/GameEngine.ts— Core engine with scene, player, shooting, round management, audiosrc/App.tsx— React UI with all overlays (menu, HUD, buy menu, minimap, etc.)src/index.css— Game styling
Files built:
src/types.ts,src/game/Enemy.ts,src/game/GameEngine.ts,src/App.tsx,src/index.css,index.html
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.