A modern, extensible tower defense game built with Phaser 3.88.2 and ES6 modules. Defend your base from waves of enemies by strategically placing, upgrading, and combining different types of towers. Designed for easy expansion and clean architecture.
Note: The complete code of this game was written by AI (mostly GPT-4.1 in Windsurf). Graphics: ChatGPT-4o. Sounds: ElevenLabs.
- Features
- Getting Started
- Commands
- Gameplay
- Assets
- Screenshots
- Tech Stack
- Project Structure
- Contributing
- License
- Credits
- 6 Tower Types: Basic, Area Effect, Slowing, Sniper, Multi-shot, Support
- Tower Upgrades: Improve stats and visuals
- Multiple Enemy Types: Fast, armored, flying, healer, shield, split, teleport, boss
- Visual & Audio Effects: For attacks, deaths, upgrades, and UI
- Manual & Automatic Wave Progression
- Map & Difficulty Selection
- Config-Driven Extensibility for towers, enemies, waves, and maps
- Clean, Event-Driven Architecture for easy feature expansion
- Node.js (v16+ recommended)
- npm
git clone git@github.com:rupertgermann/tower-defence.git
cd tower-defence
npm installnpm startOpen http://localhost:8080 in your browser.
npm run buildOutput will be in the dist/ directory.
-
npm start
Start the development server with hot reload (default: http://localhost:8080). -
npm run build
Build the game for production (output indist/). -
npm run generate-assets
Run the asset generator script (src/assets-generator.js) to create or process game assets. -
npm test
Placeholder test script (currently not implemented).
Defend your base from waves of enemies by building and upgrading towers. Survive all waves to win.
-
Select a Tower
Use the bottom bar to choose a tower type. Each tower has unique abilities and cost. -
Place Towers
Click on a highlighted placement tile to build the selected tower. You must have enough gold. -
Upgrade Towers
Click on a placed tower to view its info and upgrade it (if you have enough gold). Upgrades improve damage, range, and fire rate. -
Start Waves
Press the "Start Wave" button to begin a new wave of enemies. Some waves start automatically. -
Defend Your Base
Enemies follow the path to your base. If they reach the end, you lose lives. Lose all lives and it's game over. -
Earn Gold
Defeating enemies grants gold, which you use to build and upgrade towers.
- Basic Tower: Standard single-target attack.
- Area Effect Tower: Deals splash damage to groups.
- Slowing Tower: Slows enemies on hit.
- Sniper Tower: High damage, long range, slow fire rate.
- Multi-shot Tower: Attacks multiple targets at once.
- Support Tower: Buffs nearby towers' fire rate.
- Basic: Standard enemy.
- Fast: Moves quickly, low health.
- Armored: High health, reduced damage taken.
- Flying: Ignores some tower types.
- Healer: Periodically heals itself or nearby enemies.
- Shield: Temporarily immune to damage with an active shield.
- Split: Splits into smaller enemies upon death.
- Teleport: Periodically jumps ahead along the path.
- Boss: Very high health, strong, may combine special abilities.
- Mix tower types for best coverage.
- Upgrade towers to handle tougher waves.
- Place support towers to maximize buffs.
- Watch your gold and plan upgrades carefully.
- Some towers can't hit flying enemies—plan accordingly.
Game assets are generated procedurally using the script in src/assets-generator.js.
- Tiles: Grass, desert, mountain, path, placement
- Towers: All types and upgrade levels
- Enemies: Basic, fast, armored, flying, boss, healer, shield, split, teleport
- Projectiles: Basic, AoE, slow, sniper, multishot
- Effects: Explosion, favicon
You can regenerate all assets with:
node src/assets-generator.jsGenerated assets are placed in public/assets/images/.
- Phaser 3.88.2
- ES6 modules
- Webpack
- Babel
- Custom asset generator script
src/- Game source code (entities, systems, scenes, utilities, config)public/- Static assets and HTML entry pointdocs/- Design and planning documentsmemory-bank/- Project context and documentation
Pull requests and suggestions are welcome! Please see the docs/ and memory-bank/ folders for project context and guidelines.
MIT License
- Game design and code: GPT-4.1 in Windsurf
- Graphics: ChatGPT-4o
- Sounds: ElevenLabs
- Built with Phaser 3



