Skip to main content
Games Tower Defense new

Tower Defense

Strategic tower defense with A* pathfinding, elemental damage types, and upgrade trees

Bases
Inventory 0/64
Selected Tower
Base
—
HP
—
Weapons
—
DPS
—
Kills
—
Targeting
First
Rune Slots

Shop

0g

Craft

+ =
Inventory 0/64

Keyboard Shortcuts

KeyAction
TabCycle views: War → Shop → Craft
SSell selected tower
RRepair selected tower
NSkip respite / start next wave
ZUndo last tower placement (3s window)
DeleteSell selected tower
1Select Light base
2Select Medium base
3Select Heavy base

Materia System

Towers are built from a base chassis and customized with runes. Place a base on the grid, then socket runes to define its behavior.

Base Types

BaseCostHPSlotsShapeFire RateRange
Light40g1503TriangleFast (0.7x)Standard
Medium90g3004SquareNormal (1.0x)Standard
Heavy160g5005PentagonSlow (1.3x)+1 cell

Rune Categories

  • Artillery (3): Define the firing mode — projectile, beam, or area. No damage on its own.
  • Energy (5): Provide base damage + elemental effects — physical, ice, fire, poison, electricity
  • Mod (11): Stat modifiers — speed, range, crit, splash, pierce, chain, etc.
  • Special (2): Unique abilities — self-heal or burst fire override
  • Cosmetic (8): Visual-only effects

Rune Tiers

TierNameRarity
T1BrutCommon (shop)
T2DistilléUncommon (shop)
T3PurifiéRare (shop)
T4ConcentréEpic (shop, rare)
T5AbsoluLegendary (fusion only)

How Towers Work

Artillery runes define how the tower fires (projectile, beam, or area) — each creates an independent weapon with its own cooldown. Energy runes define how much damage the tower deals and add elemental effects to all weapons. A tower without energy runes fires blanks (0 damage). Multiple energy runes stack their damage. Mods stack additively or multiplicatively to enhance stats.

Runes can be unsocketed by clicking them in the tower info panel — they return to your inventory for free. The Thief enemy can also steal runes.

Artillery Runes

RuneModeDescription
TirProjectileClassic projectile, solid all-rounder
FluxBeamContinuous beam, hits every tick
ZoneAoEConstant area damage around the tower

Energy Runes

RuneElementBase DamageEffect
PhysiquePhysical25+20% raw damage bonus
FroidIce18Slows enemies (30% for 2s)
FeuFire20Burn DoT (5 dmg over 3s)
PoisonPoison15Stackable DoT (3 dmg over 4s)
ÉlectricitéEnergy22Stun chance (15% for 0.5s)

Mod Runes

RuneEffect
SwiftIncreases fire rate (multiplicative)
RangeIncreases attack range
FortifyIncreases tower HP
BountyBonus gold on kill
CritCritical hit chance (3x damage)
SplashAdds splash radius to projectiles
PierceProjectiles pierce through enemies
ChainProjectiles chain to additional targets
ÉchoChance to double-fire
VampirismeLifesteal (heals tower on hit)
RecyclageChance to drop a rune on kill

Special Runes

RuneEffect
SoinAuto-regeneration. T5 (Absolu) = aura heal
OverridePeriodic burst fire. T5 (Absolu) = permanent double speed

Shop & Economy

  • The shop restocks each wave with 8 rune slots
  • Higher tier runes appear less frequently and cost more
  • T5 (Absolu) runes never appear in the shop — only through fusion
  • Boss drops (every 10 waves): choose 1 of 3 runes

Pricing

TierCost Range
T115–30g
T237–75g
T375–150g
T4150–300g

Crafting

Vertical Fusion (3→1)

Combine 3 identical runes (same ID, same tier) to create one rune of the next tier. Fill all 3 craft slots (A+B+C) and press Fuse.

Horizontal Craft (2→1)

Combine 2 different runes to create a recipe result. Fill slots A and B and press Craft. Unknown combinations produce a random cosmetic rune.

Recipes

