# Tower Defense — Cyberpunk

**Theme:** Cyberpunk / Neon City
**Map:** Single Path (winding neon-lit street grid)
**Date:** 2026-04-17

---

## Prompt

Build a complete, self-contained single-file 3D tower defense game using Three.js set in a cyberpunk neon city. The game must be fully playable with strategic depth, upgrade systems, wave progression, and polished visuals. No external images or models — all 3D geometry built programmatically from Three.js primitives.

### Theme: Cyberpunk — "Firewall: The Grid Defends Itself"

**Visual Palette:**
- Night black: `#0a0a14`
- Neon pink: `#ff00aa`
- Electric cyan: `#00ffee`
- Warning amber: `#ffaa00`
- Grid purple: `#8800ff`
- Chrome white: `#e8e8ff`

**Terrain:**
- Dark city block ground (grid lines visible)
- Glowing neon path (emissive material, pink/cyan)
- Holographic billboard elements at edges
- Rain particle system (subtle)
- Dark city gradient sky with distant neon horizon glow

**3D Scene Setup:**
- Camera: Isometric-style perspective, ~55° angle looking down
- Lighting: Ambient dark blue + directional light with shadows + point lights on towers (neon glow)
- Ground: Dark plane with faint grid texture (CSS-like material)
- Sky: Dark gradient, no skybox texture

---

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

### 1. Turret Node (Basic)
- **Visual:** Angular box base (dark iron) + rotating top cylinder with pink glow ring
- **Stats (L1):** DMG 15, RNG 4.0, ROF 1.2/s, Cost 50g
- **Stats (L2 — +40% DMG, +10% RNG, 1.5x cost):** DMG 21, RNG 4.4, ROF 1.2/s, Cost 75g
- **Stats (L3 — +100% DMG, +25% RNG, 2.5x cost):** DMG 30, RNG 5.0, ROF 1.2/s, Cost 125g — **Ability:** Piercing shots hit 2 enemies
- **Upgrade Visual:** L2 adds a second barrel. L3 adds glowing shoulder panels and intense pink core
- **Projectile:** Pink neon bolt (small elongated sphere, emissive)

### 2. Railgun Spike (Sniper)
- **Visual:** Tall thin dark spire with cyan glowing tip
- **Stats (L1):** DMG 80, RNG 9.0, ROF 0.4/s, Cost 100g
- **Stats (L2 — +40% DMG, +10% RNG, 1.5x cost):** DMG 112, RNG 9.9, ROF 0.4/s, Cost 150g
- **Stats (L3 — +100% DMG, +25% RNG, 2.5x cost):** DMG 160, RNG 11.25, ROF 0.4/s, Cost 250g — **Ability:** Critical hits 2x damage (20% chance)
- **Upgrade Visual:** L2 adds charging coil rings. L3 adds prongs and intense cyan beam tip
- **Projectile:** Cyan beam line (raycaster instant with 0.2s visible trace)

### 3. EMP Bomb (Splash)
- **Visual:** Dome base with purple glow, launches upward arc
- **Stats (L1):** DMG 40, RNG 3.5, ROF 0.6/s, Cost 80g, Blast R 2.0
- **Stats (L2 — +40% DMG, +10% RNG, 1.5x cost):** DMG 56, RNG 3.85, ROF 0.6/s, Cost 120g, Blast R 2.4
- **Stats (L3 — +100% DMG, +25% RNG, 2.5x cost):** DMG 80, RNG 4.375, ROF 0.6/s, Cost 200g, Blast R 3.0 — **Ability:** Burn DOT (5 DPS for 3s)
- **Upgrade Visual:** L2 adds EMP ring. L3 adds satellite dishes and purple pulse aura
- **Projectile:** Purple sphere that arcs up then detonates with expanding ring

