A first-person wave-based shooter built with Three.js and Vite.
- https://github.com/jonathanbossenger/cosmic-defender-3d-0.1/
- https://github.com/jonathanbossenger/cosmic-defender-3d-0.2/
- https://jonathanbossenger.com/a-year-of-progress-ai-agentic-coding-and-the-cosmic-defender-experiment/
- First-person shooter controls
- Wave-based enemy spawning with increasing difficulty
- Two enemy types: drones and soldiers
- Weapon system with shooting mechanics and reload
- Combo multiplier system for consecutive kills
- Procedural audio via Web Audio API (no audio files)
- DOM-based HUD and menus
- High score persistence via localStorage
cosmic-defender-3d/
├── index.html # Main HTML file with inline UI/HUD
├── package.json # Project dependencies
├── vite.config.js # Vite configuration
└── src/ # Source code
├── main.js # Entry point
├── Game.js # Central game orchestrator and loop
├── core/ # Input handling and audio
├── entities/ # Player, enemies, projectiles, weapon
├── systems/ # Combat, particles, wave management
├── ui/ # HUD and screen management
└── world/ # Arena geometry
- Node.js (v14 or higher)
- npm
-
Clone the repository:
git clone https://github.com/jonathanbossenger/cosmic-defender-3d.git cd cosmic-defender-3d -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173
- W, A, S, D - Move
- Mouse - Look around
- Left Click - Shoot
- R - Reload
- Escape - Pause
To build the game for production:
npm run buildThe built files will be in the dist directory.
This project is licensed under the ISC License.
- Three.js examples for inspiration