Game: Tower Defense
Theme: Cyberpunk
Map: Single-path
Date: 2026-04-05

## Prompt

Build a complete, self-contained 3D tower defense game in a single HTML file using Three.js (loaded from CDN: https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js). The theme is **cyberpunk** — neon-lit digital grid where data packets (enemies) traverse a circuit-board path toward a central server core (the base). The game is called **Firewall** with the tagline **"The grid defends itself"**.

### Map Layout
A single winding path on a dark grid-plane. The path is rendered as a glowing cyan circuit trace. Buildable tiles surround the path as a grid. The base/server core sits at the path's end, glowing and pulsing. The spawn point is at the far end of the path.

### Tower Types (6 types, 3 upgrade tiers each)

1. **Pulse Tower** (Basic) — Cost: 50g. Fires cyan energy bolts. Balanced range/damage/speed. L2: +40% dmg, +10% range. L3: Piercing shots hit 2 enemies.
2. **Railgun Tower** (Sniper) — Cost: 100g. Fires a bright white beam. Long range, high damage, slow rate. L2: +40% dmg, +10% range. L3: 20% crit chance for 2x damage.
3. **EMP Tower** (Splash) — Cost: 80g. Fires expanding purple shockwaves. AoE damage. L2: +40% dmg, bigger radius. L3: Larger blast + burn DOT.
4. **Glitch Tower** (Slow) — Cost: 60g. Projects a green distortion field. Slows enemies, low damage. L2: +40% dmg, stronger slow. L3: Freeze (full stop 1s).
5. **Gatling Tower** (Rapid) — Cost: 70g. Fires rapid red bullets. Fast rate, low per-shot damage. L2: +40% dmg. L3: Double barrel (2 projectiles).
6. **Virus Tower** (Special) — Cost: 120g. Fires green bolts that chain to nearby enemies. L2: +40% dmg, chains to 3. L3: Chains to 5 + poison DOT.

Upgrade costs: L2 = 1.5x base, L3 = 2.5x base.

### Enemy Types (6 types)

1. **Drone** (Scout) — Low HP, fast speed, no armor. Appears in swarms of 8-15.
2. **Program** (Soldier) — Medium HP, medium speed, light armor.
3. **Mainframe** (Tank) — Very high HP, slow, heavy armor (50% damage reduction).
4. **Packet** (Sprinter) — Low HP, very fast, no armor. Rushes through.
5. **Patcher** (Healer) — Medium HP, medium speed. Heals nearby enemies 2% HP/s.
6. **Rootkit** (Boss) — Extreme HP, slow, heavy armor. Unique abilities per appearance. Costs 3 lives.

### Wave System (20 waves)
- HP scales ~15% per wave, speed scales ~5% (capped at 2x base).
- Boss waves: 5, 10, 15, 20.
- Swarm waves: 3, 8, 13.
- Inter-wave break: 18 seconds with "Next Wave" button to skip.

### Economy
- Starting gold: 200 (enough for 3-4 basic towers).
- Gold per kill: Drone 5, Program 10, Mainframe 25, Packet 5, Patcher 15, Rootkit 100.
- Sell towers: 60% refund of total investment.
- 2% interest on unspent gold between waves.

### Base
- 20 lives. Each enemy costs 1 life, bosses cost 3.
- Game over at 0. Victory at wave 20 clear.

### 3D Rendering
- Isometric perspective camera at ~55 degrees.
- Dark background (#0a0a1a) with neon grid lines.
- Ambient + directional light with cyan/purple tones.
- Towers: Geometric compositions of cylinders, boxes, cones with emissive neon materials.
- Enemies: Geometric shapes color-coded by type.
- Projectiles: Small glowing spheres/lines.
- Health bars: Billboard sprites above enemies.
- Tower rotation toward targets.
- Particle effects on enemy death.
- Grid overlay on buildable areas.
- Mouse wheel zoom, right-click drag to pan.

### UI (DOM overlay)
- HUD: Gold, Lives, Wave counter, Wave timer, Speed controls (1x/2x/3x).
- Tower panel: Bottom bar with tower buttons showing name/cost, greyed if unaffordable.
- Selected tower info with upgrade/sell buttons.
- Start screen, pause overlay, game over, victory screens.

### Audio
- Web Audio API procedural sounds: tower fire, enemy death, wave start, boss alert, game over/victory.
- Mute toggle.

## Notes
- Cyberpunk aesthetic: dark backgrounds, neon cyan/magenta/green glow, circuit-board patterns.
- All geometry is programmatic Three.js primitives.
- Performance: object pooling for projectiles and particles, targeting 60fps.
- The path winds in a serpentine pattern giving players strategic tower placement choices.