### 4. Firewall (Slow)
- **Visual:** Wall of vertical neon cyan lines, slight flicker animation
- **Stats (L1):** DMG 5, RNG 3.0, ROF 2.0/s, Slow 40%, Cost 60g
- **Stats (L2 — +40% DMG, +10% RNG, 1.5x cost):** DMG 7, RNG 3.3, ROF 2.0/s, Slow 50%, Cost 90g
- **Stats (L3 — +100% DMG, +25% RNG, 2.5x cost):** DMG 10, RNG 3.75, ROF 2.0/s, Slow 65%, Cost 150g — **Ability:** Complete freeze for 1s every 8s
- **Upgrade Visual:** L2 adds more vertical lines. L3 adds pulsing energy core and electric arcs
- **Projectile:** Electric cyan arc (jagged line to target)

### 5. Bit Storm (Rapid)
- **Visual:** Hovering dark cube with spinning ring, cyan particles
- **Stats (L1):** DMG 6, RNG 3.5, ROF 5.0/s, Cost 70g
- **Stats (L2 — +40% DMG, +10% RNG, 1.5x cost):** DMG 8, RNG 3.85, ROF 5.5/s, Cost 105g
- **Stats (L3 — +100% DMG, +25% RNG, 2.5x cost):** DMG 12, RNG 4.375, ROF 6.0/s, Cost 175g — **Ability:** Double barrel (2 projectiles per shot)
- **Upgrade Visual:** L2 adds second spinning ring. L3 adds quad arms and intense particle aura
- **Projectile:** Small cyan energy darts (tiny elongated spheres)

### 6. Blackout (Special)
- **Visual:** Tall dark antenna with purple tip, periodic pulse wave
- **Stats (L1):** DMG 25, RNG 4.0, ROF 0.8/s, Cost 120g
- **Stats (L2 — +40% DMG, +10% RNG, 1.5x cost):** DMG 35, RNG 4.4, ROF 0.8/s, Cost 180g
- **Stats (L3 — +100% DMG, +25% RNG, 2.5x cost):** DMG 50, RNG 5.0, ROF 0.8/s, Cost 300g — **Ability:** Disables all enemies in range for 2s every 10s
- **Upgrade Visual:** L2 adds signal dishes. L3 adds orbital rings and massive purple glow
- **Projectile:** Purple data stream (particle line)

---

## Enemy Types (6 minimum)

| Type | HP Base | Speed Base | Armor | Special | Gold |
|---|---|---|---|---|---|
| **Malware Drone** | 40 | 2.5 | 0 | Swarm, low HP | 8 |
| **Trojan Walker** | 120 | 1.5 | Light (20% DR) | Standard threat | 15 |
| **Worm Swarm** | 25 each | 3.0 | 0 | Chain of 5 spheres, fast | 20 total |
| **Ransomware Tank** | 350 | 0.8 | Heavy (40% DR) | Disables towers in path for 3s | 40 |
| **Data Spider** | 80 | 3.5 | 0 | Very fast, small target | 12 |
| **AI Core (Boss)** | 2000 | 0.6 | Heavy (50% DR) | Every 5th wave, special abilities | 200 |

**Flying enemies (Wasp Drones):** Fast, bypass ground path (optional — if implemented, they fly in straight line). Can be hit by all towers.

**HP Scaling per Wave:** `hp = baseHP * (1 + 0.15 * wave)` cap at 8x
**Speed Scaling per Wave:** `speed = baseSpeed * (1 + 0.05 * wave)` cap at 2.5x

---

## Wave Composition (20 waves)

