Back to Projects

Dungeon Architect

Tower defense game where you play the villain — place traps and monsters to stop 11 hero types across 14 escalating waves. Built with React, Zustand, and HTML5 Canvas with all sprites drawn procedurally in code.

Dungeon Architect

"The heroes returned. Again. I've scheduled a performance review." — Gerald, Skeleton MBA, Dungeon Operations Division

You are the villain. Heroes raid your dungeon to steal your treasure — place traps and monsters to stop them, then kill them on the way out before they escape with the gold. 14 waves, 3 difficulty settings, 11 hero types, and 16 defensive tools. Fully local, single-player, no internet required.


How the Game Works

The dungeon has a looping path: heroes enter through the gate on the left, wind through the dungeon to the treasure vault on the right, grab the gold, then follow the return corridor back to the entrance. They only truly escape after completing the full loop. You have to stop them on both legs of the trip.

Difficulty

Choose from three difficulty settings on the main menu before starting. Wave 1 is identical across all three — the gap opens from wave 4 onward and becomes dramatic in the final waves.

Easy 🌿Medium ⚔️Hard 💀
Starting gold450g350g250g
Wave gold budget×1.5×1.2×1.0
Treasure HP500400300
Late-game hero HP scaling35% of hard65% of hardFull
Wave 14 Knight HP~1,140~1,8602,700

Plan Phase

  • Select a tool from the left sidebar, left-click a tile to place it
  • On-path tools (spikes, boulders, doors, lava) go on the lit stone corridor
  • Towers and monsters go on empty tiles beside the path — they attack automatically by range
  • Hover over any tower to preview its attack radius
  • Right-click a placed tile to sell it for a 50% refund
  • Hit ⚔ Send Them In when ready

Wave Phase

  • Heroes spawn one at a time, staggered 1.5 seconds apart
  • When a hero reaches the treasure vault they grab the gold — watch for the 💰 indicator
  • You can still place and sell tiles during the wave — react as you watch
  • Kill a gold-carrying hero for a +25g bonus on top of their normal value
  • Gerald provides commentary. He has opinions about your performance.

Results Phase

  • Review how many heroes escaped with gold (the metric that matters)
  • Pick one of three upgrade cards: unlock a new tool or take bonus gold
  • Upgrade card gold scales with wave number (80g on wave 1, up to 200g+ on wave 14)
  • If the treasure HP hits zero mid-wave, the wave ends immediately

Hero Classes

Heroes scale in HP every wave via the hpMult system — wave 1 is the baseline, later waves multiply base HP. Values below are base HP (wave 1).

Tier 1 — Waves 1–7

HeroBase HPSpeedSpecial
⚔️ Knight3001.2 tiles/sDurable tank. Consistent speed carrying gold.
🧙 Mage1601.0 tiles/s50% fire resistance. Self-heals 4 HP/s; softly heals nearby allies 1 HP/s.
🗡️ Thief1302.0 tiles/sFastest hero. Disarms spike traps. Gets faster (135%) when fleeing with gold.
🛡️ Paladin2600.9 tiles/sHeals adjacent allies 6 HP/s. Gold slows to 82% speed.

Tier 2 — Waves 8–10

HeroBase HPSpeedSpecial
🪓 Berserker4501.8 tiles/sImmune to all slows. Pure rage — ice shards and doors do nothing.
🏹 Ranger1202.2 tiles/sImmune to poison. 40% fire resistance. Hard to stop. Gets faster with gold.
✝️ Cleric2000.9 tiles/sHeals adjacent allies 12 HP/s (2× Paladin). Also self-heals 3 HP/s.

Tier 3 — Waves 11–13

HeroBase HPSpeedSpecial
🔮 Archmage2201.1 tiles/s70% fire resistance. Immune to slows. Self-heals 4 HP/s; soft party heal 2 HP/s.
🪖 Warlord4801.0 tiles/sDisarms all on-path traps — spikes, boulders, and lava left in ruins.
🌿 Regenerator3201.05 tiles/sSelf-heals 20 HP/s (scaled higher on later waves). Needs sustained, overlapping fire.

Tier 4 — Wave 14

HeroBase HPSpeedSpecial
⚜️ Champion6000.85 tiles/sTakes only 45% damage from all sources. The dungeon's greatest threat.

Your Arsenal

Defenses persist between waves — you're building the dungeon over all 14 waves. Unlocked-at-start tools are available immediately; Tier 2 tools unlock via upgrade cards.

On-Path Traps

Placed on the corridor — heroes walk directly over them.

ToolCostEffect
🔩 Spike Plate30g25 damage on step. Thieves and Warlords disarm it.
🪨 Rolling Boulder20g60 damage, one-shot (consumed after first trigger). Warlords destroy it harmlessly.
🚪 Iron Door35gSlows heroes to 40% speed. Excellent before a trap cluster.
🌋 Lava Floor (Tier 2)65g15 HP/s damage while any hero stands on it — hits both legs of the trip.

Off-Path Towers & Monsters

Placed beside the path — attack automatically by range.

Unlocked at start