InputResultEffect
Froid + TirGelFreeze (immobilize)
Feu + FluxPlasmaFire + stun dual damage
Poison + ZoneMiasmePersistent poison cloud
Feu + FroidSteamBlinds enemies (erratic movement)
Feu + PoisonAcideDoT + armor reduction
Électricité + FroidCryostormPeriodic AoE stun
Électricité + PoisonContagionSpreading poison
Crit + SwiftFurieCrits increase fire rate
Chain + SplashCascadeChain bounces with mini-splash
Pierce + RangeLongbowInfinite pierce + extended range
Bounty + RecyclageProspéritéGold bonus + drop chance

Enemy Types

All enemies evolve through 5 tiers that unlock as waves progress. Higher tiers are larger, more opaque, and display tier pips below them.

Tier Progression

WavesMax TierGame Mode
1–20T1Baby
21–40T2Easy
41–60T3Normal
61–80T4Hard
81+T5Nightmare / Endless

Scout (unlocks wave 1)

Fast, fragile. Higher tiers gain sprint bursts and evasion.

TierNameAbilities
T1Scout—
T2Ranger+30% HP, +15% speed
T3SprinterSprint burst (2x speed, 1s every 4s)
T4DasherFaster sprint (2.5x speed, 1.2s every 3s)
T5PhantomSprint + 20% dodge chance

Soldier (unlocks wave 3)

Balanced fighter. Attacks nearby towers. Higher tiers buff allies.

TierNameAbilities
T1SoldierAttacks towers
T2Veteran+40% HP, +10% speed
T3Elite+60% HP, +15% speed
T4CommanderSpeed aura (+20% to nearby allies)
T5WarlordSpeed aura + targets most equipped tower

Tank (unlocks wave 6)

Slow, heavily armored. Resists physical and energy damage.

TierNameAbilities
T1TankHigh armor
T2Heavy+50% HP
T3JuggernautRegeneration (2 HP/s)
T4ColossusRegen + 50% slow resistance
T5BehemothRegen + slow resist + periodic shield

Healer (unlocks wave 9)

Supports allies. Higher tiers gain AoE heal, cleanse, and resurrect.

TierNameAbilities
T1HealerHeals nearby allies
T2Medic+30% HP, +20% heal rate
T3PriestAoE healing
T4BishopAoE heal + cleanses all debuffs from allies
T5ArchbishopAoE heal + cleanse + resurrects recently killed allies

Wizard (unlocks wave 11)

Teleports when damaged. Higher tiers assist allies and drain towers.

TierNameAbilities
T1WizardTeleports every 20% HP lost
T2Sorcerer+30% HP, +10% speed
T3WarlockTeleports 1 ally toward exit (8s cooldown)
T4ArchmageTeleports 2 allies + gains shield after teleport
T5LichTeleports 3 allies (5s) + drains tower HP on teleport

Boulder (unlocks wave 12)

Slow and sturdy. Drops obstacles on death.

TierNameAbilities
T1BoulderDrops 1 rock on death
T2Megalith+50% HP
T3MonolithDrops 2 rocks on death
T4GolemDrops 1 rock + 1 enemy turret
T5TitanDrops 2 rocks + 2 enemy turrets

Runner (unlocks wave 14)

Fast kamikaze. Charges at towers when detected and explodes on contact.

TierNameAbilities
T1RunnerDetects towers at range 2, small explosion
T2Sprinter+30% HP, +15% speed, wider detection
T3BlitzStronger explosion, range 3 detection
T4FirebugExplosion leaves pollution zone (2s)
T5DetonatorLarge explosion + strong pollution zone (5s)

Thief (unlocks wave 15)

Fast and evasive. Steals a rune from a nearby tower.

TierNameAbilities
T1PickpocketSteals 1 rune from adjacent tower
T2Burglar+30% HP, +15% speed
T3Rogue+50% HP, +20% speed
T4Infiltrator+70% HP, faster
T5ShadowVery fast, hard to catch

Kill the thief to recover the stolen rune. If it escapes, the rune is lost permanently.

Bomber (unlocks wave 18)

Slow kamikaze. Massive explosion that destroys obstacles.

TierNameAbilities
T1BomberDetects towers at range 2, medium explosion
T2Demolisher+50% HP, wider detection
T3WreckerExplosion destroys nearby obstacles
T4DevastatorLarger explosion radius, destroys obstacles
T5AnnihilatorMassive explosion + spawns debris (random rocks)

Cursed (unlocks wave 20)

Slow and menacing. Curses a rune in a nearby tower, permanently inverting its effect.