Wave 1: 8 Malware Drones (tutorial wave — scouts only)
Wave 2: 6 Malware Drones + 4 Trojan Walkers
Wave 3: 10 Malware Drones + 2 Worm Swarms
Wave 4: 5 Trojan Walkers + 3 Data Spiders
Wave 5: **BOSS** — 1 AI Core + 4 Malware Drones escort
Wave 6: 8 Trojan Walkers + 4 Data Spiders
Wave 7: 3 Worm Swarms + 6 Data Spiders
Wave 8: 6 Trojan Walkers + 2 Ransomware Tanks
Wave 9: 15 Malware Drones (swarm wave)
Wave 10: **BOSS** — 1 AI Core + 8 Trojan Walkers
Wave 11: 4 Ransomware Tanks + 8 Data Spiders
Wave 12: 5 Worm Swarms + 6 Trojan Walkers
Wave 13: 10 Data Spiders + 4 Trojan Walkers
Wave 14: 8 Trojan Walkers + 4 Ransomware Tanks
Wave 15: **BOSS** — 1 AI Core + 6 Ransomware Tanks
Wave 16: 20 Malware Drones + 6 Data Spiders
Wave 17: 6 Ransomware Tanks + 8 Trojan Walkers
Wave 18: 8 Worm Swarms + 10 Data Spiders
Wave 19: 12 Trojan Walkers + 6 Ransomware Tanks
Wave 20: **FINAL BOSS** — 2 AI Cores + 20 Malware Drones escort

Between waves: 15-20 second timer. "Next Wave" button to skip.

---

## Economy

- **Starting gold:** 300 (enough for 3 basic towers or 1 expensive + 1 basic)
- **Gold per kill:** scout 8, soldier 15, tank 40, boss 200
- **Interest:** 2% interest on unspent gold between waves (rewards saving)
- **Sell towers:** 60% refund of total investment (base + all upgrades)
- **Sell confirmation:** Required when tower value > 50% of current gold

---

## Base / Lives

- **Base HP:** 20 lives
- **Lives lost:** Each enemy reaching base costs 1 life (bosses cost 3)
- **Game Over:** 0 lives remaining
- **Victory:** Survive all 20 waves

---

## Map Layout (Single Path — Winding Neon Street)

Grid: 16x12 tiles, tile size 2.0 units

```
Entry (left edge) → winds right → U-turn → winds left → U-turn → Base (right edge)

Path tiles (non-buildable):
[ ][ ][ ][P][P][P][P][P][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][P][ ][ ][ ][P][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][P][ ][ ][ ][P][P][P][P][P][ ][ ][ ][ ]
[P][P][P][P][ ][ ][ ][ ][ ][ ][ ][P][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][P][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][P][P][P][P][P][P][P][P][ ][ ][ ]
[ ][ ][ ][ ][P][P][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][P][P][P][P][P][P][ ][ ][ ][ ][ ][ ][ ][ ]
[P][P][P][ ][ ][ ][ ][P][P][P][P][P][P][P][P]
[ ][ ][P][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][P][P][P][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[P][P][P][P][P][P][P][P][P][P][P][P][P][P][P]
```
P = path tile. Base at far right. Entry at far left.
Buildable tiles: all [ ] cells adjacent to path.

---

## 3D Visual Treatment

### Towers (programmatic primitives only)
- Base: BoxGeometry (angular, dark iron material)
- Body: CylinderGeometry or custom composite
- Upgrades: Additional geometry layers, emissive glow intensifies
- Tower rotation: Smooth lerp to face current target
- Range indicator: Semi-transparent cyan/pink sphere on hover/selection

### Enemies (color-coded geometric shapes)
- Malware Drone: Small magenta cubes (0.3 unit), glow
- Trojan Walker: Dark blue rectangular box with legs
- Worm Swarm: Chain of 5 connected cyan spheres
- Ransomware Tank: Large dark box with red skull icon (billboard)
- Data Spider: Small fast amber diamond shape
- AI Core Boss: Large glowing polyhedron (IcosahedronGeometry) with rotating ring

### Projectiles
- Pink bolts, cyan beams, purple orbs, electric arcs
- Emissive materials with glow
- Visible travel time (lerp)
- Impact: Particle burst

