# TowerDefensDemo **Repository Path**: marcusplus/tower-defens-demo ## Basic Information - **Project Name**: TowerDefensDemo - **Description**: Test AI power to build game. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-26 - **Last Updated**: 2026-03-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 3D Tower Defense Game A modern sci-fi styled 3D tower defense game built with Three.js and TypeScript. ## Features - **3D Rendering**: Smooth 3D graphics using Three.js - **Modern Sci-Fi Style**: Neon lights, metallic materials, dynamic backgrounds - **Diverse Tower Types**: Single target, AOE, and control towers - **Element System**: Fire, ice, electric, and poison elements with rock-paper-scissors mechanics - **Multiple Enemy Types**: Basic, fast, tank, and flying enemies - **Upgrade System**: Multiple upgrade paths for each tower - **Level System**: Fixed levels and random challenge mode - **Visual Effects**: Explosions, fire, particles, and special effects - **Game Controls**: Pause, resume, restart functionality - **Score System**: Score tracking and leaderboard ## Tech Stack - **Frontend**: Three.js + TypeScript + Vite - **Backend**: Node.js + Express - **Build Tool**: Vite - **Package Manager**: npm ## Getting Started ### Prerequisites - Node.js 18 or higher - npm or yarn - Modern browser with WebGL 2.0 support ### Installation 1. Clone the repository: ```bash git clone cd tower-defense-3d ``` 2. Install frontend dependencies: ```bash npm install ``` 3. Install backend dependencies: ```bash cd server npm install cd .. ``` ### Development 1. Start the frontend development server: ```bash npm run dev ``` 2. Start the backend server (in a separate terminal): ```bash cd server npm run dev ``` 3. Open your browser and navigate to `http://localhost:3000` ### Building for Production ```bash npm run build ``` The built files will be in the `dist` directory. ## Project Structure ``` tower-defense-3d/ ├── public/ # Static assets ├── src/ │ ├── Config/ # Configuration files │ ├── Core/ # Game loop, state management │ ├── Rendering/ # Three.js rendering │ ├── World/ # Terrain, paths, grid │ ├── Entities/ # Towers, enemies, projectiles │ ├── Systems/ # Combat, elements, waves │ ├── Effects/ # Visual effects │ ├── UI/ # User interface │ ├── Levels/ # Level system │ └── Utils/ # Utility classes ├── server/ # Backend API ├── docs/ # Documentation └── tests/ # Test files ``` ## Game Mechanics ### Tower Types | Type | Description | |------|-------------| | Single Target | High damage to one enemy | | AOE | Area damage to multiple enemies | | Control | Slows or stuns enemies | ### Element System - **Fire**: Burns enemies over time - **Ice**: Slows enemy movement - **Electric**: Stuns enemies briefly - **Poison**: Deals damage over time Element advantages: - Fire beats Ice - Ice beats Electric - Electric beats Poison - Poison beats Fire ### Enemy Types | Type | Health | Speed | |------|--------|-------| | Basic | Medium | Medium | | Fast | Low | High | | Tank | High | Low | | Flying | Medium | Medium | ## Controls - **Mouse Click**: Place towers - **P / Escape**: Pause game - **Space**: Resume game - **R**: Restart level ## Performance The game is optimized for 60 FPS on modern hardware: - Instanced rendering for multiple objects - Object pooling for projectiles and particles - LOD system for distant objects - Efficient range detection ## API The backend provides a simple REST API for score storage: - `POST /api/scores` - Submit a score - `GET /api/leaderboard` - Get top scores - `GET /api/scores/:playerName` - Get player scores See [API Documentation](API.md) for details. ## Development See [Development Guide](DEVELOPMENT_GUIDE.md) for detailed development instructions. ## Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Test thoroughly 5. Submit a pull request ## License This project is licensed under the MIT License. ## Acknowledgments - Three.js for 3D rendering - Vite for fast development - TypeScript for type safety