TierNameAbilities
T1HexerCurses 1 rune in adjacent tower
T2Warper+40% HP
T3Corruptor+60% HP, +10% speed
T4Defiler+80% HP, faster
T5AbominationVery tanky, curses nearby runes

Cursed runes cannot be uncursed. Their effects are reversed (e.g., Swift becomes slower, Range becomes shorter).

Boss (every 5 waves)

Massive HP, attacks towers. Higher tiers spawn minions and adapt.

TierNameAbilities
T1BossAttacks towers, high HP
T2Warboss+50% HP
T3OverlordSpawns soldiers every 5s + splits at 30% HP
T4TyrantSpawns soldiers + splits at 40% + damage reduction aura
T5DreadnoughtSpawns soldiers + splits at 50% + aura + adapts resistance to most common damage type

Obstacles

TypeNotes
RockDropped by boulders on death. Destructible, blocks paths.
WallMap structure. Very high HP and resistances. Blocks paths.
Enemy TurretDropped by evolved boulders (T4+). Fires at nearby towers.

When obstacles are destroyed, the cell becomes walkable and enemy paths are recalculated.

Game Modes

ModeWavesStarting GoldLives
Baby2030030
Easy4025025
Normal6020020
Hard8015015
Nightmare10010010
EndlessInfinite20020

Maps

MapDescription
ValleyClassic single-path valley with walls forming a winding corridor
CrossroadsTwo crossing paths with 4 spawn points and 4 exits
FortressCentral fortress with walls to defend, enemies approach from all sides
MazeDense wall maze with multiple possible routes
IslandsThree islets connected by narrow bridges, 3 spawns and 3 exits
ArenaConcentric ring walls with gaps, 4 edge spawns converging to center exit

Weather Events

Random weather events may trigger during waves (starting from wave 4). They apply temporary gameplay modifiers and last 20-30 seconds.

WeatherEffectDuration
FogTower range reduced by 25%30s
RainEnemies move 20% slower25s
StormTowers deal 30% bonus damage20s
WindProjectiles travel 40% faster25s

Achievements

Achievements are tracked across games and stored in your browser. New unlocks are shown at the game over screen.

AchievementRequirement
First BloodKill your first enemy
SurvivorReach wave 10
VeteranReach wave 25
EliteReach wave 50
LegendaryReach wave 100
SlayerKill 100 enemies in a single game
ExecutionerKill 500 enemies in a single game
Boss KillerKill 10 bosses in a single game
Thief HunterKill 5 thieves in a single game
FlawlessComplete a game without losing any lives
PuristWin using only one base type
ArsenalUse all 3 base types in a single game
EconomistFinish with 500+ gold remaining
Mass BuilderBuild 30 or more towers
CommittedWin without selling any towers
Speed DemonWin on 3x speed
Nightmare SlayerComplete Nightmare mode
AlchemistFuse 5 runes in a single game
ArtificerCraft 3 recipe runes in a single game
RunemasterSocket 20 runes in a single game

Mechanics

  • Tower HP: Towers have hit points. Soldiers, bosses, and enemy turrets attack nearby towers.
  • Repair (R): Damaged towers can be repaired for gold (proportional to damage).
  • Destroyed towers are removed from the map and must be rebuilt.
  • Rune socketing: Runes are permanent once placed. Choose wisely.
  • Thief enemies: Steal runes from your towers — kill them to recover.
  • Cursed enemies: Permanently curse runes, inverting their effects.
  • Kamikaze enemies: Runners and bombers follow their path until they detect a tower in range, then charge straight at it and explode on contact.
  • Pollution zones: Some kamikaze explosions leave toxic zones that damage towers over time.
  • Destructible walls: Map walls can be destroyed by towers or bomber explosions, opening new paths.
  • Enemy tiers: Enemies get stronger as waves progress. Higher tiers are visually larger and more opaque with tier pips below.