ToolCostRangeDamageAttack SpeedSpecial
🎯 Dart Tower45g3201.0sReliable single-target fire.
💀 Skeleton Guard50g2180.9sSword arc; targets closest.
🟢 Slime25g1.580.7sRapid spam at very short range.
🧌 Cave Troll130g2352.6sHits all heroes in range at once. Devastating vs grouped parties.

Tier 2 — unlocked via upgrade cards

ToolCostRangeDamageAttack SpeedSpecial
🔥 Fire Vent70g2402.0sHeavy burst. Mages/Rangers/Archmages resist.
☠️ Poison Mist55g281.8sApplies 3 HP/s poison DoT on hit. Rangers immune.
🧊 Ice Shard60g2.5102.2sSlows target to 50% for 2s. Berserkers and Archmages immune.
👻 Wraith90g3.5302.0sPhysically rushes to target. Long range.
🦇 Vampire Bat55g2120.55sRapid bites permanently drain max HP — counters healer parties.
🌑 Shadow Stalker80g3221.4sHunts gold-carrying heroes. Deals double damage on the return trip.
👁️ Cursed Idol70g2.581.5sEach hit adds a curse stack (+15% dmg taken, max 3). Synergises with everything.
🗿 Gargoyle90g4382.2sAlways targets the most advanced hero — stops gold carriers.

Synergies Worth Knowing

Ice → anything with slow damage — ice slows a hero so every nearby tower gets extra attack windows.

Iron Door → Spike / Lava / Dart cluster — heroes slow to 40% inside, spending far longer in the kill zone.

Cursed Idol → everything — place an idol early so all downstream towers deal 45% extra damage to cursed heroes.

Shadow Stalker + Gargoyle — the stalker doubles damage on returning gold carriers; the gargoyle always targets the most advanced one. Cover the return corridor with these two and gold rarely makes it out.

Vampire Bat + Cleric/Paladin counter — a bat drains max HP so healer effectiveness shrinks each second. Pairs with towers that deal sustained DPS.

Cave Troll + chokepoints — the troll hits everyone in range simultaneously. Place near doors so a full group bunches up together.


All 14 Waves

WaveTitleHeroesHP Mult
1The First Scouting Party3× Knight1.0×
2They Brought a Lockpick2× Knight, Thief1.0×
3Mixed Tactics2× Knight, Mage, Thief1.2×
4A Full Party2× Knight, Mage, Thief, Paladin1.5×
5They Brought a Healer2× Knight, 2× Mage, Thief, Paladin1.9×
6The Siege Begins3× Knight, Mage, 2× Thief, Paladin2.4×
7They Are Not Giving Up3× Knight, 2× Mage, Thief, Paladin3.0×
8The Rage BeginsBerserker, 2× Knight, Mage, Paladin, Ranger, Thief3.5×
9Swift as Shadows2× Ranger, 2× Berserker, 2× Knight, Mage, Paladin4.0×
10The Brute Squad3× Berserker, 2× Ranger, Knight, Mage, Paladin, Cleric4.8×
11The Warlord Leads the ChargeWarlord, 2× Berserker, 2× Ranger, Knight, Mage, Paladin, Cleric, Regenerator5.5×
12The Veteran Warband2× Warlord, 2× Berserker, 2× Ranger, Mage, Paladin, Cleric, Regenerator, Thief6.5×
13The Arcane HostArchmage, 2× Warlord, 2× Berserker, 2× Ranger, Knight, Paladin, Cleric, Regenerator, Thief7.5×
14The Champion's CrusadeChampion, 2× Archmage, 2× Warlord, 2× Berserker, 2× Ranger, Cleric, Paladin, Regenerator9.0×

Tech Stack

TechnologyRole
React 18 + ViteUI components and hot-reload dev server
ZustandCentralised game state and simulation loop
HTML5 Canvas APIDungeon grid renderer — all sprites drawn in code, no image files
requestAnimationFrameTwo independent loops: simulation (game logic) and rendering (canvas)
Custom sprite systemAnimated characters built with Canvas 2D — every hero and tile drawn procedurally
Waypoint pathfindingFixed hero path with A* preview overlay for planning

Project Structure

src/
├── game/
│   ├── constants.js      All game data: tiles, tools, heroes, waves, difficulties, path
│   ├── simulation.js     Per-tick hero movement, trap/tower/status interactions
│   ├── sprites.js        Animated draw functions for every hero and tile type
│   └── pathfinding.js    A* with per-hero terrain weights (used for plan-phase preview)
├── store/
│   └── gameStore.js      Zustand store — state, actions, simulation loop, difficulty system
└── components/
    ├── App.jsx            Phase router (Menu → Plan/Wave → Results → Victory)
    ├── MainMenu.jsx       Title screen with difficulty card selector
    ├── GameScreen.jsx     Main layout: HUD + grid + sidebars
    ├── DungeonGrid.jsx    Canvas renderer + mouse handlers
    ├── ToolPalette.jsx    Left sidebar: tool selection
    ├── BattleLog.jsx      Wave sidebar: hero HP bars, event log, Gerald commentary
    ├── HUD.jsx            Top bar: gold, treasure HP, wave counter, difficulty badge
    ├── ResultsScreen.jsx  Post-wave summary + upgrade card selection
    └── VictoryScreen.jsx  Final screen after completing all 14 waves