### Effects
- Enemy death: Glitch/distortion flash + particle burst
- Tower fire: Muzzle flash (brief point light)
- Freeze: Ice crystal particle burst
- Boss incoming: Screen-edge red pulse + "BOSS INCOMING" warning text
- Tower disable (ransomware): Red X overlay on disabled tower

### Health Bars
- Billboard sprites above each enemy
- Green → yellow → red gradient based on HP %
- Boss health bar: Larger, top-center of screen

---

## UI (DOM Overlay)

### HUD (always visible, top bar)
- Gold counter (cyan icon + number)
- Lives counter (heart icon + number)
- Wave counter ("WAVE 5 / 20")
- Next wave timer countdown
- Game speed controls: 1x / 2x / 3x buttons
- Mute button

### Tower Panel (right sidebar)
- 6 tower buttons (icon + name + cost)
- Greyed out if can't afford
- Selected tower: show stats (DMG, RNG, ROF, description)
- Upgrade button when tower selected (shows L2/L3 cost + stat preview)
- Sell button when tower selected (shows refund amount)
- Targeting mode cycle: First / Strongest / Weakest / Fastest

### Tower Info Popup (on tower click)
- Tower name + level stars
- Current stats
- Upgrade cost + new stats (or MAX if L3)
- Sell value
- Targeting mode toggle

### Game States

**Start Screen:**
- "FIREWALL" title in neon pink/cyan
- Subtitle: "THE GRID DEFENDS ITSELF"
- Animated background (subtle rain + neon glow)
- "START GAME" button
- Difficulty: Normal / Hard (hard = enemies +30% HP, gold -20%)

**Building Phase:**
- Full HUD + tower panel
- Wave preview: "NEXT: Wave 6 — 8 Trojan Walkers + 4 Data Spiders"
- 15s countdown timer (pulsing)
- "SKIP WAIT" button

**Wave Active:**
- HUD + tower panel
- Wave progress bar
- Enemies remaining counter
- Wave active indicator (glowing)

**Paused:**
- Semi-transparent dark overlay
- "PAUSED" text
- Resume / Restart / Quit buttons

**Game Over:**
- "SYSTEM BREACH" in red glitch text
- Stats: Waves survived, enemies killed, towers built
- "REBOOT" (play again) button

**Victory:**
- "GRID SECURED" in cyan
- Final stats
- "CONTINUE (ENDLESS)" button

---

## Camera Controls
- Mouse wheel: zoom in/out (clamped)
- Right-click drag: pan (clamped to map bounds + 20%)
- Touch: pinch zoom, two-finger pan
- Reset: 'R' key or reset button returns to default view
- Default: shows full map with ~10% margin

---

## Audio (Web Audio API — procedural)
- Tower fire: Short synth burst (varies by tower type)
- Enemy death: Digital "pop" or "crunch"
- Wave start: Alert synth tone
- Boss incoming: Low rumble
- Game over: Descending glitch tone
- Victory: Ascending synth chord
- Ambient: Subtle rain/static hum

---

## SEO Metadata
```
<meta name="description" content="Firewall: The Grid Defends Itself — A cyberpunk 3D tower defense game. Stop the rogue AI from breaching your firewall.">
<meta property="og:title" content="Firewall — Cyberpunk Tower Defense">
<meta property="og:description" content="A cyberpunk 3D tower defense game. Stop the rogue AI from breaching your firewall.">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
```

---

## Notes

- The path winds in an S/Z shape so towers at interior corners get multi-target exposure
- Ransomware tanks force dynamic tower selling/building decisions — don't stack at chokepoints
- Boss every 5th wave with escort gives players breathing room in regular waves
- Interest mechanic rewards hoarding — strategic choice between early aggression and late power spikes
- Targeting priority is critical for experienced play: First (default), Strongest (burn tanks), Weakest (clean up), Fastest (catch spiders)
- All economy numbers tuned so a player building only Turret Nodes (basic) can survive to wave 8-10 before failing