Tips

  • Place towers to create a long winding path — enemies must walk around them
  • Socket artillery + energy runes — artillery defines the weapon, energy provides the damage
  • Combine energy runes for multi-element damage (fire + ice = steam)
  • Stack mod runes for powerful combos (3x Swift = extreme fire rate)
  • Fuse 3 identical runes to upgrade their tier — T5 Absolu runes are extremely powerful
  • Use Soin runes on front-line towers to keep them alive
  • Watch for Thief enemies — they steal runes from your best towers
  • Protect your most equipped towers from Cursed enemies
  • Repair damaged towers (R) before they get destroyed — rebuilding is more expensive
  • Sell and reposition towers as waves change composition
  • Undo (Z) gives you 3 seconds to reconsider a tower placement
  • Boss T3+ splits into mini-bosses at low HP — save burst damage for the finish
  • Wizard T5 drains tower HP — prioritize killing high-tier wizards early

A* Pathfinding

The game uses the A* search algorithm to find optimal paths from spawn points to exits. The grid-based implementation uses:

  • Manhattan distance as the heuristic function (4-directional movement)
  • Binary heap priority queue for O(log n) open set operations
  • Dynamic recalculation when towers are placed or sold

Before allowing tower placement, the system tests whether blocking that cell would cut off all valid paths. This prevents the player from creating impossible situations.

Damage Types & Resistances

Five elemental damage types interact with enemy resistances via multipliers:

TypeStrong AgainstWeak Against
PhysicalScoutsTanks, Bosses
FireGeneralTanks
IceTanks—
EnergySoldiersTanks
PoisonHealersBosses

Resistance values below 1.0 reduce damage, above 1.0 increase it. Multiple energy runes combine their elemental profiles — a tower with both Fire and Ice runes deals both types.

Tower Targeting

Each tower uses one of five targeting strategies:

  • First: Enemy furthest along the path (highest threat)
  • Last: Enemy closest to spawn (lowest threat)
  • Strongest: Enemy with the most HP remaining
  • Weakest: Enemy with the least HP remaining
  • Nearest: Enemy closest to the tower

Materia — Stat Pipeline

Each tower computes its stats from its socketed runes in a deterministic pipeline:

  1. Categorize runes by type (artillery, energy, mod, special, cosmetic)
  2. Weapons: Each artillery rune creates an independent weapon with its own cooldown and stats
  3. Energy: All energy runes merge into a weighted damage profile applied to every weapon
  4. Mods: Additive mods stack linearly (e.g., 3× Range = +2.4 cells). Multiplicative mods compose (e.g., 3× Swift = 0.85³ fire rate)
  5. Specials: Soin adds HP regeneration, Override adds periodic burst fire
  6. Base modifier: Fire rate modifier and range bonus from the chassis type are applied last
  7. Cache: Stats are recalculated only when runes change (socket/remove/curse)

Cursed runes have their effects inverted (bonuses become penalties).

Wave Scaling

Enemy HP scales with wave number: +15% per wave. Gold rewards also scale at +5% per wave. Boss encounters occur every 5 waves with increasingly dangerous escort compositions.

Wave Themes (5-wave cycle)

Wave % 5ThemeComposition
0BossBoss + tanks + healers
1SwarmScouts + runners + thieves
2AssaultSoldiers + tanks + bombers + cursed
3Tank PushTanks + healers + runners
4MixedAll unlocked enemy types

Scoring

  • Kill reward: base gold × (1 + wave × 0.05)
  • Wave bonus: 25 + (wave × 10) gold
  • Final score: (waves × 100) + total gold earned + (lives × 50)
© 2013 - 2026 Cylian 🤖 Claude
Instructions Claude

Prompt utilisé pour régénérer cette page :

Page: Materia - Tower Defense with Rune Crafting
Title: "Tower Defense"
Description: "Strategic tower defense with A* pathfinding, elemental damage types, and upgrade trees"
Icon: castle
Tags: strategy, pathfinding, game
Status: new
Category: games
Front matter: no js/scss keys (uses default convention)

