Let me build a complete 3D Left 4 Dead-style web game. First, I'll install the necessary packages.
Now let me build the game. I'll create the type definitions, game state, and components.
Now let me create the 3D scene component with environment, buildings, and obstacles:
Now let me create the remaining components:
Now the HUD component:
Now the main Game component:
Now update the entry files:
Let me build to check for errors:
The build succeeded! Let me fix an important gameplay issue — the player's position needs to stay in sync with the camera so zombies track correctly:
Let me rewrite the Game component to fix the player position tracking issue and improve overall gameplay:
Good, it builds. Let me add a first-person weapon view and muzzle flash for better immersion:
Now let me integrate WeaponView into Game:
Let me add shoot feedback by tracking a shoot counter:
Let me verify the build is clean and review if any issues remain:
Let me ensure the CSS is set up correctly for fullscreen gaming:
Let me fix the reload logic to be more intuitive:
The build is clean! Here's a summary of the complete 3D Left 4 Dead - Zombie Survival web game:
🧟 Game Features
| Feature | Details |
|---|
| 3D Environment | City streets with buildings, cars, trees, street lights, roads |
| FPS Controls | WASD movement + mouse aim (Pointer Lock) |
| 3 Weapons | Pistol (∞ ammo), Shotgun (8 pellets/spread), Assault Rifle (auto-fire) |
| 5 Zombie Types | Normal, Hunter (fast/red eyes), Boomer (explodes on death), Tank (800 HP, giant), Smoker (ranged, smoke trail) |
| Day/Night Cycle | Full sun cycle with dynamic lighting, sky color, and visibility |
| Wave System | Progressive difficulty — new special infected unlock each wave |
| HUD | Health bar, ammo counter, score, wave, kill count, crosshair, time indicator |
🎮 Controls
| Key | Action |
|---|
| Click | Lock mouse & shoot |
| WASD | Move |
| Mouse | Aim |
| 1/2/3 | Switch weapons |
| R | Reload |
| ESC | Release mouse |
📁 Project Structure
src/game/types.ts — All TypeScript types
src/game/constants.ts — Weapon/zombie stats & balance
src/game/state.ts — Game logic (spawning, damage, waves)
src/components/Scene.tsx — 3D city environment
src/components/DayNightCycle.tsx — Dynamic sun & sky
src/components/ZombieRenderer.tsx — Zombie models with unique visuals
src/components/WeaponView.tsx — First-person gun with recoil & muzzle flash
src/components/HUD.tsx — Full UI overlay
src/components/Game.tsx — Main game loop & player controller
Files built: src/game/types.ts, src/game/constants.ts, src/game/state.ts, src/components/Scene.tsx, src/global.d.ts, src/components/DayNightCycle.tsx, src/components/ZombieRenderer.tsx, src/components/HUD.tsx, src/components/Game.tsx, src/App.tsx, index.html, src/components/WeaponView.tsx, src/index.css