PluginBench
Skill
Pass
Audit score 90

tower-defense

gamedev-skills/awesome-gamedev-agent-skills

Build tower defense games with enemy pathing, wave spawning, tower targeting, and economy systems.

What is tower-defense?

A compositional playbook for tower defense mechanics: enemies follow lanes while towers auto-target and fire, players earn gold to upgrade, and lose if enemies leak through. Use this when designing the core TD loop, balancing wave difficulty against player income, or tuning tower DPS and targeting priorities.

  • Define enemy wave spawning with timed, scripted sequences and per-wave scaling
  • Implement tower targeting with multiple priority modes (first/last/closest/strongest/weakest)
  • Balance economy: gold from kills, tower costs, and upgrade refunds
  • Set up lives/leak penalties and wave/prep UI (lives, gold, next-wave preview)
  • Tune design knobs: enemy HP growth, income curves, tower DPS/range/cost, and wave pacing
  • Validate lane viability with DPS-vs-HP sanity checks

How to install tower-defense

npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill tower-defense
Prerequisites
  • Familiarity with game development in your chosen engine (Godot, Unity, etc.)
  • Basic understanding of pathfinding or waypoint systems (covered separately in game-ai skill)
  • Knowledge of game loops and state management
Claude Code
Cursor
Windsurf
Cline

How to use tower-defense

  1. 1.Define your enemy types, towers, and wave data as assets (use godot-resources or unity-scriptableobjects)
  2. 2.Implement a wave spawner that sequences enemies with timed spacing and per-wave scaling
  3. 3.Set up tower placement validation and a targeting system with your chosen priority mode (default: first/furthest along path)
  4. 4.Build the economy: assign gold bounties per enemy type, tower/upgrade costs, and sell refunds
  5. 5.Create the UI: display lives, gold, next-wave preview, and start-wave control
  6. 6.Tune design knobs (enemy HP growth ~1.1–1.2× per wave, income vs. HP curves, tower DPS/range/cost) and validate lanes hold with DPS-vs-HP math
  7. 7.Test wave pacing: alternate spikes and breathers, add enemy variety to counter dominant strategies, and ensure leaks cost both lives and bounty

Use cases

Good for
  • Design a classic lane-based tower defense where players place towers and manage upgrades between waves
  • Build a maze-style TD where pathfinding adapts to tower placement and players must avoid softlocking the path
  • Balance a wave-defense game by tuning enemy HP scaling against player income to maintain tension
  • Create enemy variety (fast, armored, flying, boss) to counter one-build strategies and force tactical decisions
  • Pace difficulty spikes and breathers across a campaign to avoid monotonic exhaustion
Who it's for
  • Game designers tuning tower defense balance and difficulty curves
  • Developers building TD or wave-defense games in any engine
  • Level designers planning map layouts and enemy composition
  • Gameplay programmers implementing tower targeting and economy systems

tower-defense FAQ

When should I use this skill vs. game-ai or level-design?

Use tower-defense for the TD-specific systems (wave spawning, targeting, economy, leak penalties). Use game-ai for the pathfinding algorithm itself (A*, flow fields, steering). Use level-design for map layout and flow.

How do I prevent the game from becoming trivial after a few waves?

Scale enemy HP geometrically (~1.1–1.2× per wave) against the player's income curve so they can almost—but not quite—afford each upgrade. Add enemy variety (armored, flying, fast) that hard-counters single-tower strategies.

What is the most important targeting mode?

'First' (furthest along path) is the default and stops leaks most reliably. Other modes (closest, strongest, weakest) change optimal placement and strategy; experiment to match your game's feel.

How do I avoid softlocking a maze TD?

Forbid tower placements that sever the path, and recompute paths when towers change. Validate placement before allowing it.

Should leaks only cost lives?

No. Make leaks also forfeit the bounty from that enemy so leaking is never optimal. This keeps the economy tight and stakes high.

Full instructions (SKILL.md)

Source of truth, from gamedev-skills/awesome-gamedev-agent-skills.


name: tower-defense description: > Build a tower defense: enemies pathing along lanes, wave spawning, towers that auto-target and fire, an economy, and lives. Use for a tower-defense/wave-defense game, or balancing waves and economy.

Tower Defense

A playbook for tower defense — enemy pathing, wave spawning, tower targeting, and the economy that ties them together. This is a compositional skill: it orchestrates pathing, AI, and UI into a TD loop. It does not re-teach pathfinding; it defines the systems and the balance levers (DPS vs. HP vs. income) that decide whether a TD is tense or trivial.

When to use

  • Use when building a game where the player places towers that automatically attack waves of enemies following a path, spends earned currency to expand/upgrade, and loses if too many enemies leak through.
  • Use when designing wave composition/pacing, tower targeting priorities, or the gold economy.

When not to use: the player directly controls a shooter → fps-shooter. Free-form base building with needs → survival-crafting. For the pathfinding algorithm itself, use game-ai.

Core loop