HTML structure in index.md:
  <section class="container visual size-800 ratio-1-1 canvas-contain">
    <!-- War view -->
    <div class="td-view td-view-war is-active">
      <canvas id="td-canvas"></canvas>
    </div>
    <!-- Shop view (display:none) -->
    <div class="td-view td-view-shop" style="display:none">
      div.td-shop-header (h4 "Shop" + span.td-shop-gold "0g")
      div.td-shop-modal-grid#td-shop-grid (populated by JS)
    </div>
    <!-- Craft view (display:none) -->
    <div class="td-view td-view-craft" style="display:none">
      div.td-craft-modal-header (h4 "Craft")
      div.td-craft-slots: 3 slots (A + B = C pattern)
        <button data-craft-slot="a" class="td-rune">A</button>
        <span class="td-craft-plus">+</span>
        <button data-craft-slot="b" class="td-rune">B</button>
        <span class="td-craft-plus">=</span>
        <button data-craft-slot="c" class="td-rune">C</button>
      div.td-craft-actions:
        <button data-craft-action="fuse" class="td-action-btn" disabled>Fuse (3->1)</button>
        <button data-craft-action="craft" class="td-action-btn" disabled>Craft (2->1)</button>
        <button data-craft-action="autofuse" class="td-action-btn">Auto-Fuse</button>
      div.td-craft-result (display:none)
      h5 "Inventory" + span.td-craft-inv-count.td-inv-count "0/64"
      div.td-craft-modal-inv-grid#td-craft-inv-grid (populated by JS)
  </section>