Prepare (place/upgrade towers with current gold) → start the wave → enemies path toward the goal while towers auto-fire → earn gold from kills → survive the wave → repeat against a harder one. The tension is a planning puzzle: is my current DPS enough for what's coming, and can I afford the answer?

Must-have systems

  1. Enemy path — waypoint lanes, or grid + pathfinding for maze TD (refs).
  2. Wave spawner — timed, scripted sequences of enemy types with per-wave scaling.
  3. Towers — range, fire rate, damage, projectile/hitscan, splash; placement validity.
  4. Targeting — per-tower priority (first/last/closest/strongest/weakest) (refs).
  5. Economy — gold from kills + wave bonuses; tower/upgrade costs; sell refund.
  6. Lives / leak — enemies reaching the goal cost lives; 0 = game over.
  7. Wave/prep UI — lives, gold, next-wave preview, start-next-wave control.

Design knobs

KnobEffectNotes
Enemy HP growth/waveupgrade pressureGeometric ~1.1–1.2× (refs).
Income vs. HP curvesdifficultyPlayer should almost afford each wave.
Tower DPS / range / costtower identityCheap+wide vs. expensive+tall.
Targeting priorityoptimal placementChanges play more than raw stats.
Enemy varietycounters one-build winsFast / armored / flying / swarm / boss.
Leak penaltystakesCost lives and lost bounty.
Upgrade vs. build economystrategy depthDiminishing upgrade returns.
Wave pacingtension curveSpike → breather → spike, not monotonic.

Patterns

1. Wave spawner (timed, data-driven)

# Pseudocode. A wave is data: a list of (enemy_type, count, spacing). Spawn over time.
wave = [ ("grunt", 10, 0.5), ("runner", 5, 0.3), ("tank", 2, 1.0) ]

def run_wave(wave):
    for enemy_type, count, spacing in wave:
        for _ in range(count):
            spawn_enemy(enemy_type, at=path[0])   # enter at the path start
            wait(spacing)                          # seconds between spawns (use a timer/coroutine)
    # wave clears when all spawned enemies are dead or have leaked

2. Tower targeting (filter to range, then pick by priority)

# Pseudocode. "First" (furthest along path) is the standard default for stopping leaks.
def acquire_target(tower, enemies, mode="first"):
    in_range = [e for e in enemies if distance(tower.pos, e.pos) <= tower.range]
    if not in_range: return None
    if mode == "first":    return max(in_range, key=lambda e: e.progress)   # furthest along path (stop leaks)
    if mode == "last":     return min(in_range, key=lambda e: e.progress)   # least progress (guard the entrance)
    if mode == "closest":  return min(in_range, key=lambda e: distance(tower.pos, e.pos))
    if mode == "strongest":return max(in_range, key=lambda e: e.hp)         # burn down tanks first
    if mode == "weakest":  return min(in_range, key=lambda e: e.hp)         # secure kills / last-hit bounty
    return in_range[0]

3. "Can this lane hold?" sanity check (DPS vs. HP)

# Pseudocode. One tower's damage to one enemy crossing its range.
tower_dps     = tower.damage * tower.fire_rate
time_in_range = tower.range_coverage_length / enemy.speed
damage_dealt  = tower_dps * time_in_range
# Lane holds if summed damage_dealt from covering towers >= enemy.hp (per enemy). See refs.

Pitfalls / failure modes

  • Enemy HP scales slower than player income/DPS → game trivializes after a few waves. Tune the HP curve against the income curve (refs).
  • One dominant tower/strategy → no decisions. Add enemy types that hard-counter builds (armored vs. rapid-fire, flying vs. ground-only) and diminishing upgrade returns.
  • Maze TD that can fully block the goal → enemies get stuck/softlock. Forbid placements that sever the path; recompute paths when towers change (refs).
  • No next-wave telegraph → specials feel random and unfair. Preview upcoming composition.
  • Per-frame movement unscaled by dt → speed varies with frame rate. Scale steering by dt.
  • Leaks only cost lives, not gold → leaking is sometimes optimal. Make leaks lose bounty too.
  • Monotonic difficulty ramp → exhausting. Pace spikes and breathers.

Composition (build it from these skills)

  • Pathing: game-ai for A*/flow-field/steering; for fixed lanes, simple waypoint following.
  • Enemy movement: godot-2d-movement (or engine equivalent) to move along the path; unity-navmesh for nav-based pathing.
  • Map: godot-tilemap / unity-tilemap-2d for the grid/lanes; level-design for map layouts.
  • Data: godot-resources / unity-scriptableobjects to define towers, enemies, and waves as assets.
  • UI: game-ui-ux for HUD layout, scaling, and the build menu; godot-ui-control for the concrete widgets (lives, gold, wave preview).
  • Polish: audio-design for fire/hit/leak sound cues.

References

  • For path representations (waypoints / A* / flow fields), targeting modes, DPS and economy math, enemy scaling, and wave pacing, read references/balancing.md.