Widget files:
  _nav.before.md (weight: 10, title: "Navigation", _build: render: never):
    nav.td-nav[role="tablist"] with 3 tab buttons:
      <button class="td-nav-tab is-active" data-view="war">War</button>
      <button class="td-nav-tab" data-view="shop">Shop</button>
      <button class="td-nav-tab" data-view="craft">Craft</button>

  _controls.right.md (weight: 20, title: "Controls"):
    div.td-controls[role="group"]:
      <button id="btn-play" class="item button is-play"> {{< icon name="play" >}}
      <button id="btn-pause" class="item button is-pause"> {{< icon name="pause" >}}
      <button id="btn-reset" class="item button"> {{< icon name="refresh" >}}
      <button id="btn-next-wave" class="item button" title="Skip to next wave (N)"> {{< icon name="chevron-double-right" >}}
      <select id="td-speed">: 1x, 2x, 3x
      <select id="td-mode">: Baby, Easy, Normal (selected), Hard, Nightmare, Endless
      <select id="td-map">: Valley, Crossroads, Fortress, Maze, Islands, Arena

    div.td-tower-select[role="group"]:
      ##### Bases
      3 base type buttons (data-base="light/medium/heavy"):
        Light: 40g, 3 slots, hotkey 1
        Medium: 90g, 4 slots, hotkey 2
        Heavy: 160g, 5 slots, hotkey 3
      Each: <kbd class="td-hotkey">{N}</kbd> + .td-tower-icon.{type} + name + .td-cost + .td-slots

    div.td-inventory#td-inventory:
      ##### Inventory <span id="td-inv-count" class="td-inv-count">0/64</span>
      div#td-inv-grid.td-inv-grid (populated by JS)

  _info.right.md (weight: 30, title: "Tower Info"):
    div.td-info#td-info (display:none initially):
      ##### Selected Tower
      <dl> with 6 dt/dd pairs: Base (#info-type), HP (#info-hp), Weapons (#info-weapons),
        DPS (#info-dps), Kills (#info-kills), Targeting (#info-targeting, default "First")
      div.td-rune-slots#td-rune-slots: h6 "Rune Slots" + div#rune-slot-list.td-slot-grid
      div.td-info-actions:
        <button id="btn-repair" class="td-action-btn" style="display:none">Repair (<span id="info-repair-cost">-</span>g)</button>
        <button id="btn-sell" class="td-action-btn sell">Sell (<span id="info-sell-value">-</span>g)</button>

  _help.after.md (title): Help section explaining gameplay
  _algorithm.after.md (title): Algorithm explanation (A* pathfinding, tower mechanics)

Architecture (18 JS modules + SCSS):
  default.js — Game orchestrator (IIFE, ES module imports):
    Imports: panic, Pathfinding, { GameMap, MAPS, CELL }, { TowerFactory, BASE_TYPES },
      { RuneFactory }, Inventory, Shop, { EnemyFactory, ENEMY_TYPES }, Obstacle,
      Projectile, EffectPool, WaveManager/{ GAME_MODES }, WeatherManager,
      AchievementManager, { cachedColors, cacheColors, getBaseColor, getWidth, getHeight, render },
      { setupControls, selectTowerType, updateInfoPanel, updateTowerButtons,
      updateControlState, updateShopPanel, updateInventoryPanel, switchView },
      Entity, Craft

    CONFIG: gridWidth=20, gridHeight=20, canvasWidth=800, canvasHeight=800,
      startingGold=200, startingLives=20, respiteDelay=5
    Game modes: NORMAL, BOSS, ENDLESS
    Core loop: requestAnimationFrame-based with: updateEnemies -> updateTowers -> updateProjectiles -> updateEffects -> updateWeather -> render

  _pathfinding.lib.js: A* pathfinding on grid, path caching, obstacle-aware
  _map.lib.js: GameMap class, MAPS registry (valley/crossroads/fortress/maze/islands/arena), CELL enum (EMPTY/PATH/TOWER/SPAWN/BASE/OBSTACLE)
  _tower.lib.js: TowerFactory + BASE_TYPES (light/medium/heavy with different HP, cost, rune slot counts)
  _rune.lib.js: RuneFactory, rune system for tower augmentation (elements, damage modifiers)
  _inventory.lib.js: Inventory management (64 slots max)
  _shop.lib.js: Shop system for purchasing towers/runes with gold
  _enemy.lib.js: EnemyFactory + ENEMY_TYPES, movement along path, HP, armor, speed, rewards
  _obstacle.lib.js: Obstacle class + EnemyTurret (enemy-placed obstacles that attack towers)
  _projectile.lib.js: Projectile class (tracking, AoE, damage types)
  _effect.lib.js: EffectPool for visual effects (explosions, hits, buffs, pooled for performance)
  _wave.lib.js: WaveManager + GAME_MODES (baby/easy/normal/hard/nightmare/endless), wave composition, escalation
  _weather.lib.js: WeatherManager, environmental effects on gameplay (affects tower/enemy stats)
  _achievement.lib.js: AchievementManager, milestone tracking
  _renderer.lib.js: Canvas rendering — cachedColors, cacheColors(), getBaseColor(), getWidth/getHeight(), render() (grid, path, towers with rune indicators, enemies, projectiles, effects, weather overlay)
  _input.lib.js: Input handling — setupControls(), selectTowerType(), updateInfoPanel(), updateTowerButtons(), updateControlState(), updateShopPanel(), updateInventoryPanel(), switchView() (war/shop/craft)
  _entity.lib.js: Base entity class shared by towers/enemies/projectiles
  _craft.lib.js: Crafting system — fuse (3 same runes -> 1 higher tier), craft (2 different runes -> 1 combined), auto-fuse

default.scss: Game-specific styles with .td-* prefix
  View system: .td-view with display toggling via switchView()
  Nav tabs: .td-nav with .td-nav-tab, .is-active
  Controls: .td-controls flex row, button/select styling
  Tower select: .td-tower-select with .td-tower-btn (hotkey + icon + name + cost + slots)
  Inventory: .td-inv-grid CSS grid, rune slot coloring
  Info panel: .td-info with <dl> grid, rune slots display, action buttons (repair/sell)
  Shop: .td-shop-modal-grid layout
  Craft: .td-craft-slots (A+B=C layout), action buttons, result display
  Canvas: td-canvas full size within container

Important implementation notes:
  - All lib files are ES modules with named exports
  - Canvas 800x800 with DPR scaling
  - Grid: 20x20, cell size = 40px
  - A* pathfinding recalculated when towers placed/removed
  - 3 views (war/shop/craft) toggled by switchView() — unlike grimoire which has 4 views
  - Tower bases: light (40g, 3 rune slots), medium (90g, 4 slots), heavy (160g, 5 slots)
  - Rune system: runes inserted into tower base slots for elemental/damage augmentation
  - Craft: fuse 3 same -> 1 higher tier, craft 2 different -> 1 combined, auto-fuse convenience
  - Inventory: 64 slots max (vs grimoire's 32)
  - Weather system affects gameplay (unique to materia, not in grimoire)
  - Enemy turrets (obstacle.lib.js) can attack towers (unique to materia)
  - Keyboard hotkeys: 1/2/3 for tower base selection, N for next wave
  - Starting gold: 200g, starting lives: 20
  - 6 maps, 6 difficulty modes (same as grimoire)
  - Complex HTML in index.md (craft slots A+B=C not generated by JS)
  - Uses /_lib/panic_v3.js for logging

Page entièrement générée et maintenue par IA, sans intervention humaine.