Back to Game
Storm Gate Defenders - Game Design Guide
Game Concept
# Storm Gate Defenders
## Theme
You are the keeper of a Storm Gate - an ancient portal that channels wild elemental energy through the Ley Lines of a shattered world. Creatures of corruption are drawn to the Gate's power, seeking to infect it. Your role is to place elemental Conduits along the Ley Lines to redirect, transform, and destroy the corruption before it reaches the Gate. The theme is stormy, electrical, and dramatic - with lightning, crackling energy, and the constant threat of overwhelming darkness.
## Visual Game World
The Canvas shows a top-down view of the Storm Gate at the center, pulsing with electrical energy. Ley Lines (gluing pathways) radiate outward from the gate like lightning bolts frozen in time - jagged, branching paths that enemies follow toward the center. The background is dark and stormy with animated rain particles and occasional lightning flashes illuminating the battlefield. Enemies (corruption creatures) spawn from the edges and travel along the Ley Lines toward the Gate. Conduits (your towers) crackle with elemental effects as they fire. When enemies die, they burst into energy particles that flow along the Ley Lines back toward your Gate, visibly transferring their power to you.
## Player Interaction
The player interacts directly with the Canvas through spatial decisions:
1. **Click on Ley Line junctions** to place Conduits - these are specific intersection points where you can build
2. **Click on placed Conduits** to select them, then click upgrade options or drag to reposition them (with cost)
3. **Click on the Storm Gate** to activate Overload mode - a powerful AOE attack that consumes stored energy
4. **Click on approaching enemies** to trigger targeted lightning strikes (manual skill shot with cooldown)
5. **Drag between adjacent Conduits** to create Link connections - enemies crossing a linked path take bonus damage
## Entity Types
### Conduit (Basic Tower)
- **Sprite**: ProceduralSprite circle with glow effect, colored by element type (blue/air, orange/fire, green/earth, purple/void)
- **Appearance**: Glowing orb on a stone base, with electrical arcs reaching toward nearby Ley Lines
- **Behavior**: Fires elemental projectiles at enemies in range along Ley Lines
- **Interaction**: Player clicks to place on junction points, click to upgrade, drag to reposition for strategic coverage
### Corruption Spawn (Basic Enemy)
- **Sprite**: Slime with dark coloration and red glow variant
- **Appearance**: Dark blob leaving a trail of corruption, pulsing with sickly red energy
- **Behavior**: Moves steadily along Ley Lines toward the Storm Gate, speeding up as it takes damage (desperation)
- **Interaction**: Target of player abilities and Conduit attacks, drops visible energy particles on death
### Storm Wraith (Fast Enemy)
- **Sprite**: Ghost with lightning color variant
- **Appearance**: Translucent, crackling figure that moves in jagged bursts rather than smoothly
- **Behavior**: Teleports short distances forward periodically, making range-based towers less effective
- **Interaction**: Requires predictive placement and timing from player
### Corruption Titan (Boss Enemy)
- **Sprite**: Knight with dark coloration and larger scale
- **Appearance**: Massive armored figure with glowing corruption veins, slowly plowing forward
- **Behavior**: Absorbs significant damage, spawns smaller Corruption Spawns when hit
- **Interaction**: Requires concentrated fire from multiple Conduits, high priority target for player abilities
### Energy Orb (Resource Entity)
- **Sprite**: ProceduralSprite diamond with bright yellow/white glow
- **Appearance**: Small glowing particles spawned from enemy deaths, traveling along Ley Lines to the Gate
- **Behavior**: Spawns at enemy death location, floats along nearest Ley Line to Gate, disappears on arrival
- **Interaction**: Visual feedback of resource generation, player sees exact income sources
### Overload Field (AOE Effect)
- **Sprite**: ProceduralSprite circle with expanding animation
- **Appearance**: Expanding ring of electrical energy from the Storm Gate
- **Behavior**: Damages all enemies in range, temporarily boosts Conduit damage
- **Interaction**: Player-triggered ability via Gate click, visible area indicator shows coverage
## Core Loop
### Second-to-Second (ACTIVE GAMEPLAY)
- Player watches enemies spawn and travel along Ley Lines toward the central Gate
- Player identifies gaps in coverage and quickly places new Conduits at strategic junction points
- Player clicks individual enemies to zap them with precision lightning strikes (skill shots)
- Player drags between Conduits to create damage-dealing Links across enemy paths
- Player monitors energy levels and decides when to activate Gate Overload for maximum effect
### Minute-to-Minute (STRATEGIC DECISIONS)
- Between waves, player repositions Conduits to optimize coverage against new enemy types
- Player upgrades Conduits to specialize them (range, damage, or special effects)
- Player checks energy reserves and decides which element specialization to unlock next
- Player views upcoming wave composition and adjusts Conduit element types for effectiveness
### Session-Level (META STRATEGY)
- Player pursues a specific elemental build (air/fire/earth/void) that changes how Conduits function
- Player decides between spreading Conduits wide for coverage vs. concentrating for power
- The visual complexity increases as more Conduits, Links, and energy effects fill the screen
- Player works toward accumulating enough energy to unlock the final Gate ability
## The 30-Second Gameplay Description
A wave of dark Corruption Spawns slithers along the glowing blue Ley Line from the top-left corner of the screen. Your three Conduits pulse with electricity as they fire orange projectiles. You notice a gap in your coverage on the left branch - quickly click the empty junction point and place a new air Conduit that materializes with a crackle. A Storm Wraith teleports past your outer defenses, so you click it directly to unleash a precision lightning bolt that disintegrates it into sparkling particles. The particles flow like a stream along the Ley Line back to your central Gate, which pulses brighter as it absorbs the energy. You drag between two adjacent Conduits to create a glowing Link arc just as a Corruption Titan plods into view, and the combined fire tears chunks of its health away before it can reach your Gate.
## Currencies
### Energy (Primary Currency)
- **Role**: Primary currency for building and upgrading
- **Earned by**: Enemies drop visible Energy Orbs on death that flow along Ley Lines to the Gate; player sees every source of income visually
- **Spent on**: Placing new Conduits, upgrading existing ones, repositioning Conduits
- **Feel**: The immediate reward feedback loop - kills directly create visible energy flow
### Charge (Secondary Currency)
- **Role**: Ability resource built through skillful play
- **Earned by**: Creating Links between Conduits, killing enemies with precision lightning strikes, and timing Gate Overload to hit multiple enemies
- **Spent on**: Activating Gate Overload AOE attack, unlocking elemental specializations
- **Feel**: Rewards skilled play and active engagement over passive clicking
### Resonance (Prestige Currency)
- **Role**: Long-term progression currency
- **Earned by**: Completing waves without taking Gate damage (no enemies reach center) and surviving corruption overflow events
- **Spent on**: Permanent elemental mastery bonuses that change Conduit behavior
- **Feel**: The mastery currency that rewards truly skilled defense
### Corruption (Enemy Health/Threat Meter)
- **Role**: Inverse currency representing enemy strength
- **Grows by**: Enemy spawns, wave completion bonuses, enemies that reach the Gate
- **Reduces by**: Using Energy to purify the Ley Lines (gradual reduction)
- **Feel**: The pressure mechanic - higher corruption means stronger enemies spawn
### Currency Flow
Energy builds Conduits and upgrades → Conduits kill enemies → Enemies drop Charge → Charge powers abilities → Abilities kill more enemies → More Energy. Resonance comes from skilled play (no gate damage) and unlocks permanent bonuses. Corruption is the threat that escalates if not managed through Energy expenditure.
## Progression Hooks
### Early Game (0-5 minutes)
- The first "aha" moment is placing your first Conduit and watching it fire at an approaching enemy - the visual feedback is immediate and satisfying
- Canvas interaction is immediately available: click junction points to place Conduits, click enemies to zap them
- First unlock is the second element type, showing that Conduits can have different effects
### Mid Game (5-15 minutes)
- Link mechanic unlocks: drag between Conduits to create damage arcs across enemy paths
- New enemy types (Storm Wraiths with teleport, Titans with spawn ability) force strategic adaptation
- Elemental specialization: choosing air (range), fire (damage), earth (slow), or void (corruption damage)
### Late Game (15-30 minutes)
- Multiple Ley Lines active simultaneously with complex branching paths
- Gate Overload ability unlocks powerful AOE attacks
- Corruption overflow events: massive waves with special boss enemies
- Visual complexity peaks with dozens of Conduits, Links, and particle effects filling the screen
### Key Milestones
1. Place first Conduit - see projectile fire and hit enemy
2. Kill first enemy - watch Energy Orbs flow back to Gate
3. Complete first wave without Gate damage - earn Resonance bonus
4. Unlock second element type - Conduits can now specialize
5. Create first Link between Conduits - enemies crossing take massive damage
6. Survive first Storm Wraith wave - adapt to teleporting enemies
7. Activate first Gate Overload - devastating AOE clears wave
8. Choose elemental specialization path - commitment to a playstyle
9. Face first Corruption Titan - boss enemy with spawn mechanics
10. Reach corruption threshold for overflow event - climactic final challenge
## Meaningful Choices
- **Choice 1: Element Specialization**
- **Options**: Air (extended range, lower damage), Fire (high damage, short range), Earth (slows enemies, moderate damage), Void (bonus damage vs. corruption, reduces enemy power)
- **Tradeoff**: Each element creates a different playstyle visible on Canvas - air creates a perimeter of distant towers, fire concentrates damage, earth creates kill zones, void directly weakens enemies
- **Visual Impact**: Different colored projectiles, different particle effects, different optimal placement patterns
- **Choice 2: Spread vs. Concentrate Defense**
- **Options**: Spread Conduits across all junction points for broad coverage vs. concentrate them in overlapping kill zones
- **Tradeoff**: Spread covers all paths but has weak points; concentrate creates devastating kill zones but leaves some paths exposed
- **Visual Impact**: Spread shows projectiles crisscrossing everywhere; concentrate shows intense localized battles
- **Choice 3: Link Strategy**
- **Options**: Create many short Links between adjacent Conduits vs. fewer long Links that require precise placement
- **Tradeoff**: Short Links are easier to maintain but less damaging; long Links are devastating but break if one Conduit is damaged
- **Visual Impact**: Short Links create a web of glowing arcs; long Links create dramatic electrical bridges across the battlefield
## Prestige Concept
- **Trigger**: After surviving a Corruption Overflow event (massive boss wave at 25-30 minutes) or by voluntarily resetting after earning sufficient Resonance
- **What resets**: All Conduits removed, Energy and Charge reset to zero, corruption level reset
- **What persists**: Resonance currency, elemental mastery levels (permanent bonuses to chosen element), Ley Line layout upgrades (additional junction points become available)
- **Prestige currency**: Resonance, earned through skilled play (no Gate damage) and overflow survival
- **Acceleration**: Run 2 starts with one pre-placed legendary Conduit of your chosen element, 20% increased Energy gain, and immediately unlock Links. The Ley Lines have more junction points available from the start, allowing more complex placement strategies immediately.
- **Visual transformation**: After prestige, the Storm Gate gains permanent elemental visual effects matching your mastery (lightning crackles for air, flames for fire, etc.). The background becomes more dramatic - more intense storms, more frequent lightning. Conduits of your mastered element have special visual flair and enhanced animations.
## Controls Display
- **Left Click on Junction → Place Conduit** (costs Energy)
- **Left Click on Enemy → Precision Lightning Strike** (costs Charge, has cooldown)
- **Drag Between Conduits → Create Damage Link** (costs Charge)
- **Click Storm Gate → Activate Overload** (costs Charge, AOE damage)
- **Right Click Conduit → Reposition/Sell** (partial Energy refund)
## Getting Started Tutorial
• Click on the glowing junction points along the Ley Lines to place Conduits
• Corruption creatures are coming to infect your Storm Gate - stop them by destroying all enemies
• Kill enemies to earn Energy, use it to build more Conduits and upgrade your defenses
• Don't let any enemies reach the center Gate - perfect defense earns bonus Resonance for permanent upgrades
## Unique Selling Point
The Ley Line placement system combined with the Link mechanic creates tower defense where positioning is everything - you're not just placing towers, you're creating an interconnected electrical network where the connections between towers matter as much as the towers themselves. Enemies aren't just blocked by damage - they're intercepted by the arcs you create between your defenses, making player-created pathways the central strategic element.
## Visual Direction
Color palette: Dark blue and purple background (#1a1a2e, #16213e), bright blue glowing Ley Lines (#00d4ff), orange/yellow electrical effects (#ffd700, #ff6b35). The mood is stormy and dramatic with animated rain particles, periodic lightning flashes that illuminate the whole battlefield, and constant electrical crackling effects. Conduits pulse with their elemental colors when firing. Enemy deaths produce bright particle explosions that visibly travel along Ley Lines back to the center. The Gate is a constant visual anchor - the bright, glowing center that everything revolves around.
## Technical Scope Check
- Canvas rendering with 5-6 sprite types using SpriteData and ProceduralSprite - ✓ feasible
- Pathfinding along pre-defined Ley Line routes - ✓ simple, no complex algorithms needed
- Projectile system with elemental variants - ✓ straightforward particle effects
- Energy orb particle system flowing along paths - ✓ achievable with basic vector math
- Wave spawning system with enemy types - ✓ standard tower defense pattern
- Currency system with 4 interconnected currencies - ✓ standard incremental game systems
- Prestige system with persistent bonuses - ✓ standard save/load functionality
- Link mechanic between placed entities - ✓ requires distance checking and line drawing
Complexity flag: The Link mechanic requires O(n²) distance checks between Conduits but with reasonable Conduit limits (20-30 max) this is negligible. The particle systems should be capped at 100-200 active particles to maintain performance.
Currencies
{
"gameId": "Game-1771146744592-gl4u",
"jobId": 68,
"section": "currencies",
"currencies": {
"energy": {
"displayName": "Energy",
"icon": "⚡",
"startingAmount": 50,
"cap": null,
"decimals": 0,
"suffixes": [
"",
"K",
"M",
"B",
"T"
],
"color": "#FFD700",
"role": "primary"
},
"charge": {
"displayName": "Charge",
"icon": "⚡",
"startingAmount": 10,
"cap": 100,
"decimals": 0,
"suffixes": [],
"color": "#00D4FF",
"role": "ability"
},
"resonance": {
"displayName": "Resonance",
"icon": "✨",
"startingAmount": 0,
"cap": null,
"decimals": 0,
"suffixes": [
"",
"K",
"M"
],
"color": "#9B59B6",
"role": "prestige",
"persistsOnPrestige": true
},
"corruption": {
"displayName": "Corruption",
"icon": "☠️",
"startingAmount": 0,
"cap": 100,
"decimals": 0,
"suffixes": [],
"color": "#E74C3C",
"role": "threat"
}
},
"currencySources": {
"enemyKill": {
"currency": "energy",
"formula": "baseKillReward * (1 + waveMultiplier * waveNumber)",
"baseKillReward": 5,
"waveMultiplier": 0.15
},
"waveComplete": {
"currency": "energy",
"formula": "waveBonus * waveNumber",
"waveBonus": 25
},
"bossKill": {
"currency": "energy",
"formula": "bossReward * bossLevel",
"bossReward": 100
},
"bossKillResonance": {
"currency": "resonance",
"formula": "bossLevel * 2"
},
"passiveEnergy": {
"currency": "energy",
"formula": "conduitCount * conduitLevel * passiveRate",
"passiveRate": 1
},
"perfectWave": {
"currency": "resonance",
"formula": "waveNumber"
},
"precisionZapKill": {
"currency": "charge",
"formula": "zapReward",
"zapReward": 3
},
"linkCreated": {
"currency": "charge",
"formula": "linkReward",
"linkReward": 5
},
"overloadHit": {
"currency": "charge",
"formula": "overloadReward",
"overloadReward": 1
},
"perfectWaveCharge": {
"currency": "charge",
"formula": "perfectChargeBonus",
"perfectChargeBonus": 15
},
"overflowSurvived": {
"currency": "resonance",
"formula": "overflowBaseReward * (1 + overflowCount * 0.5)",
"overflowBaseReward": 10
},
"firstPrestigeBonus": {
"currency": "resonance",
"formula": "10",
"once": true
}
},
"corruptionSources": {
"enemySpawn": {
"amount": 0.5
},
"waveComplete": {
"amount": 5
},
"enemyReachedGate": {
"amount": 15
},
"overloadMissed": {
"amount": 5,
"condition": "overloadHits < 3"
}
},
"corruptionThresholds": {
"wraith": {
"level": 50,
"effects": [
"+20% enemy HP",
"enable wraith spawns"
]
},
"titan": {
"level": 75,
"effects": [
"+50% enemy HP",
"enable titan spawns"
]
},
"overflow": {
"level": 100,
"effects": [
"trigger overflow boss wave",
"reset corruption to 0"
]
}
},
"collectibles": {
"energyOrb": {
"sprite": "diamond",
"color": "#FFD700",
"scale": 0.8,
"lifetime": 8,
"glow": true,
"spawnAnimation": "popIn",
"spawnDuration": 200,
"movement": "leyLineFlow",
"speed": 150,
"collectOnGate": true
},
"chargeSpark": {
"sprite": "spark",
"color": "#00D4FF",
"scale": 0.5,
"lifetime": 3,
"glow": true,
"spawnAnimation": "burst",
"spawnDuration": 150,
"movement": "float",
"collectRadius": 0
},
"resonanceCrystal": {
"sprite": "diamond",
"color": "#9B59B6",
"scale": 2,
"lifetime": 10,
"glow": true,
"spawnAnimation": "dramaticPop",
"spawnDuration": 400,
"rotation": true,
"rotationSpeed": 1,
"movement": "floatCenter",
"collectRadius": 40,
"autoCollectDelay": 5000
}
},
"upgradeCosts": {
"conduitPlacement": {
"baseCost": 25,
"costIncrement": 5,
"currency": "energy",
"maxCost": 175
},
"conduitDamage": {
"baseCost": 15,
"costMultiplier": 1.2,
"currency": "energy",
"maxLevel": 10,
"effect": "+10% damage per level"
},
"conduitRange": {
"baseCost": 20,
"costMultiplier": 1.2,
"currency": "energy",
"maxLevel": 8,
"effect": "+10% range per level"
},
"conduitSpeed": {
"baseCost": 25,
"costMultiplier": 1.25,
"currency": "energy",
"maxLevel": 5,
"effect": "+15% fire rate per level"
}
},
"abilityCosts": {
"precisionZap": {
"cost": {
"currency": "charge",
"amount": 5
},
"cooldown": 3000,
"damage": 50
},
"createLink": {
"cost": {
"currency": "charge",
"amount": 15
},
"maxLinks": 10,
"costIncrement": 2
},
"gateOverload": {
"cost": {
"currency": "charge",
"amount": 50
},
"cooldown": 30000,
"damage": 100,
"radius": 150
}
},
"elementalSpec": {
"fire": {
"name": "Fire (Destruction)",
"cost": {
"currency": "charge",
"amount": 25
},
"effects": [
"+50% damage",
"-20% range",
"projectiles: orange"
]
},
"air": {
"name": "Air (Reach)",
"cost": {
"currency": "charge",
"amount": 25
},
"effects": [
"+40% range",
"-15% damage",
"projectiles: blue"
]
},
"earth": {
"name": "Earth (Control)",
"cost": {
"currency": "charge",
"amount": 25
},
"effects": [
"+30% slow on hit",
"projectiles: green"
]
},
"void": {
"name": "Void (Purify)",
"cost": {
"currency": "charge",
"amount": 40
},
"effects": [
"-20% enemy power",
"projectiles: purple"
]
}
},
"prestigeUpgrades": {
"elementalMastery": {
"currency": "resonance",
"levels": [
{
"level": 1,
"cost": 1,
"effect": "+10% chosen element damage"
},
{
"level": 2,
"cost": 2,
"effect": "+20% chosen element damage"
},
{
"level": 3,
"cost": 4,
"effect": "+35% chosen element damage"
},
{
"level": 4,
"cost": 6,
"effect": "+50% chosen element damage"
},
{
"level": 5,
"cost": 10,
"effect": "+75% chosen element damage, unlock legendary conduit"
}
]
},
"leyLineExpansion": {
"currency": "resonance",
"cost": 5,
"effect": "+2 junction points per Ley Line",
"maxPurchases": 5
},
"energyAffinity": {
"currency": "resonance",
"levels": [
{
"level": 1,
"cost": 3,
"effect": "+10% Energy gain"
},
{
"level": 2,
"cost": 5,
"effect": "+20% Energy gain"
},
{
"level": 3,
"cost": 8,
"effect": "+35% Energy gain"
}
]
}
},
"conversions": {
"energyPurge": {
"input": {
"currency": "energy",
"amount": 100
},
"output": {
"currency": "charge",
"amount": 10
},
"unlockWave": 3,
"cooldown": 60000,
"condition": "energy > 200"
},
"overcharge": {
"input": {
"currency": "charge",
"amount": 80
},
"output": {
"currency": "resonance",
"amount": 1
},
"unlockWave": 5,
"setsChargeTo": 20
},
"leyPurification": {
"input": {
"currency": "energy",
"amount": 50
},
"output": {
"currency": "corruption",
"amount": -10
},
"alwaysAvailable": true
}
},
"balanceTargets": [
{
"time": "0:00",
"energy": 50,
"charge": 10,
"resonance": 0,
"corruption": 0,
"event": "Game start"
},
{
"time": "0:15",
"energy": 25,
"charge": 10,
"resonance": 0,
"corruption": 0,
"event": "First Conduit placed"
},
{
"time": "0:45",
"energy": 15,
"charge": 13,
"resonance": 0,
"corruption": 5,
"event": "First wave complete"
},
{
"time": "1:30",
"energy": 60,
"charge": 18,
"resonance": 1,
"corruption": 0,
"event": "First perfect wave"
},
{
"time": "3:00",
"energy": 200,
"charge": 35,
"resonance": 3,
"corruption": 15,
"event": "Link unlock affordable"
},
{
"time": "5:00",
"energy": 500,
"charge": 60,
"resonance": 8,
"corruption": 20,
"event": "First Overload"
},
{
"time": "8:00",
"energy": 1000,
"charge": 80,
"resonance": 15,
"corruption": 30,
"event": "First mastery purchase"
},
{
"time": "12:00",
"energy": 2500,
"charge": 100,
"resonance": 25,
"corruption": 50,
"event": "Wraith threshold reached"
},
{
"time": "18:00",
"energy": 8000,
"charge": 100,
"resonance": 40,
"corruption": 75,
"event": "Titan threshold reached"
},
{
"time": "25:00",
"energy": 50000,
"charge": 100,
"resonance": 80,
"corruption": 100,
"event": "Corruption Overflow event"
}
],
"exactFormulas": {
"conduitPlacement": "min(25 + (existingConduits * 5), 175)",
"conduitUpgrade": "baseCost * costMultiplier^level",
"enemyKill": "5 * (1 + 0.15 * waveNumber)",
"waveComplete": "25 * waveNumber",
"bossKill": "100 * bossLevel",
"passiveGeneration": "conduitCount * conduitLevel * 1",
"precisionZapCost": 5,
"linkCost": "15 + (activeLinks * 2)",
"gateOverloadCost": 50,
"perfectWaveResonance": "waveNumber",
"overflowSurvival": "10 * (1 + overflowCount * 0.5)"
}
}
Currencies
# Storm Gate Defenders - Currency System Design
## Economy Flow Diagram
```mermaid
flowchart LR
subgraph "Sources (Gameplay Actions)"
EK["Enemy Killed\n+baseKillReward * waveMult"]
WK["Wave Complete\n+waveBonus * waveNum"]
BK["Boss Killed\n+bossReward * bossLevel"]
ZK["Precision Zap\n+chargeReward on skillshot"]
LG["Link Created\n+chargeReward per link"]
GO["Gate Overload Hit\n+chargeReward per enemy hit"]
end
subgraph "Sources (Passive/Auto)"
EA["Energy Absorption\n+1 Energy/sec per Conduit"]
end
subgraph "Currencies"
Energy((Energy\nPrimary\nstart: 50\nuncapped\nbuilding currency))
Charge((Charge\nAbility\nstart: 10\nmax: 100\nskill currency))
Resonance((Resonance\nPrestige\nstart: 0\nuncapped\nmastery currency))
Corruption((Corruption\nThreat\nstart: 0\nmax: 100\ninverse meter))
end
subgraph "Sinks"
PC["Place Conduit\ncost: 25-100 Energy"]
UC["Upgrade Conduit\ncost: base * 1.2^level"]
RC["Reposition Conduit\ncost: 10 Energy (50% refund)"]
PZ["Precision Zap\ncost: 5 Charge\n3s cooldown"]
CL["Create Link\ncost: 15 Charge"]
GOA["Gate Overload\ncost: 50 Charge\n30s cooldown"]
ES["Elemental Spec\ncost: 25-100 Charge"]
PR["Purify Ley Lines\ncost: 50 Energy\n-10 Corruption"]
EM["Elemental Mastery\ncost: 1-10 Resonance"]
end
EK --> Energy
WK --> Energy
BK --> Energy
BK --> Resonance
EA --> Energy
Energy --> PC
Energy --> UC
Energy --> RC
Energy --> PR
PR -.->|"Reduces"| Corruption
ZK --> Charge
LG --> Charge
GO --> Charge
Charge --> PZ
Charge --> CL
Charge --> GOA
Charge --> ES
Resonance --> EM
Corruption -.->|"Increases spawn rate"|"Enemies Stronger"
```
## Currency Definitions Diagrams
### Energy
```mermaid
graph TD
subgraph "Energy [Primary Currency]"
E_display["Display: ⚡ Energy\n0 decimals\nSuffixes: K/M/B"]
E_earn["Earning:\nEnemy killed: +5 * (1 + 0.15 * waveNum)\nWave complete: +25 * waveNum\nBoss killed: +100 * bossLevel\nPassive: +1/sec per Conduit level"]
E_spend["Spending:\nPlace Conduit: 25-100 Energy\nUpgrade Conduit: base * 1.2^level\nReposition: 10 Energy (50% refund)\nPurify Ley Lines: 50 Energy"]
E_inflation["Inflation Control:\nExponential upgrade costs (1.2^level)\nWave difficulty increases\nConduit costs scale with count\nPrestige reset"]
end
```
### Charge
```mermaid
graph TD
subgraph "Charge [Ability Currency]"
C_display["Display: ⚡ Charge\nCurrent / Max (100)"]
C_earn["Earning:\nPrecision Zap kill: +3 Charge\nLink created: +5 Charge\nGate Overload hits: +1 per enemy\nWave perfect clear: +15 Charge"]
C_spend["Spending:\nPrecision Zap: 5 Charge\nCreate Link: 15 Charge\nGate Overload: 50 Charge\nElemental Spec unlock: 25-100 Charge"]
C_inflation["Inflation Control:\nHard cap of 100\nCooldowns on abilities prevent spam\nLink cost increases with Links active"]
end
```
### Resonance
```mermaid
graph TD
subgraph "Resonance [Prestige Currency]"
R_display["Display: ✨ Resonance\n0 decimals\nPersists on prestige"]
R_earn["Earning:\nPerfect wave (no gate damage): +1 * waveNum\nCorruption Overflow survived: +10-50\nFirst prestige bonus: +10"]
R_spend["Spending:\nElemental Mastery level 1: 1 Resonance\nElemental Mastery level 2-5: 2-10 each\nLey Line Junction unlock: 5 each"]
R_inflation["Inflation Control:\nEarned through skill, not time\nHigher waves = more potential Resonance\nOverflow events scale with Corruption"]
end
```
### Corruption
```mermaid
graph TD
subgraph "Corruption [Threat Meter - Inverse Currency]"
Cor_display["Display: ☠️ Corruption\n0-100 (bar fills red)"]
Cor_earn["Increases When:\nAny enemy spawns: +0.5\nEnemy reaches Gate: +15\nWave completes (base): +5\nOverload missed (fewer than 3 hits): +5"]
Cor_spend["Reduced By:\nPurify Ley Lines: 50 Energy → -10 Corruption\nGate Overload (5+ hits): -5 Corruption\nPerfect wave: No corruption increase"]
Cor_effects["Effects at Thresholds:\n0-24: Normal spawns\n25-49: +20% enemy HP\n50-74: +50% enemy HP, Wraiths appear\n75-99: +100% enemy HP, Titans appear\n100: CORRUPTION OVERFLOW (boss wave)"]
end
```
## Conversion Rate Diagram
```mermaid
flowchart LR
Energy["⚡ Energy\n(100)"] -->|"Energy Purge\nUnlocked: wave 3\nCooldown: 60s\nConverts excess over 200"| Charge["⚡ Charge\n(+10)"]
Charge["⚡ Charge\n(80+)"] -->|"Overcharge\nUnlocked: wave 5\nRequires: 80 Charge\nResets Charge to 20"| Resonance["✨ Resonance\n(+1)"]
Energy["⚡ Energy\n(500)"] -->|"Ley Purification\nUnlocked: always\nCost: 500 Energy\nReduces threat"| Corruption["☠️ Corruption\n(-25)"]
```
## Pacing Timeline
```mermaid
gantt
title Currency Pacing (First 30 Minutes)
dateFormat mm:ss
axisFormat %M:%S
section Energy Milestones
First Conduit affordable (25 Energy) :milestone, 00:15, 0
Link unlock requires Charge (15) :milestone, 02:00, 0
Overload affordable (50 Charge) :milestone, 05:00, 0
Mid-game steady state (~2K Energy) :milestone, 12:00, 0
Pre-prestige accumulation (~50K Energy) :milestone, 25:00, 0
section Charge Milestones
Start with 10 Charge :milestone, 00:00, 0
First Precision Zap (5 cost) :milestone, 00:30, 0
First Link created (15 cost) :milestone, 02:30, 0
First Overload (50 cost) :milestone, 05:30, 0
Charge cap reached (100) :milestone, 10:00, 0
section Resonance Milestones
First perfect wave (+1 Resonance) :milestone, 01:30, 0
First mastery purchase (1 cost) :milestone, 08:00, 0
Resonance for overflow survival (+20) :milestone, 22:00, 0
section Corruption Milestones
First enemy hits gate (+15 Corruption) :milestone, 02:00, 0
First purification (-10) :milestone, 04:00, 0
Wraith threshold (50) :milestone, 12:00, 0
Titan threshold (75) :milestone, 18:00, 0
Overflow event (100) :milestone, 25:00, 0
```
## Upgrade Cost Curves
### Conduit Placement
```mermaid
graph LR
subgraph "Conduit Base Cost"
M1["Conduit #1\nCost: 25 Energy\nStandard tower"]
M2["Conduit #5\nCost: 35 Energy\n+5 per existing"]
M3["Conduit #10\nCost: 75 Energy\nScales with count"]
M4["Conduit #20\nCost: 175 Energy\nPremium placement"]
M1 --> M2 --> M3 --> M4
end
```
### Conduit Upgrade: Damage
```mermaid
graph LR
subgraph "Damage Upgrade"
D1["Level 1\nCost: 15 Energy\n+10% damage"]
D2["Level 3\nCost: 22 Energy\n+30% total"]
D3["Level 5\nCost: 37 Energy\n+50% total"]
D4["Level 10\nCost: 92 Energy\n+100% total"]
D1 --> D2 --> D3 --> D4
end
```
### Conduit Upgrade: Range
```mermaid
graph LR
subgraph "Range Upgrade"
R1["Level 1\nCost: 20 Energy\n+10% range"]
R2["Level 3\nCost: 29 Energy\n+30% total"]
R3["Level 5\nCost: 50 Energy\n+50% total"]
R4["Level 8\nCost: 86 Energy\n+80% total"]
R1 --> R2 --> R3 --> R4
end
```
### Elemental Specialization Unlock
```mermaid
graph LR
subgraph "Element Unlock Costs (Charge)"
E1["Fire (Destruction)\nCost: 25 Charge\n+50% damage, -20% range"]
E2["Air (Reach)\nCost: 25 Charge\n+40% range, -15% damage"]
E3["Earth (Control)\nCost: 25 Charge\n+30% slow on hit"]
E4["Void (Purify)\nCost: 40 Charge\n-20% enemy power"]
E1 --> E2
E2 --> E3
E3 --> E4
end
```
## Collectible Entity State Machines
### Energy Orb
```mermaid
stateDiagram-v2
[*] --> Spawning: enemy dies
Spawning --> Active: spawn animation (200ms)
Active --> Flowing: animation complete
Flowing --> Absorbed: reaches Storm Gate
Active --> Expired: 8 second lifetime
Flowing --> Expired: 8 second lifetime
Absorbed --> [*]: add Energy + UI update
Expired --> [*]: fade out (300ms)
note right of Active
Visual: glowing diamond sprite
Color: yellow/white (#FFD700)
Scale: 0.8
Position: at enemy death location
end note
note right of Flowing
Movement: follows nearest Ley Line
Speed: 150 pixels/sec toward Gate
Visual: leaves faint trail
Magnetism: none (auto-pathing)
end note
note right of Absorbed
Triggers: energy.add(baseReward * waveMult)
Triggers: floatingText("+{value} ⚡", Gate position)
Triggers: Gate pulse animation
Sound: energyCollect.mp3
end note
```
### Charge Spark (From Skill Actions)
```mermaid
stateDiagram-v2
[*] --> Spawning: precision kill / link created / overload hit
Spawning --> Active: spawn animation (150ms)
Active --> Collected: auto-collect immediate
Active --> Expired: 3 second lifetime
Collected --> [*]: add Charge + UI update
Expired --> [*]: fade out (200ms)
note right of Active
Visual: small spark sprite
Color: blue/cyan (#00D4FF)
Scale: 0.5
Position: at action location
Lifetime: 3 seconds
No click needed - auto-collects
end note
note right of Collected
Triggers: charge.add(amount)
Triggers: floatingText("+{value} ⚡", action position)
Triggers: Charge bar glow
Sound: chargeCollect.mp3
end note
```
### Resonance Crystal (Perfect Wave Bonus)
```mermaid
stateDiagram-v2
[*] --> Spawning: wave complete (0 gate damage)
Spawning --> Active: spawn animation (400ms, dramatic)
Active --> Collected: click within radius OR auto after 5s
Active --> Expired: 10 second lifetime
Collected --> [*]: add Resonance + dramatic UI
Expired --> [*]: fade out (500ms)
note right of Active
Visual: large crystal sprite
Color: purple/violet (#9B59B6)
Scale: 2.0
Position: center screen
Rotation: slowly rotating
Glow: intense pulsing glow
Click radius: 40 pixels
end note
note right of Collected
Triggers: resonance.add(waveNum)
Triggers: dramaticText("RESONANCE +{value}!", center)
Triggers: screen shake + particle burst
Sound: resonanceCollect.mp3 (musical)
end note
```
## Currency Event Flows
### Enemy Kill → Energy
```mermaid
sequenceDiagram
participant Canvas as Canvas (Game World)
participant Entity as Entity System
participant EventBus as EventBus
participant Currency as CurrencyManager
particle Collectible as Collectible System
participant UI as HUD Display
Canvas->>Entity: enemy.takeDamage(damageAmount)
Entity->>Entity: hp -= damageAmount
Entity->>Entity: hp <= 0 → die()
Entity->>Canvas: deathAnimation() + particleBurst()
Entity->>EventBus: emit('enemy-killed', {type, position, waveNum})
EventBus->>Currency: calcReward('energy', baseReward, waveNum)
Note over Currency: reward = 5 * (1 + 0.15 * waveNum)
EventBus->>Collectible: spawn('energyOrb', {position, value: reward})
Collectible->>Canvas: createOrbSprite(position)
Note over Canvas: Orb follows Ley Line to Gate
Canvas->>EventBus: emit('orb-absorbed', {value, position: gate})
EventBus->>Currency: energy.add(value)
EventBus->>UI: floatingText("+{value} ⚡", gatePosition)
EventBus->>UI: updateDisplay('energy')
UI->>UI: countUpAnimation(current, current + value, 300ms)
```
### Precision Zap → Charge
```mermaid
sequenceDiagram
participant Player as Player Input
participant Canvas as Canvas (Game World)
participant Ability as Ability System
participant EventBus as EventBus
participant Currency as CurrencyManager
participant UI as HUD Display
Player->>Canvas: click(enemyPosition)
Canvas->>Ability: tryPrecisionZap(enemy)
Ability->>Ability: check canAfford(5 Charge) && cooldownReady()
Ability->>Canvas: lightningBolt(gateToEnemy)
Canvas->>Entity: enemy.takeDamage(zapDamage)
Entity->>Entity: check if killed by zap
alt Enemy Killed
Entity->>EventBus: emit('enemy-killed-by-zap', {position})
EventBus->>Currency: charge.add(3)
EventBus->>UI: floatingText("+3 ⚡", enemyPosition)
end
Ability->>Currency: charge.subtract(5)
Ability->>Ability: startCooldown(3000ms)
EventBus->>UI: updateDisplay('charge')
EventBus->>UI: showCooldown('zap', 3000)
```
### Wave Complete → Resonance (Perfect Clear)
```mermaid
sequenceDiagram
participant Wave as Wave Manager
participant Gate as Gate Entity
participant EventBus as EventBus
participant Currency as CurrencyManager
participant Collectible as Collectible System
participant UI as HUD Display
Wave->>Gate: checkDamageTaken()
alt Gate Damage == 0
Gate->>EventBus: emit('perfect-wave', {waveNum})
EventBus->>Currency: resonance.add(waveNum)
EventBus->>Collectible: spawn('resonanceCrystal', {value: waveNum})
Collectible->>UI: showFloatingCrystal(waveNum)
Note over UI: Large crystal appears, rotating
Participant Player as Player
Player->>Collectible: click(crystal)
Collectible->>EventBus: emit('resonance-collected', {value: waveNum})
EventBus->>UI: dramaticText("PERFECT WAVE!", center)
EventBus->>UI: dramaticText("RESONANCE +{waveNum}!", center)
EventBus->>UI: updateDisplay('resonance')
else Gate Damage > 0
Gate->>EventBus: emit('wave-complete-damaged', {waveNum, damage})
EventBus->>UI: normalText("Wave {waveNum} Complete", top)
end
```
### Corruption Increase → Effects
```mermaid
sequenceDiagram
participant Wave as Wave Manager
participant Enemy as Enemy Spawner
participant EventBus as EventBus
participant Currency as CurrencyManager
participant UI as HUD Display
Wave->>EventBus: emit('enemy-spawned')
EventBus->>Currency: corruption.add(0.5)
Wave->>EventBus: emit('wave-complete')
EventBus->>Currency: corruption.add(5)
alt Enemy Reaches Gate
Enemy->>EventBus: emit('enemy-reached-gate')
EventBus->>Currency: corruption.add(15)
EventBus->>UI: screenShake(200ms)
EventBus->>UI: warningText("GATE DAMAGED!", topCenter)
end
EventBus->>Currency: checkThreshold(corruption)
alt Corruption >= 50
EventBus->>Enemy: enableEnemyType('wraith')
EventBus->>UI: warningText("STORM WRATHS APPEAR", top)
else Corruption >= 75
EventBus->>Enemy: enableEnemyType('titan')
EventBus->>UI: warningText("CORRUPTION TITANS RISE", top)
else Corruption >= 100
EventBus->>Wave: triggerOverflowEvent()
EventBus->>UI: alertText("CORRUPTION OVERFLOW!", center, 5000ms)
end
EventBus->>UI: updateDisplay('corruption')
```
## CONFIG Spec: currencies Section
```javascript
// Currency Definitions
CONFIG.currencies = {
energy: {
displayName: 'Energy',
icon: '⚡',
startingAmount: 50,
cap: null,
decimals: 0,
suffixes: ['', 'K', 'M', 'B', 'T'],
color: '#FFD700',
},
charge: {
displayName: 'Charge',
icon: '⚡',
startingAmount: 10,
cap: 100,
decimals: 0,
suffixes: [],
color: '#00D4FF',
},
resonance: {
displayName: 'Resonance',
icon: '✨',
startingAmount: 0,
cap: null,
decimals: 0,
suffixes: ['', 'K', 'M'],
color: '#9B59B6',
persistsOnPrestige: true,
},
corruption: {
displayName: 'Corruption',
icon: '☠️',
startingAmount: 0,
cap: 100,
decimals: 0,
suffixes: [],
color: '#E74C3C',
isThreatMeter: true,
},
};
// Currency Sources (Earning)
CONFIG.currencySources = {
enemyKill: {
currency: 'energy',
formula: 'baseKillReward * (1 + waveMultiplier * waveNumber)',
baseKillReward: 5,
waveMultiplier: 0.15,
},
waveComplete: {
currency: 'energy',
formula: 'waveBonus * waveNumber',
waveBonus: 25,
},
bossKill: {
currency: 'energy',
formula: 'bossReward * bossLevel',
bossReward: 100,
},
bossKillResonance: {
currency: 'resonance',
formula: 'bossLevel * 2',
},
passiveEnergy: {
currency: 'energy',
formula: 'conduitCount * conduitLevel * passiveRate',
passiveRate: 1,
},
perfectWave: {
currency: 'resonance',
formula: 'waveNumber',
},
precisionZapKill: {
currency: 'charge',
formula: 'zapReward',
zapReward: 3,
},
linkCreated: {
currency: 'charge',
formula: 'linkReward',
linkReward: 5,
},
overloadHit: {
currency: 'charge',
formula: 'overloadReward',
overloadReward: 1,
},
perfectWaveCharge: {
currency: 'charge',
formula: 'perfectChargeBonus',
perfectChargeBonus: 15,
},
overflowSurvived: {
currency: 'resonance',
formula: 'overflowBaseReward * (1 + overflowCount * 0.5)',
overflowBaseReward: 10,
},
firstPrestigeBonus: {
currency: 'resonance',
formula: '10',
once: true,
},
};
// Corruption Sources
CONFIG.corruptionSources = {
enemySpawn: {
amount: 0.5,
},
waveComplete: {
amount: 5,
},
enemyReachedGate: {
amount: 15,
},
overloadMissed: {
amount: 5,
condition: 'overloadHits < 3',
},
};
// Corruption Reduction
CONFIG.corruptionReduction = {
purify: {
cost: { currency: 'energy', amount: 50 },
reduction: 10,
},
overloadHits5: {
reduction: 5,
condition: 'overloadHits >= 5',
},
perfectWave: {
reduction: 0, // No increase
},
};
// Corruption Thresholds
CONFIG.corruptionThresholds = {
wraith: {
level: 50,
effects: ['+20% enemy HP', 'enable wraith spawns'],
},
titan: {
level: 75,
effects: ['+50% enemy HP', 'enable titan spawns'],
},
overflow: {
level: 100,
effects: ['trigger overflow boss wave', 'reset corruption to 0'],
},
};
// Collectibles
CONFIG.collectibles = {
energyOrb: {
sprite: 'diamond',
color: '#FFD700',
scale: 0.8,
lifetime: 8,
glow: true,
glowColor: '#FFD700',
spawnAnimation: 'popIn',
spawnDuration: 200,
movement: 'leyLineFlow',
speed: 150,
collectOnGate: true,
},
chargeSpark: {
sprite: 'spark',
color: '#00D4FF',
scale: 0.5,
lifetime: 3,
glow: true,
glowColor: '#00D4FF',
spawnAnimation: 'burst',
spawnDuration: 150,
movement: 'float',
collectRadius: 0, // auto-collect
},
resonanceCrystal: {
sprite: 'diamond',
color: '#9B59B6',
scale: 2.0,
lifetime: 10,
glow: true,
glowColor: '#9B59B6',
spawnAnimation: 'dramaticPop',
spawnDuration: 400,
rotation: true,
rotationSpeed: 1,
movement: 'floatCenter',
collectRadius: 40,
autoCollectDelay: 5000,
},
};
// Upgrade Costs
CONFIG.upgradeCosts = {
conduitPlacement: {
baseCost: 25,
costIncrement: 5,
currency: 'energy',
maxCost: 175,
},
conduitDamage: {
baseCost: 15,
costMultiplier: 1.2,
currency: 'energy',
maxLevel: 10,
effect: '+10% damage per level',
},
conduitRange: {
baseCost: 20,
costMultiplier: 1.2,
currency: 'energy',
maxLevel: 8,
effect: '+10% range per level',
},
conduitSpeed: {
baseCost: 25,
costMultiplier: 1.25,
currency: 'energy',
maxLevel: 5,
effect: '+15% fire rate per level',
},
};
// Ability Costs
CONFIG.abilityCosts = {
precisionZap: {
cost: { currency: 'charge', amount: 5 },
cooldown: 3000,
damage: 50,
},
createLink: {
cost: { currency: 'charge', amount: 15 },
maxLinks: 10,
costIncrement: 2, // +2 Charge per existing link
},
gateOverload: {
cost: { currency: 'charge', amount: 50 },
cooldown: 30000,
damage: 100,
radius: 150,
},
};
// Elemental Specialization
CONFIG.elementalSpec = {
fire: {
name: 'Fire (Destruction)',
cost: { currency: 'charge', amount: 25 },
effects: ['+50% damage', '-20% range', 'projectiles: orange'],
},
air: {
name: 'Air (Reach)',
cost: { currency: 'charge', amount: 25 },
effects: ['+40% range', '-15% damage', 'projectiles: blue'],
},
earth: {
name: 'Earth (Control)',
cost: { currency: 'charge', amount: 25 },
effects: ['+30% slow on hit', 'projectiles: green'],
},
void: {
name: 'Void (Purify)',
cost: { currency: 'charge', amount: 40 },
effects: ['-20% enemy power', 'projectiles: purple'],
},
};
// Prestige (Mastery) Upgrades
CONFIG.prestigeUpgrades = {
elementalMastery: {
currency: 'resonance',
levels: [
{ level: 1, cost: 1, effect: '+10% chosen element damage' },
{ level: 2, cost: 2, effect: '+20% chosen element damage' },
{ level: 3, cost: 4, effect: '+35% chosen element damage' },
{ level: 4, cost: 6, effect: '+50% chosen element damage' },
{ level: 5, cost: 10, effect: '+75% chosen element damage, unlock legendary conduit' },
],
},
leyLineExpansion: {
currency: 'resonance',
cost: 5,
effect: '+2 junction points per Ley Line',
maxPurchases: 5,
},
energyAffinity: {
currency: 'resonance',
levels: [
{ level: 1, cost: 3, effect: '+10% Energy gain' },
{ level: 2, cost: 5, effect: '+20% Energy gain' },
{ level: 3, cost: 8, effect: '+35% Energy gain' },
],
},
};
// Conversions
CONFIG.conversions = {
energyPurge: {
input: { currency: 'energy', amount: 100 },
output: { currency: 'charge', amount: 10 },
unlockWave: 3,
cooldown: 60000,
condition: 'energy > 200',
},
overcharge: {
input: { currency: 'charge', amount: 80 },
output: { currency: 'resonance', amount: 1 },
unlockWave: 5,
setsChargeTo: 20,
},
leyPurification: {
input: { currency: 'energy', amount: 50 },
output: { currency: 'corruption', amount: -10 },
alwaysAvailable: true,
},
};
```
## Exact Formulas
```
// Energy
Conduit placement cost: min(25 + (existingConduits * 5), 175)
Conduit upgrade cost: baseCost * costMultiplier^level
Enemy kill reward: 5 * (1 + 0.15 * waveNumber)
Wave complete bonus: 25 * waveNumber
Boss kill reward: 100 * bossLevel
Passive generation: conduitCount * conduitLevel * 1 Energy/sec
// Charge
Precision Zap cost: 5 Charge (3s cooldown)
Link cost: 15 + (activeLinks * 2) Charge
Gate Overload cost: 50 Charge (30s cooldown)
Precision Zap kill reward: 3 Charge
Link creation reward: 5 Charge
Overload hit reward: 1 Charge per enemy hit
Perfect wave Charge bonus: 15 Charge
// Resonance
Perfect wave reward: waveNumber Resonance
Boss kill reward: bossLevel * 2 Resonance
Overflow survival: 10 * (1 + overflowCount * 0.5) Resonance
First prestige bonus: 10 Resonance (once)
// Corruption
Spawn increase: +0.5 per enemy
Wave complete increase: +5
Enemy reached gate: +15
Purify cost: 50 Energy for -10 Corruption
Overload (5+ hits): -5 Corruption
// Prestige Multipliers
Energy gain: 1.0 + (energyAffinityLevel * 0.10 to 0.35)
Elemental damage: 1.0 + (masteryLevel * 0.10 to 0.75)
Starting Conduits: 1 legendary (post-first prestige)
```
## Balance Targets
| Time | Energy | Charge | Resonance | Corruption | Key Event |
|-------|--------|--------|-----------|------------|----------------------------|
| 0:00 | 50 | 10 | 0 | 0 | Game start |
| 0:15 | 25 | 10 | 0 | 0 | First Conduit placed |
| 0:45 | 15 | 13 | 0 | 5 | First wave complete |
| 1:30 | 60 | 18 | 1 | 0 | First perfect wave |
| 3:00 | 200 | 35 | 3 | 15 | Link unlock affordable |
| 5:00 | 500 | 60 | 8 | 20 | First Overload |
| 8:00 | 1K | 80 | 15 | 30 | First mastery purchase |
| 12:00 | 2.5K | 100 | 25 | 50 | Wraith threshold reached |
| 18:00 | 8K | 100 | 40 | 75 | Titan threshold reached |
| 22:00 | 20K | 100 | 60 | 85 | Building toward overflow |
| 25:00 | 50K | 100 | 80 | 100 | Corruption Overflow event |
| 30:00 | 100K | 100 | 120 | 20 | Post-overflow, ready for |
| | | | | | prestige |
## Edge Cases
- **Overflow protection**: Switch to BigNum at 1e12 Energy, 1e6 Resonance
- **Negative balance**: `canAfford()` check before all purchases; disable buttons if insufficient
- **Charge cap at 100**: Auto-convert excess (80+) to Resonance when unlocked; otherwise stop earning
- **Corruption at 100**: Trigger overflow event immediately; reset to 0 after
- **Load with zero state**: Ensure all currencies initialize from starting amounts
- **Prestige reset**: Energy, Charge, Corruption → starting values; Resonance → persists
- **Missing collectible**: Auto-collect after lifetime expires (orbs) or auto-collect immediately (Charge sparks)
- **Gate destruction**: Game over state at 100% Gate HP (not 100 Corruption - different systems)
- **First prestige**: Grant +10 Resonance bonus to unlock first mastery immediately
- **Save corruption**: Save exact value; on load, re-enable appropriate enemy types based on threshold
Progression
{
"gameId": "Game-1771146744592-gl4u",
"jobId": 68,
"section": "progression",
"waves": {
"baseEnemyCount": 5,
"enemyCountGrowth": 1.15,
"spawnInterval": 0.5,
"preWaveCountdown": 3,
"bossWaveInterval": 10,
"firstBossWave": 10
},
"unlocks": {
"firstConduit": {
"requirement": "energy >= 25",
"unlocks": "conduitPlacement",
"toast": "Click junctions to place Conduits!",
"indicator": "junction-pulse"
},
"conduitUpgrades": {
"requirement": "waveComplete >= 1",
"unlocks": "upgradesPanel",
"toast": "Conduit upgrades available!",
"indicator": "panel-glow"
},
"precisionZap": {
"requirement": "charge >= 5 && waveComplete >= 1",
"unlocks": "precisionZapAbility",
"toast": "Click enemies to Zap them!",
"indicator": "ability-unlock"
},
"linkMechanic": {
"requirement": "waveComplete >= 3",
"unlocks": "linkCreation",
"toast": "Drag between Conduits to create Links!",
"indicator": "link-tutorial"
},
"gateOverload": {
"requirement": "waveComplete >= 5",
"unlocks": "gateOverloadAbility",
"toast": "Click the Gate for Overload!",
"indicator": "gate-pulse"
},
"elementalFire": {
"requirement": "waveComplete >= 7 && charge >= 25",
"unlocks": "elementFire",
"toast": "Fire element unlocked!",
"indicator": "element-tab-fire"
},
"elementalAir": {
"requirement": "waveComplete >= 7 && charge >= 25",
"unlocks": "elementAir",
"toast": "Air element unlocked!",
"indicator": "element-tab-air"
},
"elementalEarth": {
"requirement": "waveComplete >= 10 && charge >= 25",
"unlocks": "elementEarth",
"toast": "Earth element unlocked!",
"indicator": "element-tab-earth"
},
"elementalVoid": {
"requirement": "waveComplete >= 10 && charge >= 40",
"unlocks": "elementVoid",
"toast": "Void element unlocked!",
"indicator": "element-tab-void"
},
"wraithEnemy": {
"requirement": "corruption >= 50",
"unlocks": "enemyWraith",
"toast": "STORM WRATHS APPEAR!",
"indicator": "warning-overlay"
},
"titanEnemy": {
"requirement": "corruption >= 75",
"unlocks": "enemyTitan",
"toast": "CORRUPTION TITANS RISE!",
"indicator": "warning-overlay"
},
"advancedUpgrades": {
"requirement": "waveComplete >= 15",
"unlocks": "tier3Upgrades",
"toast": "Advanced upgrades available!",
"indicator": "upgrade-glow"
},
"prestigeTeaser": {
"requirement": "waveComplete >= 20",
"unlocks": "prestigeButtonVisible",
"toast": "Prestige approaches...",
"indicator": "prestige-gray"
},
"prestigeAvailable": {
"requirement": "overflowSurvived >= 1 || waveComplete >= 25",
"unlocks": "prestigeClickable",
"toast": "PRESTIGE AVAILABLE!",
"indicator": "prestige-glow"
}
},
"milestones": [
{
"id": "firstConduit",
"trigger": "conduitsPlaced >= 1",
"reward": {
"energy": 0
},
"toast": "Defenses active!"
},
{
"id": "firstBlood",
"trigger": "enemiesKilled >= 1",
"reward": {
"energy": 5
},
"toast": "The purge begins!"
},
{
"id": "wave1",
"trigger": "wavesCompleted >= 1",
"reward": {
"energy": 25
},
"toast": "Wave 1 Complete!"
},
{
"id": "perfectWave1",
"trigger": "perfectWaves >= 1",
"reward": {
"resonance": 1
},
"toast": "PERFECT WAVE!"
},
{
"id": "firstLink",
"trigger": "linksCreated >= 1",
"reward": {
"charge": 5
},
"toast": "Network established!"
},
{
"id": "elementalChoice",
"trigger": "elementUnlocked >= 1",
"reward": {
"charge": 10
},
"toast": "Element attuned!"
},
{
"id": "overloadHit",
"trigger": "overloadHits >= 5",
"reward": {
"corruption": -5
},
"toast": "Overload successful!"
},
{
"id": "wraithSlayer",
"trigger": "wraithsKilled >= 1",
"reward": {
"energy": 25,
"charge": 10
},
"toast": "Storm Wraith purged!"
},
{
"id": "titanSlayer",
"trigger": "titansKilled >= 1",
"reward": {
"resonance": 5
},
"toast": "TITAN DESTROYED!"
},
{
"id": "overflowSurvivor",
"trigger": "overflowsSurvived >= 1",
"reward": {
"resonance": 20
},
"toast": "OVERFLOW SURVIVED!"
}
],
"upgradeTiers": {
"tier1": {
"unlock": "always",
"mutuallyExclusive": false,
"upgrades": {
"damage1": {
"cost": {
"energy": 15
},
"effect": "damage+10%",
"maxLevel": 1
},
"damage2": {
"cost": {
"energy": 18
},
"effect": "damage+20%total",
"requires": "damage1",
"maxLevel": 1
},
"range1": {
"cost": {
"energy": 20
},
"effect": "range+10%",
"maxLevel": 1
},
"range2": {
"cost": {
"energy": 24
},
"effect": "range+20%total",
"requires": "range1",
"maxLevel": 1
},
"speed1": {
"cost": {
"energy": 25
},
"effect": "fireRate+15%",
"maxLevel": 1
}
}
},
"tier2": {
"unlock": "waveComplete >= 7",
"mutuallyExclusive": true,
"choices": [
"fire",
"air",
"earth",
"void"
],
"upgrades": {
"fire": {
"cost": {
"charge": 25
},
"effect": "+50%damage,-20%range",
"projectile": "orange"
},
"air": {
"cost": {
"charge": 25
},
"effect": "+40%range,-15%damage",
"projectile": "blue"
},
"earth": {
"cost": {
"charge": 25
},
"effect": "+30%slowOnHit",
"projectile": "green"
},
"void": {
"cost": {
"charge": 40
},
"effect": "-20%enemyPower",
"projectile": "purple"
}
}
},
"tier3": {
"unlock": "waveComplete >= 15",
"mutuallyExclusive": true,
"choices": [
"piercing",
"splash",
"chain",
"frost"
],
"upgrades": {
"piercing": {
"cost": {
"charge": 50
},
"effect": "piercing+2",
"visible": "projectiles penetrate"
},
"splash": {
"cost": {
"charge": 50
},
"effect": "aoe+30%",
"visible": "explosion on hit"
},
"chain": {
"cost": {
"charge": 50
},
"effect": "bounce+2",
"visible": "lightning chain"
},
"frost": {
"cost": {
"charge": 50
},
"effect": "slowStack+20%",
"visible": "frost trail"
}
}
}
},
"prestige": {
"teaserWave": 20,
"minWave": 25,
"formula": "floor(perfectWaves * 0.5 + overflowCount * 10 + firstPrestigeBonus)",
"firstPrestigeBonus": 10,
"resets": [
"energy",
"charge",
"corruption",
"conduits",
"upgrades",
"wave"
],
"persists": [
"resonance",
"prestigeUpgrades",
"milestones",
"overflowCount"
],
"visualTiers": [
{
"tier": 0,
"minPrestiges": 0,
"background": "#1a1a2e",
"gateColor": "#00d4ff",
"enemyPalette": null
},
{
"tier": 1,
"minPrestiges": 1,
"background": "#1a1a2e",
"gateColor": "#FFD700",
"gateEffect": "elemental-glow",
"enemyPalette": {
"hueShift": 30
}
},
{
"tier": 2,
"minPrestiges": 3,
"background": "#16213e",
"gateColor": "#9B59B6",
"gateEffect": "crackling-energy",
"enemyPalette": {
"hueShift": 60,
"saturation": 1.2
}
},
{
"tier": 3,
"minPrestiges": 5,
"background": "#0f0f1a",
"gateColor": "#ff6b35",
"gateEffect": "storm-aura",
"enemyPalette": {
"hueShift": 120,
"saturation": 1.5
}
}
],
"upgrades": {
"legendaryConduit": {
"cost": {
"resonance": 0
},
"effect": "start with 1 legendary Conduit",
"once": true,
"visible": "pre-placed legendary tower on start"
},
"energyAffinity": {
"cost": {
"resonance": 3
},
"maxLevel": 3,
"effect": [
"+10%",
"+20%",
"+35%"
],
"stat": "energyGain"
},
"elementalMastery": {
"cost": {
"resonance": [
1,
2,
4,
6,
10
]
},
"maxLevel": 5,
"effect": [
"+10%",
"+20%",
"+35%",
"+50%",
"+75%"
],
"stat": "elementDamage",
"unlocksAt5": "legendaryConduitEffect"
},
"leyLineExpansion": {
"cost": {
"resonance": 5
},
"maxPurchases": 5,
"effect": "+2 junction points per Ley Line",
"visible": "more junction points visible"
},
"chargeReserve": {
"cost": {
"resonance": 4
},
"maxLevel": 2,
"effect": [
"+10",
"+20"
],
"stat": "maxCharge",
"visible": "Charge cap increased"
},
"linkMastery": {
"cost": {
"resonance": 6
},
"maxLevel": 1,
"effect": "Links start unlocked in Run 2+",
"visible": "Link ability available immediately"
}
},
"acceleration": {
"run2StartEnergy": 60,
"run2StartCharge": 15,
"run2LinksUnlocked": true,
"run2LegendaryConduit": true,
"run2EnergyGain": "+20%"
}
},
"pacing": {
"onboarding": {
"start": "0:00",
"end": "2:00",
"keyEvents": [
"firstConduit",
"firstUpgrade",
"perfectWave1"
]
},
"foundation": {
"start": "2:00",
"end": "6:00",
"keyEvents": [
"precisionZap",
"linkMechanic",
"gateOverload"
]
},
"expansion": {
"start": "6:00",
"end": "12:00",
"keyEvents": [
"elementalSpec",
"allElements",
"wraithUnlock"
]
},
"complexity": {
"start": "12:00",
"end": "20:00",
"keyEvents": [
"titanUnlock",
"advancedUpgrades"
]
},
"mastery": {
"start": "20:00",
"end": "30:00",
"keyEvents": [
"prestigeTeaser",
"overflowEvent",
"prestigeAvailable"
]
}
},
"enemyStats": {
"spawn": {
"hp": 100,
"speed": 40,
"reward": 5
},
"wraith": {
"hp": 60,
"speed": 80,
"reward": 15
},
"titan": {
"hp": 500,
"speed": 20,
"reward": 100
},
"hpMultiplier": 1.12,
"rewardMultiplier": 0.15
}
}
Progression
# Storm Gate Defenders - Progression System Design
## Unlock Flow
```mermaid
flowchart TD
Start(["Game Start
0:00
Start with: 50 Energy, 10 Charge
3 starting Ley Lines visible"]) --> FirstAction["First Wave Spawns
Corruption Spawns appear
Core gameplay visible immediately"]
FirstAction -->|"Wave 1 complete (~45s)"| FirstConduit["🔓 First Conduit Affordable
25 Energy
Player can click junctions"]
FirstAction -->|"First enemy killed"| EnergyOrbVisible["⚡ Energy Orbs Visible
See rewards flow along Ley Lines"]
FirstConduit -->|"Wave 2 complete (~1:30)"| PerfectWave1["✨ Perfect Wave Bonus
+1 Resonance (if no gate damage)
Resonance Crystal appears"]
FirstConduit -->|"Energy reaches 100"| FirstUpgrade["🔓 Conduit Upgrades
Damage: +10% (15 Energy)
Range: +10% (20 Energy)"]
PerfectWave1 -->|"Charge reaches 15"| PrecisionZap["⚡ Precision Zap Active
5 Charge per zap
Click enemies for lightning"]
PrecisionZap -->|"Wave 3 complete (~3:00)"| LinkUnlock["🔓 Link Mechanic
15 Charge to create
Drag between Conduits"]
FirstUpgrade -->|"Wave 5 complete (~5:00)"| OverloadUnlock["🔓 Gate Overload
50 Charge, 30s cooldown
AOE attack from Gate"]
LinkUnlock -->|"Wave 7 complete (~7:00)"| Elemental1["🔓 First Element Unlocks
Fire: +50% damage, -20% range
Air: +40% range, -15% damage
Conduits change color"]
Elemental1 -->|"Wave 10 complete (~10:00)"| EarthVoid["🔓 Earth & Void Elements
Earth: +30% slow on hit
Void: -20% enemy power
All elements available"]
OverloadUnlock -->|"Corruption reaches 50"| WraithUnlock["⚡ Storm Wraiths Appear
Teleporting enemies
Requires predictive placement"]
EarthVoid -->|"Corruption reaches 75"| TitanUnlock["☠️ Corruption Titans Appear
Boss enemies with spawn ability
Requires concentrated fire"]
TitanUnlock -->|"Wave 20 complete (~20:00)"| PrestigeTeaser["✨ Prestige Teased
Overflow approaching
Prestige button appears (grayed)"]
WraithUnlock -->|"Wave 25 complete (~25:00)"| OverflowEvent["⚡ CORRUPTION OVERFLOW
Massive boss wave
Resonance rewarded on survival"]
OverflowEvent -->|"Overflow survived"| PrestigeReady["✨ PRESTIGE AVAILABLE!
+20-50 Resonance earned
Run 2 acceleration unlocked"]
```
## Gate Dependency Graph
```mermaid
graph TD
subgraph "Hard Gates (progress pauses)"
HG1["⛔ Gate: First Conduit
Requirement: 25 Energy
Wait: ~15 seconds
Blocks: Active tower placement
Release: Immediate gameplay begins"]
HG2["⛔ Gate: Link Mechanic
Requirement: Wave 3 complete + 15 Charge
Wait: ~3 minutes
Blocks: Advanced positioning
Release: New strategic depth"]
HG3["⛔ Gate: Elemental Specialization
Requirement: Wave 7 complete + 25 Charge
Wait: ~7 minutes
Blocks: Build diversity
Release: Mutually exclusive paths"]
HG4["⛔ Gate: Prestige
Requirement: Overflow survived OR Wave 25
Wait: ~25 minutes
Blocks: Meta progression
Release: Run 2 acceleration"]
end
subgraph "Soft Gates (progress slows)"
SG1["🟡 Gate: Early Optimization
Waves 2-4
Player experiments with Conduit placement
Redirected to: Upgrade purchases"]
SG2["🟡 Gate: Mid-Game Plateau
Waves 8-12
Corruption climbing, enemies tougher
Redirected to: Elemental choices"]
SG3["🟡 Gate: Pre-Overflow Grind
Waves 18-22
Costs high, Charge capped
Redirected to: Overload mastery, perfect waves"]
end
```
## Progression Timeline
```mermaid
gantt
title Progression Pacing (30 Minutes to Prestige)
dateFormat mm:ss
axisFormat %M:%S
section Onboarding (0-2 min)
Gameplay begins immediately :active, 00:00, 30s
First Conduit placed, first shots fired :00:30, 30s
First wave complete, Energy flowing :01:00, 45s
First upgrade purchased :01:45, 30s
section Foundation (2-6 min)
Precision Zap unlocked, skill shots active :02:15, 60s
First perfect wave (+1 Resonance) :03:15, 60s
Link mechanic unlocked :05:00, 60s
Gate Overload unlocked :06:00, 60s
section Expansion (6-12 min)
First elemental spec (Fire/Air) :07:00, 120s
Wave 10, all elements available :09:00, 180s
Corruption at 50, Wraiths appear :12:00, 60s
section Complexity (12-20 min)
Titan enemies unlocked at Corruption 75 :15:00, 180s
Multiple Ley Lines active :18:00, 120s
Charge management critical :20:00, 60s
section Mastery (20-30 min)
Prestige teased (overflow visible) :22:00, 180s
Corruption Overflow event :25:00, 180s
Prestige available (+20-50 Resonance) :28:00, 120s
```
## Tension Curve
```mermaid
graph LR
subgraph "Emotional Arc"
T1["0-2 min
🟢 Excitement
Tension: 3/5
First placements, seeing shots land"]
T2["2-5 min
🟢 Discovery
Tension: 4/5
New abilities: Zap, Links"]
T3["5-8 min
🟡 Optimization
Tension: 2/5
Experimenting with placements"]
T4["8-12 min
🟢 Expansion
Tension: 4/5
Elements unlock, choices deepen"]
T5["12-18 min
🟡 Adaptation
Tension: 3/5
Wraiths require new tactics"]
T6["18-22 min
🟠 Pressure
Tension: 4/5
Titans appear, Corruption climbing"]
T7["22-25 min
🔴 Peak
Tension: 5/5
Overflow approaching, all systems active"]
T8["25-30 min
🟢 Climax
Tension: 5/5
Overflow event, prestige decision!"]
end
T1 --> T2 --> T3 --> T4 --> T5 --> T6 --> T7 --> T8
```
## Milestone Rewards
```mermaid
graph LR
subgraph "Gameplay Milestones"
M1["🏆 First Conduit
Place first tower
Reward: See projectiles fire
Toast: ' defenses active!'"]
M2["🏆 First Blood
Defeat first enemy
Reward: +5 Energy
Toast: 'The purge begins!'"]
M3["🏆 Wave Clear
Complete Wave 1
Reward: Upgrades unlock
Toast: 'Wave 1 Complete!'"]
M4["🏆 Perfect Defense
Wave with 0 gate damage
Reward: +1 Resonance Crystal
Toast: 'PERFECT WAVE!'"]
M5["🏆 First Link
Create Conduit connection
Reward: +5 Charge
Toast: 'Network established!'"]
M6["🏆 Elemental Mastery
Choose first element
Reward: New Conduit color/effects
Toast: 'Element attuned!'"]
M7["🏆 Overload
First Gate Overload hit 5+ enemies
Reward: -5 Corruption
Toast: 'Overload successful!'"]
M8["🏆 Wraith Slayer
Defeat first Storm Wraith
Reward: +25 Energy, +10 Charge
Toast: 'Storm Wraith purged!'"]
M9["🏆 Titan Falls
Defeat first Corruption Titan
Reward: +5 Resonance
Toast: 'TITAN DESTROYED!'"]
M10["🏆 Overflow Survivor
Survive Corruption Overflow
Reward: +20-50 Resonance
Toast: 'OVERFLOW SURVIVED!'"]
M11["✨ First Prestige
Complete first prestige
Reward: Legendary Conduit + acceleration
Toast: 'A NEW CYCLE BEGINS!'"]
end
```
## Tutorial / First-Time Flow
```mermaid
sequenceDiagram
actor Player
participant Canvas as Game Canvas
participant UI as Game UI
participant Wave as Wave Manager
Note over Player,UI: First 60 Seconds
Player->>Canvas: loads game
Canvas->>Player: show tutorial overlay (4 bullets)
Player->>Canvas: dismiss tutorial (click)
Canvas->>UI: hide overlay, show HUD (Energy: 50, Charge: 10)
Wave->>Canvas: spawn Wave 1 countdown (3s)
Canvas->>UI: show "WAVE 1 INCOMING" toast
Wave->>Canvas: spawn 5 Corruption Spawns along Ley Lines
Note over Canvas: Enemies visible, moving toward Gate
Canvas->>UI: highlight junction points (pulse glow)
UI->>Player: tooltip "Click to place Conduit (25 Energy)"
Player->>Canvas: click junction point
Canvas->>Canvas: Conduit appears with spawn animation
Canvas->>Canvas: Conduit fires projectile at nearest enemy
Note over Canvas: Visual feedback: projectile hits, enemy HP bar drops
Canvas->>Entity: enemy dies (hp <= 0)
Canvas->>Canvas: spawn Energy Orb at death location
Canvas->>Canvas: Orb flows along Ley Line to Gate
Canvas->>UI: floating "+5 Energy" at Gate
UI->>UI: Energy counter animates 50→55
Wave->>Canvas: all enemies defeated
Wave->>UI: toast "WAVE 1 COMPLETE!"
UI->>Player: show "Perfect Wave! +1 Resonance" (if 0 damage)
Canvas->>UI: Resonance Crystal appears (if perfect)
```
## Entity Spawn/Unlock State Machines
### Conduit (Player Structure)
```mermaid
stateDiagram-v2
[*] --> Available: game start (3 junctions visible)
Available --> Placing: player clicks junction + canAfford(25 Energy)
Placing --> Active: spawn animation (200ms) + Energy deducted
Active --> Firing: enemy in range
Firing --> Active: cooldown complete
Active --> Upgrading: player clicks + canAfford(upgrade cost)
Upgrading --> Active: upgrade applied (visible stat increase)
Active --> Repositioning: player drags (costs 10 Energy)
Repositioning --> Active: placed at new junction
Active --> Destroyed: player sells (50% refund)
Destroyed --> [*]: remove from Canvas
note right of Available
Visual: junction points pulse
Clickable: yes
Cost preview: 25 Energy (scales with count)
end note
note right of Active
Visual: glowing orb (color = element)
Range circle: visible when selected
Stats: damage, range, fire rate
Projectile: elemental color
end note
note right of Firing
Animation: recoil/glow flash
Projectile sprite: based on element
Target: nearest enemy on Ley Line
Fire rate: modified by upgrades
end note
```
### Corruption Spawn (Basic Enemy)
```mermaid
stateDiagram-v2
[*] --> Locked: game start
Locked --> Spawning: wave starts
Spawning --> Active: spawn animation (150ms)
Active --> Moving: on Ley Line, toward Gate
Moving --> Active: constant movement
Active --> Hit: takes damage from Conduit/Zap
Hit --> Active: HP > 0
Hit --> Dying: HP <= 0
Dying --> Dead: death animation (300ms)
Dead --> [*]: drop Energy Orb, remove
note right of Spawning
Trigger: wave spawn schedule
Position: Ley Line edge
Animation: scale 0→1
Invulnerable: 150ms
end note
note right of Moving
Speed: base 40 px/sec
Path: follows Ley Line
HP: 100 (scales with wave)
Reward: 5 Energy (scales with wave)
end note
note right of Dying
Visual: particle burst
Spawn: Energy Orb at position
Sound: death.mp3
Duration: 300ms
end note
```
### Storm Wraith (Fast Enemy)
```mermaid
stateDiagram-v2
[*] --> Locked: game start
Locked --> Unlocked: corruption >= 50
Unlocked --> Spawning: wave includes Wraith type
Spawning --> Active: spawn animation (200ms, teleport effect)
Active --> Moving: on Ley Line
Moving --> Teleporting: every 3 seconds
Teleporting --> Active: teleport forward (200px)
Active --> Hit: takes damage
Hit --> Active: HP > 0
Hit --> Dying: HP <= 0
Dying --> Dead: death animation + lightning burst
Dead --> [*]: drop Energy Orb + Charge Spark
note right of Locked
Condition: corruption >= 50
Wave minimum: 12
Not visible until unlocked
end note
note right of Teleporting
Visual: fade out (100ms) → move → fade in (100ms)
Distance: 200px forward along path
Cooldown: 3 seconds
Warning: slight flicker before teleport
end note
note right of Dead
Reward: 15 Energy + 3 Charge
Visual: electrical explosion
Sound: wraithDeath.mp3
end note
```
### Corruption Titan (Boss Enemy)
```mermaid
stateDiagram-v2
[*] --> Locked: game start
Locked --> Unlocked: corruption >= 75
Unlocked --> Spawning: boss wave triggered
Spawning --> Active: dramatic spawn (500ms, screen shake)
Active --> Moving: slow movement along Ley Line
Moving --> SpawnMinions: takes damage > 25%
SpawnMinions --> Active: spawns 2 Corruption Spawns
Active --> Hit: takes damage
Hit --> Active: HP > 0
Hit --> Dying: HP <= 0
Dying --> Dead: dramatic death (1s)
Dead --> [*]: drop large Energy Orb + Resonance Crystal
note right of Locked
Condition: corruption >= 75
Wave minimum: 18
Toast: "TITAN APPROACHES!" on unlock
end note
note right of SpawnMinions
Trigger: every 25% damage taken
Spawns: 2 Corruption Spawns nearby
Cooldown: 5 seconds between spawns
Visual: Titan pulses, spawns burst out
end note
note right of Dead
Reward: 100 Energy + Resonance (bossLevel * 2)
Visual: massive explosion, screen flash
Sound: titanDeath.mp3 (dramatic)
Duration: 1000ms
end note
```
## Wave/Round State Machine
```mermaid
stateDiagram-v2
[*] --> PreWave: game start / previous wave complete
PreWave --> Countdown: 1 second buffer
Countdown --> Spawning: countdown complete (3s)
Spawning --> Active: all enemies spawned
Active --> BossPhase: boss wave trigger
Active --> WaveComplete: all enemies defeated
BossPhase --> WaveComplete: boss defeated
WaveComplete --> Reward: calculate rewards
Reward --> PerfectCheck: check gate damage
PerfectCheck --> PreWave: next wave begins
PerfectCheck --> OverflowCheck: corruption >= 100
OverflowCheck --> OverflowEvent: trigger overflow
OverflowEvent --> PreWave: overflow complete, corruption reset
note right of PreWave
UI: "Wave {n} incoming!" (2s)
Canvas: spawn indicators pulse on edges
Player: can place/upgrade Conduits
Duration: 4 seconds total
end note
note right of Spawning
Enemies spawn from Ley Line edges
Spawn interval: 0.5s per enemy
Enemy types: based on wave + corruption
Visual: each enemy has spawn animation
end note
note right of Active
Player can: Zaps, Overload, reposition
Conduits: auto-fire at targets
Links: damage crossing enemies
Corruption: +0.5 per spawn
end note
note right of WaveComplete
UI: toast "Wave {n} Complete!"
Canvas: brief flash
Rewards: Energy (25 * waveNum)
Corruption: +5 base
end note
note right of PerfectCheck
If gateDamage == 0:
- +Resonance (waveNum)
- Spawn Resonance Crystal
- +15 Charge
- Toast: "PERFECT WAVE!"
end note
note right of OverflowEvent
Trigger: corruption >= 100
Spawn: 3 Titans + 20 Wraiths + Spawns
Reward: +20-50 Resonance on win
Corruption: reset to 0
Duration: 2-3 minutes
end note
```
## Upgrade Tiers
```mermaid
graph TD
subgraph "Tier 1: Basic Upgrades (Available Start)"
T1D["Damage I\n15 Energy\n+10% damage"]
T1R["Range I\n20 Energy\n+10% range"]
T1S["Speed I\n25 Energy\n+15% fire rate"]
T1D --> T1D2["Damage II\n18 Energy\n+20% total"]
T1R --> T1R2["Range II\n24 Energy\n+20% total"]
end
subgraph "Tier 2: Elemental Paths (Unlock Wave 7, Choose 1)"
T2F["🔥 Fire\n25 Charge\n+50% damage, -20% range\nProjectile: orange fireball"]
T2A["💨 Air\n25 Charge\n+40% range, -15% damage\nProjectile: blue bolt"]
T2E["🌍 Earth\n25 Charge\n+30% slow on hit\nProjectile: green burst"]
T2V["🌀 Void\n40 Charge\n-20% enemy power\nProjectile: purple void"]
end
subgraph "Tier 3: Advanced Mastery (Unlock Wave 15)"
T3P["Piercing Shots\n50 Charge\nProjectiles hit 2 enemies"]
T3S["Splash Damage\n50 Charge\n+30% AOE radius"]
T3C["Chain Lightning\n50 Charge\n+20% bounce to 2 targets"]
T3F["Frost Chamber\n50 Charge\n+20% slow stacking"]
end
T1D2 & T1R2 --> T2F & T2A & T2E
T2F & T2A & T2E & T2V --> T3P & T3S & T3C & T3F
```
## CONFIG Spec: progression and waves Sections
```javascript
// Wave System
CONFIG.waves = {
baseEnemyCount: 5,
enemyCountGrowth: 1.15,
spawnInterval: 0.5,
preWaveCountdown: 3,
bossWaveInterval: 10,
firstBossWave: 10,
};
CONFIG.waveComposition = {
// Algorithm-based composition
getEnemies: function(waveNum) {
const baseCount = Math.floor(CONFIG.waves.baseEnemyCount * Math.pow(CONFIG.waves.enemyCountGrowth, waveNum - 1));
const enemies = [];
// Base: always Corruption Spawns
const spawnCount = Math.ceil(baseCount * 0.7);
for (let i = 0; i < spawnCount; i++) {
enemies.push({ type: 'spawn', delay: i * CONFIG.waves.spawnInterval });
}
// Wraiths: add from wave 12, scaling with corruption
if (waveNum >= 12 && this.corruption >= 50) {
const wraithCount = Math.ceil(baseCount * 0.2 * (this.corruption / 100));
for (let i = 0; i < wraithCount; i++) {
enemies.push({ type: 'wraith', delay: i * CONFIG.waves.spawnInterval * 1.5 });
}
}
// Titans: boss waves (every 10) + corruption >= 75
if (waveNum % CONFIG.waves.bossWaveInterval === 0 || this.corruption >= 75) {
const titanCount = waveNum % CONFIG.waves.bossWaveInterval === 0 ? Math.floor(waveNum / 10) : 1;
for (let i = 0; i < titanCount; i++) {
enemies.push({ type: 'titan', delay: baseCount * CONFIG.waves.spawnInterval + i * 2 });
}
}
return enemies;
},
// Enemy stats by wave
getEnemyStats: function(type, waveNum) {
const baseStats = {
spawn: { hp: 100, speed: 40, reward: 5 },
wraith: { hp: 60, speed: 80, reward: 15 },
titan: { hp: 500, speed: 20, reward: 100 },
};
const multiplier = 1 + (waveNum - 1) * 0.12;
const stats = baseStats[type];
return {
hp: Math.floor(stats.hp * multiplier),
speed: stats.speed,
reward: Math.floor(stats.reward * (1 + waveNum * 0.15)),
};
},
};
// Unlock System
CONFIG.unlocks = {
firstConduit: {
requirement: 'energy >= 25',
unlocks: 'conduitPlacement',
toast: 'Click junctions to place Conduits!',
indicator: 'junction-pulse',
},
conduitUpgrades: {
requirement: 'waveComplete >= 1',
unlocks: 'upgradesPanel',
toast: 'Conduit upgrades available!',
indicator: 'panel-glow',
},
precisionZap: {
requirement: 'charge >= 5 && waveComplete >= 1',
unlocks: 'precisionZapAbility',
toast: 'Click enemies to Zap them!',
indicator: 'ability-unlock',
},
linkMechanic: {
requirement: 'waveComplete >= 3',
unlocks: 'linkCreation',
toast: 'Drag between Conduits to create Links!',
indicator: 'link-tutorial',
},
gateOverload: {
requirement: 'waveComplete >= 5',
unlocks: 'gateOverloadAbility',
toast: 'Click the Gate for Overload!',
indicator: 'gate-pulse',
},
elementalFire: {
requirement: 'waveComplete >= 7 && charge >= 25',
unlocks: 'elementFire',
toast: 'Fire element unlocked!',
indicator: 'element-tab-fire',
},
elementalAir: {
requirement: 'waveComplete >= 7 && charge >= 25',
unlocks: 'elementAir',
toast: 'Air element unlocked!',
indicator: 'element-tab-air',
},
elementalEarth: {
requirement: 'waveComplete >= 10 && charge >= 25',
unlocks: 'elementEarth',
toast: 'Earth element unlocked!',
indicator: 'element-tab-earth',
},
elementalVoid: {
requirement: 'waveComplete >= 10 && charge >= 40',
unlocks: 'elementVoid',
toast: 'Void element unlocked!',
indicator: 'element-tab-void',
},
wraithEnemy: {
requirement: 'corruption >= 50',
unlocks: 'enemyWraith',
toast: 'STORM WRATHS APPEAR!',
indicator: 'warning-overlay',
},
titanEnemy: {
requirement: 'corruption >= 75',
unlocks: 'enemyTitan',
toast: 'CORRUPTION TITANS RISE!',
indicator: 'warning-overlay',
},
advancedUpgrades: {
requirement: 'waveComplete >= 15',
unlocks: 'tier3Upgrades',
toast: 'Advanced upgrades available!',
indicator: 'upgrade-glow',
},
prestigeTeaser: {
requirement: 'waveComplete >= 20',
unlocks: 'prestigeButtonVisible',
toast: 'Prestige approaches...',
indicator: 'prestige-gray',
},
prestigeAvailable: {
requirement: 'overflowSurvived >= 1 || waveComplete >= 25',
unlocks: 'prestigeClickable',
toast: 'PRESTIGE AVAILABLE!',
indicator: 'prestige-glow',
},
};
// Milestones
CONFIG.milestones = [
{ id: 'firstConduit', trigger: 'conduitsPlaced >= 1', reward: { energy: 0 }, toast: 'Defenses active!' },
{ id: 'firstBlood', trigger: 'enemiesKilled >= 1', reward: { energy: 5 }, toast: 'The purge begins!' },
{ id: 'wave1', trigger: 'wavesCompleted >= 1', reward: { energy: 25 }, toast: 'Wave 1 Complete!' },
{ id: 'perfectWave1', trigger: 'perfectWaves >= 1', reward: { resonance: 1 }, toast: 'PERFECT WAVE!' },
{ id: 'firstLink', trigger: 'linksCreated >= 1', reward: { charge: 5 }, toast: 'Network established!' },
{ id: 'elementalChoice', trigger: 'elementUnlocked >= 1', reward: { charge: 10 }, toast: 'Element attuned!' },
{ id: 'overloadHit', trigger: 'overloadHits >= 5', reward: { corruption: -5 }, toast: 'Overload successful!' },
{ id: 'wraithSlayer', trigger: 'wraithsKilled >= 1', reward: { energy: 25, charge: 10 }, toast: 'Storm Wraith purged!' },
{ id: 'titanSlayer', trigger: 'titansKilled >= 1', reward: { resonance: 5 }, toast: 'TITAN DESTROYED!' },
{ id: 'overflowSurvivor', trigger: 'overflowsSurvived >= 1', reward: { resonance: 20 }, toast: 'OVERFLOW SURVIVED!' },
];
// Upgrade Tiers
CONFIG.upgradeTiers = {
tier1: {
unlock: 'always',
mutuallyExclusive: false,
upgrades: {
damage1: { cost: { energy: 15 }, effect: 'damage+10%', maxLevel: 1 },
damage2: { cost: { energy: 18 }, effect: 'damage+20%total', requires: 'damage1', maxLevel: 1 },
range1: { cost: { energy: 20 }, effect: 'range+10%', maxLevel: 1 },
range2: { cost: { energy: 24 }, effect: 'range+20%total', requires: 'range1', maxLevel: 1 },
speed1: { cost: { energy: 25 }, effect: 'fireRate+15%', maxLevel: 1 },
},
},
tier2: {
unlock: 'waveComplete >= 7',
mutuallyExclusive: true,
choices: ['fire', 'air', 'earth', 'void'],
upgrades: {
fire: { cost: { charge: 25 }, effect: '+50%damage,-20%range', projectile: 'orange' },
air: { cost: { charge: 25 }, effect: '+40%range,-15%damage', projectile: 'blue' },
earth: { cost: { charge: 25 }, effect: '+30%slowOnHit', projectile: 'green' },
void: { cost: { charge: 40 }, effect: '-20%enemyPower', projectile: 'purple' },
},
},
tier3: {
unlock: 'waveComplete >= 15',
mutuallyExclusive: true,
choices: ['piercing', 'splash', 'chain', 'frost'],
upgrades: {
piercing: { cost: { charge: 50 }, effect: 'piercing+2', visible: 'projectiles penetrate' },
splash: { cost: { charge: 50 }, effect: 'aoe+30%', visible: 'explosion on hit' },
chain: { cost: { charge: 50 }, effect: 'bounce+2', visible: 'lightning chain' },
frost: { cost: { charge: 50 }, effect: 'slowStack+20%', visible: 'frost trail' },
},
},
};
// Prestige System
CONFIG.prestige = {
teaserWave: 20,
minWave: 25,
formula: 'floor(perfectWaves * 0.5 + overflowCount * 10 + firstPrestigeBonus)',
firstPrestigeBonus: 10,
resets: ['energy', 'charge', 'corruption', 'conduits', 'upgrades', 'wave'],
persists: ['resonance', 'prestigeUpgrades', 'milestones', 'overflowCount'],
visualTiers: [
{
tier: 0,
minPrestiges: 0,
background: '#1a1a2e',
gateColor: '#00d4ff',
enemyPalette: null,
},
{
tier: 1,
minPrestiges: 1,
background: '#1a1a2e',
gateColor: '#FFD700',
gateEffect: 'elemental-glow',
enemyPalette: { hueShift: 30 },
},
{
tier: 2,
minPrestiges: 3,
background: '#16213e',
gateColor: '#9B59B6',
gateEffect: 'crackling-energy',
enemyPalette: { hueShift: 60, saturation: 1.2 },
},
{
tier: 3,
minPrestiges: 5,
background: '#0f0f1a',
gateColor: '#ff6b35',
gateEffect: 'storm-aura',
enemyPalette: { hueShift: 120, saturation: 1.5 },
},
],
upgrades: {
legendaryConduit: {
cost: { resonance: 0 },
effect: 'start with 1 legendary Conduit',
once: true,
visible: 'pre-placed legendary tower on start',
},
energyAffinity: {
cost: { resonance: 3 },
maxLevel: 3,
effect: ['+10%', '+20%', '+35%'],
stat: 'energyGain',
},
elementalMastery: {
cost: { resonance: [1, 2, 4, 6, 10] },
maxLevel: 5,
effect: ['+10%', '+20%', '+35%', '+50%', '+75%'],
stat: 'elementDamage',
unlocksAt5: 'legendaryConduitEffect',
},
leyLineExpansion: {
cost: { resonance: 5 },
maxPurchases: 5,
effect: '+2 junction points per Ley Line',
visible: 'more junction points visible',
},
chargeReserve: {
cost: { resonance: 4 },
maxLevel: 2,
effect: ['+10', '+20'],
stat: 'maxCharge',
visible: 'Charge cap increased',
},
linkMastery: {
cost: { resonance: 6 },
maxLevel: 1,
effect: 'Links start unlocked in Run 2+',
visible: 'Link ability available immediately',
},
},
acceleration: {
run2StartEnergy: 60,
run2StartCharge: 15,
run2LinksUnlocked: true,
run2LegendaryConduit: true,
run2EnergyGain: '+20%',
},
};
```
## Anti-Frustration Features
- **Stuck Detection**: If no wave cleared in 120 seconds, temporarily boost Conduit damage by 50%
- **Catchup**: Poor elemental choices can be recovered by saving Charge for respec (50 Charge = reset element choice)
- **Visual Progress**: All locked upgrades show progress bars (e.g., "12/25 Charge for Fire")
- **Generous Early Game**: First 3 waves have reduced enemy count to ensure early success
- **Charge Overflow**: At 100 Charge, auto-convert to Resonance (when unlocked) instead of wasting
- **Corruption Mercy**: If Corruption reaches 95, pause spawn rate for 10 seconds to let player recover
- **Perfect Wave Forgiveness**: Gate HP threshold allows 1-2 leaky enemies while still counting as "perfect" for early waves
## Motivator Summary
| Timeframe | What Drives the Player |
|-----------|----------------------|
| Next 30 sec | Almost can afford next Conduit or upgrade, watching projectiles hit |
| Next 2 min | Building toward first Link or Elemental choice |
| Next 5 min | Unlocking all elements, choosing specialization |
| Next 10 min | Mastering Links, preparing for Wraiths/Titans |
| Session | Surviving Corruption Overflow, earning Resonance for prestige |
Ui Ux
{
"gameId": "Game-1771146744592-gl4u",
"jobId": 68,
"section": "ui-ux",
"colorPalette": {
"background": {
"primary": "#1a1a2e",
"secondary": "#16213e",
"tertiary": "#2a2a4e"
},
"canvas": "#0f0f1a",
"text": {
"primary": "#e0e0e0",
"secondary": "#a0a0a0",
"muted": "#606060"
},
"accent1": "#FFD700",
"accent2": "#00D4FF",
"accent3": "#9B59B6",
"success": "#4CAF50",
"warning": "#FF9800",
"danger": "#F44336",
"prestige": "#9B59B6"
},
"canvas": {
"width": 900,
"height": 500,
"backgroundColor": "#0f0f1a",
"gridCellSize": 16,
"layers": [
"background",
"leyLines",
"junctions",
"gate",
"entities",
"links",
"collectibles",
"effects",
"hudOverlay"
]
},
"ui": {
"tickRate": 30,
"autoSaveInterval": 30000,
"theme": "dark",
"hudHeight": 40,
"bottomPanelHeight": 280,
"bottomPanelCollapsedHeight": 40,
"canvasMinHeight": 450,
"tabs": [
{
"id": "conduits",
"label": "Conduits",
"icon": "🗼",
"unlockedAt": "gameStart"
},
{
"id": "upgrades",
"label": "Upgrades",
"icon": "⬆️",
"unlockedAt": "waveComplete >= 1"
},
{
"id": "elements",
"label": "Elements",
"icon": "⚡",
"unlockedAt": "waveComplete >= 7"
},
{
"id": "mastery",
"label": "Mastery",
"icon": "✨",
"unlockedAt": "waveComplete >= 15"
}
],
"notifications": {
"toastDuration": 3000,
"toastPosition": "top-right",
"milestoneDisplayDuration": 5000,
"stackLimit": 3
}
},
"effects": {
"particles": {
"energyOrbCollection": {
"count": 3,
"sprite": "spark",
"lifetime": 300,
"spread": 10
},
"enemyDeath": {
"count": 5,
"sprite": "spark",
"lifetime": 400,
"spread": 15
},
"wraithDeath": {
"count": 10,
"sprite": "spark",
"lifetime": 500,
"spread": 25
},
"titanDeath": {
"count": 30,
"sprite": "spark",
"lifetime": 1000,
"spread": 50
},
"conduitPlacement": {
"count": 5,
"sprite": "spark",
"lifetime": 200,
"spread": 15
}
},
"floatingText": {
"duration": 800,
"riseSpeed": 40,
"fontSize": 14,
"fontWeight": "bold",
"colors": {
"energy": "#FFD700",
"charge": "#00D4FF",
"resonance": "#9B59B6",
"damage": "#FF4444",
"heal": "#44FF44"
}
},
"screenFlash": {
"waveComplete": {
"color": "#FFFFFF",
"opacity": 0.2,
"duration": 200
},
"prestige": {
"color": "#FFFFFF",
"opacity": 0.8,
"duration": 500
},
"perfectWave": {
"color": "#9B59B6",
"opacity": 0.3,
"duration": 300
},
"damageTaken": {
"color": "#FF0000",
"opacity": 0.2,
"duration": 150
}
},
"placementFlash": {
"duration": 200,
"color": "#00D4FF",
"opacity": 0.5
}
},
"entities": {
"conduit": {
"sprite": "circle",
"scale": 2,
"team": "player",
"hp": 100,
"damage": 15,
"attackSpeed": 1,
"attackRange": 80,
"moveSpeed": 0,
"placementCost": 25,
"states": {
"idle": {
"frames": [
0,
1
],
"frameDuration": 500
},
"firing": {
"frames": [
1,
2,
0
],
"frameDuration": 150,
"flash": true
},
"spawning": {
"type": "scaleIn",
"duration": 200
},
"destroyed": {
"type": "scaleOut",
"duration": 200,
"particles": "spark",
"particleCount": 5
}
},
"healthBar": {
"show": true,
"width": 32,
"height": 3,
"yOffset": -16,
"color": "#4CAF50"
},
"projectileType": "elemental"
},
"corruptionSpawn": {
"sprite": "slime",
"scale": 1.5,
"team": "enemy",
"hp": 100,
"damage": 10,
"moveSpeed": 40,
"reward": {
"energy": 5
},
"states": {
"moving": {
"frames": [
0,
1,
2,
3
],
"frameDuration": 300
},
"hit": {
"flash": true,
"duration": 100
},
"dying": {
"type": "fadeOut",
"duration": 300,
"particles": "spark",
"particleCount": 5,
"spawnCollectible": "energyOrb"
},
"spawning": {
"type": "scaleIn",
"duration": 150
}
},
"healthBar": {
"show": true,
"width": 24,
"height": 3,
"yOffset": -12,
"color": "#F44336"
}
},
"stormWraith": {
"sprite": "ghost",
"scale": 1.8,
"team": "enemy",
"hp": 60,
"damage": 15,
"moveSpeed": 80,
"teleportDistance": 200,
"teleportCooldown": 3000,
"reward": {
"energy": 15,
"charge": 3
},
"states": {
"moving": {
"frames": [
0,
1,
2,
3
],
"frameDuration": 200
},
"teleporting": {
"type": "teleport",
"duration": 200
},
"dying": {
"type": "fadeOut",
"duration": 400,
"particles": "spark",
"particleCount": 10,
"spawnCollectible": [
"energyOrb",
"chargeSpark"
]
},
"spawning": {
"type": "teleportIn",
"duration": 200
}
},
"healthBar": {
"show": true,
"width": 28,
"height": 3,
"yOffset": -14,
"color": "#00D4FF"
}
},
"corruptionTitan": {
"sprite": "knight",
"scale": 3,
"team": "enemy",
"hp": 500,
"damage": 50,
"moveSpeed": 20,
"reward": {
"energy": 100,
"resonance": 2
},
"states": {
"moving": {
"frames": [
0,
1,
2,
3
],
"frameDuration": 500
},
"spawnMinions": {
"type": "burst",
"duration": 300,
"spawns": [
"corruptionSpawn",
"corruptionSpawn"
]
},
"dying": {
"type": "explode",
"duration": 1000,
"particles": "spark",
"particleCount": 30,
"spawnCollectible": [
"energyOrb",
"resonanceCrystal"
]
},
"spawning": {
"type": "scaleIn",
"duration": 500,
"screenShake": true
}
},
"healthBar": {
"show": true,
"width": 48,
"height": 4,
"yOffset": -24,
"color": "#9B59B6"
}
},
"elementalProjectile": {
"sprite": "fireball",
"scale": 1.2,
"speed": 300,
"pierceCount": 1,
"lifetime": 2,
"states": {
"flying": {
"frames": [
0,
1,
2,
3
],
"frameDuration": 50,
"rotate": true
},
"impact": {
"type": "burst",
"duration": 100,
"particles": "spark",
"particleCount": 3
}
}
},
"energyOrb": {
"sprite": "diamond",
"scale": 0.8,
"color": "#FFD700",
"glow": true,
"lifetime": 8,
"speed": 150,
"states": {
"spawning": {
"type": "popIn",
"duration": 100
},
"flowing": {
"type": "leyLineFlow",
"speed": 150
},
"absorbed": {
"type": "collect",
"duration": 300
},
"expired": {
"type": "fadeOut",
"duration": 300
}
}
},
"chargeSpark": {
"sprite": "spark",
"scale": 0.5,
"color": "#00D4FF",
"glow": true,
"lifetime": 3,
"states": {
"spawning": {
"type": "burst",
"duration": 150
},
"collected": {
"type": "autoCollect",
"duration": 0
},
"expired": {
"type": "fadeOut",
"duration": 200
}
}
},
"resonanceCrystal": {
"sprite": "diamond",
"scale": 2,
"color": "#9B59B6",
"glow": true,
"lifetime": 10,
"collectRadius": 40,
"autoCollectDelay": 5000,
"states": {
"spawning": {
"type": "dramaticPop",
"duration": 400
},
"waiting": {
"type": "rotate",
"rotationSpeed": 1
},
"collected": {
"type": "collect",
"duration": 500
},
"expired": {
"type": "fadeOut",
"duration": 500
}
}
},
"link": {
"type": "connection",
"color": "#00D4FF",
"glow": true,
"damage": 10,
"states": {
"active": {
"type": "pulse",
"duration": 1000
},
"broken": {
"type": "fadeOut",
"duration": 200
}
}
},
"stormGate": {
"sprite": "circle",
"scale": 4,
"color": "#00D4FF",
"glow": true,
"hp": 1000,
"states": {
"idle": {
"type": "pulse",
"duration": 2000
},
"overload": {
"type": "expandingRing",
"duration": 500,
"radius": 150
},
"absorbing": {
"type": "pulse",
"duration": 300
}
},
"healthBar": {
"show": true,
"width": 64,
"height": 6,
"yOffset": -32,
"color": "#00D4FF"
}
}
},
"controls": [
{
"action": "Place Conduit",
"trigger": "Click junction",
"cost": "25 Energy",
"icon": "🖱️"
},
{
"action": "Precision Zap",
"trigger": "Click enemy",
"cost": "5 Charge",
"icon": "⚡"
},
{
"action": "Create Link",
"trigger": "Drag Conduit to Conduit",
"cost": "15 Charge",
"icon": "↔️"
},
{
"action": "Gate Overload",
"trigger": "Click Storm Gate",
"cost": "50 Charge",
"icon": "⚡"
},
{
"action": "Sell/Reposition",
"trigger": "Right-click Conduit",
"cost": "10 Energy (reposition)",
"icon": "🖱️"
}
],
"tutorial": {
"title": "HOW TO PLAY",
"bullets": [
"Click glowing junctions to place Conduits and defend the Storm Gate",
"Corruption creatures are coming - destroy them all before they reach the center!",
"Kill enemies to earn Energy, use it to build more Conduits and upgrade",
"Perfect defense (0 gate damage) earns bonus Resonance for permanent power"
],
"buttonText": "GOT IT!",
"storageKey": "sgd_tutorial_seen"
},
"settings": [
{
"id": "notation",
"label": "Number Format",
"type": "toggle",
"options": [
"standard",
"scientific"
],
"default": "standard"
},
{
"id": "animationSpeed",
"label": "Animation Speed",
"type": "slider",
"min": 0.5,
"max": 2,
"step": 0.1,
"default": 1
},
{
"id": "autoSaveInterval",
"label": "Auto-Save",
"type": "dropdown",
"options": [
10000,
30000,
60000,
0
],
"labels": [
"10s",
"30s",
"60s",
"Off"
],
"default": 30000
},
{
"id": "canvasQuality",
"label": "Canvas Quality",
"type": "toggle",
"options": [
"high",
"low"
],
"default": "high"
},
{
"id": "exportSave",
"label": "Export Save",
"type": "button"
},
{
"id": "importSave",
"label": "Import Save",
"type": "button"
},
{
"id": "hardReset",
"label": "Hard Reset",
"type": "button",
"confirm": true
}
],
"numberFormatting": {
"suffixes": [
"",
"K",
"M",
"B",
"T"
],
"commaThreshold": 1000,
"kThreshold": 1000000,
"mThreshold": 1000000000,
"bThreshold": 1000000000000
},
"progressBars": {
"corruption": {
"colors": {
"low": "#4CAF50",
"medium": "#FF9800",
"high": "#F44336"
},
"thresholds": [
50,
75
]
}
}
}
Ui Ux
# UI/UX Design - Storm Gate Defenders
## Overview
Storm Gate Defenders presents a dramatic, stormy interface where the Canvas game world is the undisputed star. The visual identity draws from the theme of an ancient portal channeling elemental energy through a corrupted world. Deep blues and purples form the atmospheric background, while bright electrical blues (#00d4ff), gold (#ffd700), and orange (#ff6b35) create striking contrasts for game elements.
The interface is designed around the central truth that this is an action-strategy game where players DIRECTLY interact with the Canvas. Every click matters - placing Conduits on junction points, zapping enemies with precision lightning strikes, dragging between towers to create electrical Links. The bottom panel supports this action but never replaces it. The HUD keeps essential information always visible without obscuring the dramatic lightning-filled battlefield.
The mood is intense and electrical - constant motion, crackling energy, and the ever-present threat of corruption. The UI reflects this with glowing elements, smooth animations, and immediate visual feedback for every action.
## Color Palette
| Role | Color (hex) | Usage |
|------|-------------|-------|
| Background (primary) | #1a1a2e | Main background behind Canvas |
| Background (secondary) | #16213e | Panels, cards, bottom panel |
| Background (tertiary) | #2a2a4e | Hover states, active elements |
| Canvas background | #0f0f1a | The game world background (darkest) |
| Text (primary) | #e0e0e0 | Main text, labels |
| Text (secondary) | #a0a0a0 | Secondary labels, descriptions |
| Text (muted) | #606060 | Disabled, locked items |
| Accent 1 | #FFD700 | Energy currency, primary actions |
| Accent 2 | #00D4FF | Charge currency, abilities, Ley Lines |
| Accent 3 | #9B59B6 | Resonance currency, prestige UI |
| Success | #4CAF50 | Affordable, completed, positive |
| Warning | #FF9800 | Almost affordable, attention |
| Danger | #F44336 | Cannot afford, Corruption, danger |
| Prestige | #9B59B6 | Prestige currency, prestige UI elements |
## Typography
- **Font family**: 'Orbitron', system-ui, -apple-system, sans-serif (Google Font: Orbitron for headers, system fonts for body)
- **Headings**: Weight 600, size 16-22px (uppercase, letter-spacing 1px)
- **Body text**: Weight 400, size 13px
- **Numbers/currencies**: 'Orbitron', weight 600, monospace-aligned for tabular figures
- **Buttons**: Weight 600, size 12px, uppercase
## Screen Layout
### Master Layout
```
+------------------------------------------------------------------------------+
| [HUD BAR - Always visible at top] |
| ⚡ 50 | ⚡ 10/100 | ✨ 0 | ☠️ 0/100 | Wave 1 | ⚙️ |
+------------------------------------------------------------------------------+
| |
| |
| |
| |
| |
| [CANVAS - Main Game World] |
| (~65% of screen height - 500-600px typical) |
| |
| - Storm Gate at center (glowing) |
| - Ley Lines radiating outward |
| - Enemies traveling along paths |
| - Conduits firing projectiles |
| - Energy Orbs flowing back to Gate |
| - Links connecting Conduits |
| |
| |
+------------------------------------------------------------------------------+
| [BOTTOM PANEL - Upgrade/Management] |
| (~35% of screen height - 250-300px, collapsible) |
| +------------------+ +------------------+ +------------------+ +--------+|
| | CONDUITS | | UPGRADES | | ELEMENTS | | ⬆️ ||
| +------------------+ +------------------+ +------------------+ +--------+|
| | [Conduit Cards] | | [Upgrade Cards] | | [Element Icons] | ||
| | | | | | | ||
| +------------------------------------------------------------------------------+
```
### HUD Bar (Always Visible, overlays top of Canvas)
| Element | Position | Content | Behavior |
|---------|----------|---------|----------|
| Energy display | Left | ⚡ icon + amount + rate/sec | Count-up animation (300ms), gold glow on gameplay-earned |
| Charge display | Left (next to Energy) | ⚡ icon + current/max (100) | Count-up animation, cyan glow on skill actions |
| Resonance display | Center-left | ✨ icon + amount | Count-up animation, purple glow on perfect wave |
| Corruption meter | Center-right | ☠️ icon + progress bar (0-100) | Fills red, bar changes color at thresholds |
| Wave counter | Right-center | "Wave X" | Updates on wave start, 2s countdown before |
| Settings button | Far right | ⚙️ icon | Opens settings modal |
### Game World Canvas
- **Dimensions**: 900x500 (responsive, maintains aspect ratio)
- **Background**: Solid color #0f0f1a with animated rain particles and periodic lightning flashes
- **Layers** (drawn in order):
1. Background layer (dark canvas, rain particles, lightning flashes)
2. Ley Lines layer (glowing blue paths from edges to center)
3. Junction points layer (pulse animation on valid build spots)
4. Gate layer (Storm Gate at center with elemental glow)
5. Entity layer (Conduits, enemies, projectiles)
6. Link layer (electrical arcs between Conduits)
7. Collectible layer (Energy Orbs flowing along Ley Lines)
8. Effect layer (damage numbers, death particles, ability effects)
9. HUD overlay layer (health bars, selection indicators, range circles, Overload radius)
- **Camera**: Fixed view (entire battlefield visible at once)
- **Click/touch interaction (CRITICAL)**:
1. **Click on Ley Line junction** → Place Conduit (if affordable, valid position)
2. **Click on placed Conduit** → Select it (show upgrade options, range circle)
3. **Click on enemy** → Precision Zap (if 5+ Charge, cooldown ready)
4. **Click on Storm Gate** → Activate Gate Overload (if 50+ Charge, cooldown ready)
5. **Drag from Conduit to Conduit** → Create Link (if 15+ Charge, valid connection)
6. **Right-click on Conduit** → Reposition/Sell menu
### Entity Visual Specs
#### Conduit (Player Tower)
```mermaid
stateDiagram-v2
[*] --> Placing: player clicks junction + canAfford(25 Energy)
Placing --> Active: spawn animation (200ms) + Energy deducted
Active --> Idle: no targets in range
Active --> Firing: enemy in range
Firing --> Idle: target dead/out of range
Firing --> Active: cooldown complete
Active --> Upgrading: player buys upgrade
Upgrading --> Active: flash effect + stats boosted
Active --> Selected: player clicks
Selected --> Active: click elsewhere/deselect
Active --> Repositioning: player drags (costs 10 Energy)
Repositioning --> Active: placed at new junction
Active --> Destroyed: player sells (50% refund)
Destroyed --> [*]: remove from Canvas
note right of Placing
Animation: scale 0→1
Duration: 200ms
Visual: electrical crackle
end note
note right of Idle
Frames: 0-1
Frame duration: 500ms
Glow: steady pulse
end note
note right of Firing
Frames: 1-2-0
Frame duration: 150ms
Flash: bright glow on fire
Spawns: projectile at frame 1
end note
note right of Selected
Visual: range circle appears
UI: upgrade options show
Border: cyan highlight
end note
note right of Destroyed
Animation: scale 1→0
Particles: 5 sparks
Duration: 200ms
Refund: 50% base cost
end note
```
#### Corruption Spawn (Basic Enemy)
```mermaid
stateDiagram-v2
[*] --> Spawning: wave spawns enemy
Spawning --> Moving: spawn animation (150ms)
Moving --> Moving: constant along Ley Line
Moving --> Hit: takes damage
Hit --> Moving: HP > 0
Hit --> Dying: HP <= 0
Dying --> Dead: death animation (300ms)
Dead --> [*]: spawn Energy Orb, remove
note right of Spawning
Animation: scale 0→1
Duration: 150ms
Position: Ley Line edge
Invulnerable: true during spawn
end note
note right of Moving
Speed: 40 px/sec (scales with wave)
Path: follows Ley Line to Gate
Sprite: slime, dark with red glow
Trail: faint corruption trail
end note
note right of Hit
Visual: flash white
Floating damage number
Sound: hit.mp3
end note
note right of Dying
Animation: fade opacity 1→0
Particles: 5 spark sprites
Spawn: Energy Orb at position
Sound: death.mp3
Duration: 300ms
end note
```
#### Storm Wraith (Fast Enemy)
```mermaid
stateDiagram-v2
[*] --> Spawning: wave includes Wraith (corruption >= 50)
Spawning --> Moving: teleport spawn effect (200ms)
Moving --> Teleporting: every 3 seconds
Teleporting --> Moving: teleport forward (200px)
Moving --> Hit: takes damage
Hit --> Moving: HP > 0
Hit --> Dying: HP <= 0
Dying --> Dead: electrical death (400ms)
Dead --> [*]: spawn Energy Orb + Charge Spark
note right of Spawning
Animation: electrical zap
Duration: 200ms
Warning: flicker before appearing
end note
note right of Teleporting
Visual: fade out (100ms) → move → fade in (100ms)
Distance: 200px forward
Cooldown: 3 seconds
Warning: slight flicker before
end note
note right of Dying
Animation: electrical explosion
Particles: 10 sparks
Spawn: Energy Orb + Charge Spark
Sound: wraithDeath.mp3
Duration: 400ms
end note
```
#### Corruption Titan (Boss Enemy)
```mermaid
stateDiagram-v2
[*] --> Spawning: boss wave (corruption >= 75)
Spawning --> Moving: dramatic spawn (500ms, screen shake)
Moving --> SpawnMinions: damage > 25% threshold
SpawnMinions --> Moving: spawns 2 Spawns
Moving --> Hit: takes damage
Hit --> Moving: HP > 0
Hit --> Dying: HP <= 0
Dying --> Dead: massive death (1000ms)
Dead --> [*]: spawn large Energy Orb + Resonance Crystal
note right of Spawning
Animation: scale 0→1 with shake
Duration: 500ms
Screen shake: 200ms
Toast: "TITAN APPROACHES!"
end note
note right of SpawnMinions
Trigger: every 25% damage
Spawns: 2 Corruption Spawns
Cooldown: 5 seconds
Visual: Titan pulses red
end note
note right of Dying
Animation: massive explosion
Particles: 30 sparks
Spawn: Energy Orb (large) + Resonance Crystal
Screen flash: white
Sound: titanDeath.mp3
Duration: 1000ms
end note
```
#### Elemental Projectile
```mermaid
stateDiagram-v2
[*] --> Flying: spawned by Conduit
Flying --> Impact: hits enemy / lifetime ends
Impact --> [*]: damage + brief flash
note right of Flying
Sprite: based on Conduit element
Speed: 300 px/sec
Rotation: yes (for visual)
Color: elemental (orange/blue/green/purple)
end note
note right of Impact
Duration: 100ms
Visual: small burst
Damage: applied to enemy
end note
```
#### Energy Orb (Collectible)
```mermaid
stateDiagram-v2
[*] --> Spawning: enemy dies
Spawning --> Flowing: spawn animation (100ms)
Flowing --> Flowing: follows Ley Line to Gate
Flowing --> Absorbed: reaches Gate
Absorbed --> [*]: add Energy + UI update
Flowing --> Expired: 8 second lifetime
Expired --> [*]: fade out (300ms)
note right of Spawning
Position: enemy death location
Animation: pop in
Sprite: diamond, gold glow
Scale: 0.8
end note
note right of Flowing
Movement: along nearest Ley Line
Speed: 150 px/sec toward Gate
Visual: leaves faint trail
Lifetime: 8 seconds
end note
note right of Absorbed
Triggers: energy.add(reward)
Visual: Gate pulse
Floating text: "+X ⚡"
Duration: 300ms
end note
```
#### Charge Spark (Auto-collect)
```mermaid
stateDiagram-v2
[*] --> Spawning: skill action (zap kill/link/overload hit)
Spawning --> Collected: immediate auto-collect
Collected --> [*]: add Charge + UI update
Spawning --> Expired: 3 second lifetime
Expired --> [*]: fade out (200ms)
note right of Spawning
Position: action location
Animation: burst (100ms)
Sprite: spark, cyan glow
Scale: 0.5
Lifetime: 3 seconds
end note
note right of Collected
Triggers: charge.add(amount)
Floating text: "+X ⚡" (cyan)
Charge bar: brief glow
Auto: no click needed
end note
```
#### Resonance Crystal (Milestone Collectible)
```mermaid
stateDiagram-v2
[*] --> Spawning: perfect wave complete
Spawning --> Waiting: dramatic spawn (400ms)
Waiting --> Collected: player clicks within 40px OR auto after 5s
Collected --> [*]: add Resonance + dramatic UI
Waiting --> Expired: 10 second lifetime
Expired --> [*]: fade out (500ms)
note right of Spawning
Position: center screen
Animation: scale 0→1 with rotation
Duration: 400ms
Sprite: diamond, purple glow
Scale: 2.0
Rotation: 1 rotation/sec
end note
note right of Collected
Triggers: resonance.add(waveNum)
Dramatic text: "RESONANCE +X!"
Screen shake + particle burst
Sound: resonanceCollect.mp3
Duration: 500ms
end note
```
#### Link (Connection between Conduits)
```mermaid
stateDiagram-v2
[*] --> Active: created by drag (15 Charge)
Active --> Active: damages crossing enemies
Active --> Broken: either Conduit destroyed
Broken --> [*]: remove from Canvas
note right of Active
Visual: electrical arc
Color: cyan with glow
Animation: pulse
Damage: 10 per crossing enemy/sec
Max: 10 Links total
end note
note right of Broken
Animation: fade out (200ms)
Trigger: Conduit sold/destroyed
end note
```
### Entity Interaction Diagram
```mermaid
flowchart LR
subgraph "Player Entities"
Conduit["Conduit\n(fires projectiles)"]
Gate["Storm Gate\n(Overload ability)"]
Link["Link Arc\n(damages crossing)"]
end
subgraph "Enemy Entities"
Spawn["Corruption Spawn\n(basic enemy)"]
Wraith["Storm Wraith\n(teleports)"]
Titan["Corruption Titan\n(spawns minions)"]
end
subgraph "Collectibles"
Orb["Energy Orb\n(flows to Gate)"]
Spark["Charge Spark\n(auto-collect)"]
Crystal["Resonance Crystal\n(click to collect)"]
end
subgraph "Projectiles"
Proj["Elemental Projectile\n(fired by Conduit)"]
Zap["Precision Zap\n(from Gate)"]
end
Conduit -->|"fires"| Proj
Proj -->|"hits"| Spawn
Proj -->|"hits"| Wraith
Proj -->|"hits"| Titan
Gate -->|"fires"| Zap
Zap -->|"hits"| Spawn
Zap -->|"hits"| Wraith
Conduit -->|"drag creates"| Link
Link -->|"damages crossing"| Spawn
Link -->|"damages crossing"| Wraith
Spawn -->|"on death spawns"| Orb
Wraith -->|"on death spawns"| Orb
Wraith -->|"on death spawns"| Spark
Titan -->|"on death spawns"| Orb
Titan -->|"on death spawns"| Crystal
Orb -->|"flows to"| Gate
Zap -->|"kill spawns"| Spark
```
### HUD Overlay (drawn ON the Canvas)
| Element | Position | Content | Behavior |
|---------|----------|---------|----------|
| Entity health bars | Above each entity | Colored bar (green/red) | Width based on HP% |
| Floating damage numbers | At hit location | "-X" in red/white | Float upward, fade 800ms |
| Wave countdown | Top center of canvas | "Wave X incoming in 3..." | Appears 3s before wave |
| Spawn indicators | At Ley Line edges | Pulsing circle | Shows where enemies spawn |
| Range circle | Around selected Conduit | Cyan circle outline | Shows attack range |
| Overload radius | Around Gate when hovering | Expanding ring preview | Shows AOE coverage |
| Link preview | Between Conduits when dragging | Dashed cyan line | Shows potential Link |
| Junction highlights | On Ley Line junctions | Pulsing gold dot | Shows valid build spots |
### Bottom Panel (Upgrade/Management Area)
```
+------------------------------------------------------------------------------+
| [CONDUITS] [UPGRADES] [ELEMENTS] [MASTERY] [ ⬆️ COLLAPSE]|
+------------------------------------------------------------------------------+
| |
| [Active Tab Content Area - Scrollable if needed] |
| |
| Conduits Tab: |
| +--------------+ +--------------+ +--------------+ |
| | 🟡 Conduit | | 🔥 Fire | | 💨 Air | ... |
| | +10% damage | | +50% dmg | | +40% range | |
| | 25 Energy | | 25 Charge | | 25 Charge | |
| +--------------+ +--------------+ +--------------+ |
| |
+------------------------------------------------------------------------------+
```
- **Height**: 250-300px (35% of screen), collapsible to 40px (just tab bar)
- **Collapse button**: Arrow icon (⬆️/⬇️) to minimize panel
- **When collapsed**: Only tab bar visible (single row of icons)
### Navigation / Tab Bar
| Tab | Icon/Label | Unlocked At | Content |
|-----|------------|-------------|---------|
| Conduits | 🗼 Conduits | Game start | Place/manage Conduits, view stats |
| Upgrades | ⬆️ Upgrades | Wave 1 complete | Damage, Range, Speed upgrades |
| Elements | ⚡ Elements | Wave 7 complete | Fire, Air, Earth, Void specs |
| Mastery | ✨ Mastery | Wave 15 complete | Advanced upgrades, prestige info |
**Tab appearance animation**: New tabs fade in with a cyan glow, notification dot pulses for 5 seconds
### Tab Contents
#### Tab 1: Conduits
```
+---------------------------------------+
| CONDUITS |
| +--------+ +--------+ +--------+ |
| | 🟡 None | | 🔥 Fire | | 💨 Air | |
| | Active | | +50% | | +40% | |
| | | | -20% | | -15% | |
| +--------+ +--------+ +--------+ |
| Selected Conduit Stats: |
| • Damage: 15 (+10%) |
| • Range: 80px |
| • Fire Rate: 1.0/sec |
| [Upgrade] [Reposition (10⚡)] [Sell] |
+---------------------------------------+
```
**Elements**:
| Element | Content | Interaction | Visual State |
|---------|---------|-------------|--------------|
| Element cards | Icon, name, effects, cost | Click to apply to selected Conduit | Affordable: cyan border, can afford: green, locked: grayed |
| Selected stats | Current Conduit stats | Read-only display | Updates in real-time |
| Action buttons | Upgrade, Reposition, Sell | Click to execute | Disabled if insufficient funds |
#### Tab 2: Upgrades
```
+---------------------------------------+
| UPGRADES |
| +--------+ +--------+ +--------+ |
| | Damage I | | Range I | | Speed I | |
| | +10% dmg | | +10% rng | | +15% rate| |
| | 15 ⚡ | | 20 ⚡ | | 25 ⚡ | |
| +--------+ +--------+ +--------+ |
| +--------+ +--------+ |
| | Damage II | | Range II | |
| | +20% tot | | +20% tot | |
| | 18 ⚡ | | 24 ⚡ | |
| +--------+ +--------+ |
+---------------------------------------+
```
**Elements**:
| Element | Content | Interaction | Visual State |
|---------|---------|-------------|--------------|
| Upgrade cards | Name, effect, cost | Click to purchase | Affordable: green, can't: red border, maxed: "MAX" badge |
#### Tab 3: Elements
```
+---------------------------------------+
| ELEMENTS |
| Choose an element for your Conduits: |
| +------------+ +------------+ |
| | 🔥 Fire | | 💨 Air | |
| | +50% dmg | | +40% range | |
| | -20% range | | -15% dmg | |
| | 25 ⚡ | | 25 ⚡ | |
| +------------+ +------------+ |
| +------------+ +------------+ |
| | 🌍 Earth | | 🌀 Void | |
| | +30% slow | | -20% enemy | |
| | 25 ⚡ | | 40 ⚡ | |
| +------------+ +------------+ |
+---------------------------------------+
```
**Elements**:
| Element | Content | Interaction | Visual State |
|---------|---------|-------------|--------------|
| Element cards | Icon, name, effects, cost | Click to unlock/apply | Affordable: cyan glow, active: green border, locked: dimmed |
#### Tab 4: Mastery
```
+---------------------------------------+
| MASTERY |
| Prestige Upgrades: |
| +------------------+ |
| | Elemental Mastery | |
| | Level 0/5 | |
| | Cost: 1 ✨ | |
| | +10% dmg | |
| +------------------+ |
| [PRESTIGE INFO] [PRESTIGE BUTTON] |
+---------------------------------------+
```
**Elements**:
| Element | Content | Interaction | Visual State |
|---------|---------|-------------|--------------|
| Mastery cards | Name, level, cost, effect | Click to purchase | Affordable: purple, locked: grayed |
| Prestige button | "PRESTIGE NOW" | Click to open prestige panel | Grayed if not available, glowing if ready |
### Notifications Area
| Element | Content | Behavior |
|---------|---------|----------|
| Toast area | Top-right of screen | Slide in from right, fade after 3s |
| Milestone popup | Center screen overlay | Dramatic fade in, auto-dismiss 5s, click to dismiss |
| Warning messages | Top center | Flash red, shake, 2s duration |
## Component Specifications
### Upgrade Card
```
+----------------------------------+
| [Icon] Upgrade Name [Lvl] |
| [Description text] |
| Effect: +X damage / +Y range |
| Cost: 150 ⚡ [BUY] |
+----------------------------------+
```
- **Affordable state**: Green border (#4CAF50), cyan BUY button, white text
- **Cannot afford state**: Gray border, grayed BUY button, red cost text
- **Maxed state**: Gold border, "MAX" badge, BUY hidden
- **Locked state**: Dimmed with 50% opacity, lock icon overlay
- **Hover (affordable)**: Bright cyan glow, show detailed tooltip
- **Click (affordable)**: Flash green (200ms), particles from card, Conduit visibly changes (if applicable)
- **Click (cannot afford)**: Shake animation, cost flashes red (300ms)
### Currency Display (HUD)
```
⚡ 1,234.5 (+12.3/s)
```
- **Number animation**: Count-up from old to new value (300ms duration)
- **Rate display**: Smaller text, gray, updates every second
- **Large numbers**: K (1,000+), M (1,000,000+), B (1,000,000,000+)
- **Color**: Match accent (Energy: gold, Charge: cyan, Resonance: purple)
- **Earned by gameplay flash**: Bright glow pulse (500ms) when earned from kills/waves
### Milestone/Achievement Toast
```
+----------------------------------+
| ★ ACHIEVEMENT UNLOCKED! |
| First Blood |
| +5 Energy |
+----------------------------------+
```
- **Appearance**: Slide in from right
- **Duration**: 4 seconds
- **Stack behavior**: Maximum 3 toasts visible, stack vertically
### Prestige Panel
```
+----------------------------------+
| ⟳ PRESTIGE |
| |
| You will earn: 15 Resonance |
| Current total: 5 |
| New total: 20 |
| |
| RESETS: |
| • Energy, Charge |
| • Corruption |
| • Conduits, Upgrades |
| • Current wave |
| |
| KEEPS: |
| • Resonance (+15) |
| • Elemental Mastery levels |
| • Ley Line junctions |
| |
| VISUAL CHANGES: |
| • Storm Gate gains elemental glow |
| • Background intensity increases |
| |
| [CANCEL] [PRESTIGE!] |
+----------------------------------+
```
### Tooltip
```
+----------------------------------+
| Upgrade Name (Level 3) |
| Increases Conduit damage |
| Current: +30% |
| Next: +40% |
| Cost: 25 Energy |
+----------------------------------+
```
- **Trigger**: Hover (desktop), long press (mobile)
- **Position**: Above element, clamped to viewport edges
- **Delay**: 200ms hover before showing
- **Style**: Dark background (#2a2a4e), white text, cyan border
## UI Event Flow Diagrams
### Player Places Conduit
```mermaid
sequenceDiagram
actor Player
participant Canvas as Canvas
participant Entities as Entity System
participant Events as EventBus
participant UI as HUD/Panels
Note over Player,UI: Player places a Conduit
Player->>Canvas: clicks junction point
Canvas->>Canvas: check: valid junction?
Canvas->>Canvas: check: canAfford(25 Energy)?
Canvas->>Entities: createConduit(position)
Entities->>Canvas: spawn animation (scale 0→1, 200ms)
Entities->>Events: emit('conduit-placed', {position})
Events->>UI: deduct Energy, update display
Events->>Canvas: placement flash effect (cyan, 200ms)
UI->>UI: Energy counter animates down (300ms)
```
### Enemy Death → Collection
```mermaid
sequenceDiagram
participant Canvas as Canvas
participant Entity as Entity System
participant Events as EventBus
participant Currency as CurrencyManager
participant Collectible as Collectible System
participant UI as HUD Display
Entity->>Entity: enemy.hp <= 0
Entity->>Canvas: death animation (fade + 5 spark particles)
Entity->>Events: emit('enemy-killed', {type, position, reward})
Events->>Currency: calcReward(5 * waveMult)
Events->>Collectible: spawn('energyOrb', position)
Collectible->>Canvas: create orb with pop-in animation
Note over Canvas: Orb flows along Ley Line to Gate
Canvas->>Events: emit('orb-absorbed', {value, gatePosition})
Events->>Currency: energy.add(value)
Events->>UI: floatingText("+{value} ⚡", gatePosition, gold)
Events->>UI: Energy counter count-up (300ms)
Events->>UI: Energy display glow pulse (500ms)
```
### Upgrade Purchase → Visible Effect
```mermaid
sequenceDiagram
actor Player
participant UI as Bottom Panel
participant Events as EventBus
participant Canvas as Game Canvas
participant Entity as Entity System
Player->>UI: clicks upgrade card
UI->>UI: check: canAfford(cost)?
UI->>Events: emit('upgrade-purchased', {type, level})
Events->>UI: deduct currency, animate counter
Events->>Canvas: flash card green (200ms)
Events->>Entity: applyUpgrade(type)
Entity->>Canvas: affected Conduits glow briefly
Canvas->>Canvas: Conduits show visible change (faster/bigger projectiles)
Note over Canvas: Player sees immediate difference
```
### Wave Start → Complete
```mermaid
sequenceDiagram
participant Wave as Wave Manager
participant Canvas as Game Canvas
participant UI as HUD Display
participant Events as EventBus
Wave->>UI: show "Wave X INCOMING" (2s)
Wave->>Canvas: show spawn indicators pulsing
Note over Canvas: 3 second countdown
Wave->>Canvas: spawn enemies along Ley Lines
Canvas->>Canvas: enemies move toward Gate
Note over Canvas: Combat phase
Wave->>Wave: all enemies defeated
Wave->>UI: toast "Wave X COMPLETE!"
Wave->>UI: Wave counter increments
Wave->>Events: check gate damage
alt gate damage == 0
Events->>UI: dramatic "PERFECT WAVE!"
Events->>Canvas: spawn Resonance Crystal (center)
end
```
### UI State Machine
```mermaid
stateDiagram-v2
[*] --> Loading: page load
Loading --> Playing: assets ready
state Playing {
[*] --> PreWave: game start / wave complete
PreWave --> WaveActive: countdown (3s)
WaveActive --> PreWave: all enemies dead
WaveActive --> GameOver: Gate destroyed
state PreWave {
[*] --> Build
Build: Can place/upgrade Conduits
Build: Bottom panel fully interactive
}
state WaveActive {
[*] --> Combat
Combat: Enemies spawning/moving
Combat: Player can Zap, create Links
Combat: Can use Gate Overload
Combat: Bottom panel can collapse
}
}
Playing --> PrestigeConfirm: player clicks Prestige
PrestigeConfirm --> Playing: cancels
PrestigeConfirm --> PrestigeAnimation: confirms
PrestigeAnimation --> Playing: new run starts
Playing --> SettingsModal: gear clicked
SettingsModal --> Playing: modal closed
GameOver --> Playing: restart
```
## Feedback Systems
### Visual Feedback Catalog
| Action | Canvas Feedback | UI Feedback | Duration |
|--------|----------------|-------------|----------|
| Enemy defeated | Death fade + 5 spark particles, floating "+X ⚡" | Energy counter pulses up (500ms glow) | 500ms |
| Wave completed | Screen flash white, brief pause | Toast "Wave X Complete!", wave counter increments | 1s |
| Perfect wave | Resonance Crystal spawns, dramatic particle burst | "PERFECT WAVE!" toast, Resonance counter animates | 2s |
| Purchase upgrade | Conduit glows, projectiles change size/color | Card flashes green, cost animates down | 300ms |
| Cannot afford click | None | Card shakes, cost flashes red | 200ms |
| Conduit placed | Electrical crackle at position, spawn animation | Energy counter animates down | 200ms |
| Link created | Electrical arc appears between Conduits | Charge counter animates down | 300ms |
| Precision Zap | Lightning bolt from Gate to enemy, hit flash | Charge counter animates down | 200ms |
| Gate Overload | Expanding ring from Gate, hit flashes on all enemies | Charge counter animates down | 500ms |
| New unlock | N/A | Tab glows/pulses, notification dot, toast | Until clicked (5s min) |
| Prestige | Canvas fades to white, new world fades in with new colors | Screen flash, transition animation | 1.5s |
| Conduit selected | Range circle appears, cyan border | Stats panel shows Conduit info | Until deselected |
| Enemy takes damage | Flash white, floating damage number | N/A | 200ms (damage num) |
### Number Formatting Rules
| Range | Format | Example |
|-------|--------|---------|
| 0 - 999 | Whole number | 742 |
| 1,000 - 999,999 | With commas | 12,345 |
| 1M - 999.9M | Suffix | 1.5M |
| 1B - 999.9B | Suffix | 42.3B |
| 1T+ | Suffix | 1.2T |
| Rates (/sec) | 1 decimal | +12.3/s |
| Damage numbers | Whole number | -15 |
| Charge (capped) | Current/Max | 85/100 |
### Progress Bars
- **Style**: Rounded corners (4px), flat fill (no stripes)
- **Color**:
- 0-49%: Red (#F44336)
- 50-79%: Orange (#FF9800)
- 80-100%: Green (#4CAF50)
- **Label**: Both percentage and current/max (e.g., "75% | 75/100")
- **Animation**: Smooth fill transition (300ms duration)
## Controls Panel (MANDATORY - Always Visible)
### Controls Panel Layout
```
+------------------------------------------------------------------------------+
| CONTROLS: [🖱️ Click Junction → Place Conduit] [⚡ Click Enemy → Zap] |
| [↔️ Drag Conduits → Link] [⚡ Click Gate → Overload] |
| [🖱️ Right-Click Conduit → Sell] |
+------------------------------------------------------------------------------+
```
- **Position**: Bottom edge of Canvas (overlaying bottom of game world)
- **Always visible**: Semi-transparent overlay, never hidden
- **Content**: All 5 player interactions with icons
- **Style**: Semi-transparent black background (#000000, 70% opacity), white text, 12px
- **Layout**: Two rows, icons left-aligned, monospace for key descriptions
## Getting Started Overlay (MANDATORY - Shows on First Load)
### Tutorial Overlay Layout
```
+------------------------------------------+
| HOW TO PLAY |
| |
| • Click glowing junctions to place |
| Conduits and defend the Storm Gate |
| |
| • Corruption creatures are coming - |
| destroy them all before they reach |
| the center! |
| |
| • Kill enemies to earn Energy, use it |
| to build more Conduits and upgrade |
| |
| • Perfect defense (0 gate damage) earns |
| bonus Resonance for permanent power |
| |
| [ GOT IT! ] |
+------------------------------------------+
```
- **Trigger**: Shows automatically on first page load
- **Dismiss**: "Got it!" button OR click anywhere outside modal
- **Persistence**: localStorage.setItem('sgd_tutorial_seen', 'true'), check on load
- **Content**: 4 concise bullet points from idea.md
- **Style**: Semi-transparent black overlay (#000000, 85% opacity), centered modal (500px width), white text, large green button
- **Z-index**: 9999 (above everything including canvas)
## Responsive Considerations
- **Minimum width**: 1280px (game not optimized below this)
- **Maximum width**: Full viewport
- **Scaling approach**: Canvas scales to fit available width (maintains aspect ratio), bottom panel uses fixed height with overflow
- **Panel collapse behavior**: Bottom panel can collapse to 40px (tab bar only) via collapse button
## Accessibility
- **Contrast ratios**: All text meets WCAG AA minimum 4.5:1 (verified)
- **Focus indicators**: 2px cyan outline (#00D4FF) for keyboard navigation
- **Screen reader**: Currency amounts have aria-live="polite" regions for updates
- **Reduced motion**: Respect prefers-reduced-motion media query — disable particle effects, use static sprites
## Settings Panel
| Setting | Type | Default | Effect |
|---------|------|---------|--------|
| Notation format | Toggle (standard/scientific) | Standard | Changes large number display |
| Animation speed | Slider (0.5x-2x) | 1x | Scales all animation durations and game speed |
| Auto-save interval | Dropdown (10s/30s/60s/off) | 30s | How often game state saves |
| Canvas quality | Toggle (high/low) | High | Low disables glow/particles for performance |
| Hard reset | Button (with confirmation) | N/A | Wipe all data (requires confirmation) |
| Export save | Button | N/A | Copy save string to clipboard |
| Import save | Button | N/A | Paste save string from clipboard |
## CONFIG Spec: canvas, ui, and effects Sections
```javascript
CONFIG.canvas = {
width: 900,
height: 500,
backgroundColor: '#0f0f1a',
gridCellSize: 16,
layers: ['background', 'leyLines', 'junctions', 'gate', 'entities', 'links', 'collectibles', 'effects', 'hudOverlay'],
};
CONFIG.ui = {
tickRate: 30,
autoSaveInterval: 30000,
theme: 'dark',
hudHeight: 40,
bottomPanelHeight: 280,
bottomPanelCollapsedHeight: 40,
canvasMinHeight: 450,
tabs: [
{ id: 'conduits', label: 'Conduits', icon: '🗼', unlockedAt: 'gameStart' },
{ id: 'upgrades', label: 'Upgrades', icon: '⬆️', unlockedAt: 'waveComplete >= 1' },
{ id: 'elements', label: 'Elements', icon: '⚡', unlockedAt: 'waveComplete >= 7' },
{ id: 'mastery', label: 'Mastery', icon: '✨', unlockedAt: 'waveComplete >= 15' },
],
notifications: {
toastDuration: 3000,
toastPosition: 'top-right',
milestoneDisplayDuration: 5000,
stackLimit: 3,
},
};
CONFIG.effects = {
particles: {
energyOrbCollection: { count: 3, sprite: 'spark', lifetime: 300, spread: 10 },
enemyDeath: { count: 5, sprite: 'spark', lifetime: 400, spread: 15 },
wraithDeath: { count: 10, sprite: 'spark', lifetime: 500, spread: 25 },
titanDeath: { count: 30, sprite: 'spark', lifetime: 1000, spread: 50 },
conduitPlacement: { count: 5, sprite: 'spark', lifetime: 200, spread: 15 },
},
floatingText: {
duration: 800,
riseSpeed: 40,
fontSize: 14,
fontWeight: 'bold',
colors: {
energy: '#FFD700',
charge: '#00D4FF',
resonance: '#9B59B6',
damage: '#FF4444',
heal: '#44FF44',
},
},
screenFlash: {
waveComplete: { color: '#FFFFFF', opacity: 0.2, duration: 200 },
prestige: { color: '#FFFFFF', opacity: 0.8, duration: 500 },
perfectWave: { color: '#9B59B6', opacity: 0.3, duration: 300 },
damageTaken: { color: '#FF0000', opacity: 0.2, duration: 150 },
},
placementFlash: { duration: 200, color: '#00D4FF', opacity: 0.5 },
};
CONFIG.colorPalette = {
background: { primary: '#1a1a2e', secondary: '#16213e', tertiary: '#2a2a4e' },
canvas: '#0f0f1a',
text: { primary: '#e0e0e0', secondary: '#a0a0a0', muted: '#606060' },
accent1: '#FFD700',
accent2: '#00D4FF',
accent3: '#9B59B6',
success: '#4CAF50',
warning: '#FF9800',
danger: '#F44336',
prestige: '#9B59B6',
};
```
## Engagement Self-Audit
### Is This Actually A Game?
**30-Second Gameplay Description (No Numbers):**
A dark battlefield fills the screen with glowing blue paths radiating from a central gate. Dark blob-like enemies slither along these paths toward the center. You click a glowing junction point and a turret materializes with an electrical crackle. It immediately begins firing orange projectiles at the approaching enemies. One enemy gets too close, so you click it directly and a lightning bolt zaps from the gate, vaporizing it. The particles from its death flow like a stream along the path back to your gate. You drag from one turret to another, creating a visible electrical arc between them. More enemies approach, crossing the arc and taking damage. The screen is alive with motion — projectiles flying, enemies dying, energy flowing, lightning crackling.
- **Can you describe 30 seconds of gameplay without mentioning numbers, currencies, or upgrades?** YES - above description
- **Does the player interact with the Canvas directly at least every 10 seconds?** YES - placing Conduits, Zapping enemies, creating Links
- **If you removed all upgrade panels, is there still a recognizable game on the Canvas?** YES - tower defense gameplay exists entirely on Canvas
- **Would a bystander understand what's happening?** YES - enemies attacking, towers defending, clear visual feedback
### Feedback Loop Completeness
| Action | Canvas Feedback | UI Feedback |
|--------|----------------|-------------|
| Place Conduit | Electrical spawn animation, crackle effect | Energy counter animates down |
| Enemy dies | Death particles, floating "+X ⚡" | Energy counter pulses up |
| Buy upgrade | Conduit glows, projectiles visibly change | Card flashes green |
| Wave complete | Screen flash, pause | Toast message, wave counter increments |
| Zap enemy | Lightning bolt from Gate, hit flash | Charge counter animates down |
All actions have BOTH Canvas and UI feedback.
### Reward Visibility Check
At any moment player sees:
- Next affordable Conduit/upgrade (cost visible in cards)
- Next unlock threshold (progress bars on locked cards)
- Current production rates (Energy/sec displayed)
### Variable Reward Check
- Wave rewards vary (normal vs perfect wave bonus)
- Different enemy types give different rewards
- Milestones give diverse rewards (new abilities, visual changes)
- Surprise elements: Wraith/Titan unlocks, Overflow events
## Quality Criteria Verification
- [x] Canvas game world is PRIMARY (65% of screen height)
- [x] Upgrade panels are SECONDARY (35% height bottom panel)
- [x] Currency displays ALWAYS visible in HUD
- [x] Every entity type has visual specs (state machines + CONFIG)
- [x] Canvas layers specified (9 layers)
- [x] Every UI element has specified states
- [x] Feedback specified for BOTH Canvas AND UI effects
- [x] Floating damage/reward numbers specified
- [x] Color palette has sufficient contrast
- [x] Tab unlock conditions match progression.md
- [x] Number formatting rules cover full range
- [x] Prestige UI shows visual transformation
- [x] Accessibility basics covered
- [x] Design works at 1280x720 minimum
- [x] Canvas IS the game, not the UI
- [x] Every entity has state machine diagram
- [x] Entity interaction diagram shows relationships
- [x] UI event flows cover all major interactions
- [x] UI state machine shows game phases
- [x] CONFIG.entities spec complete
- [x] CONFIG.canvas spec complete
- [x] CONFIG.ui spec complete
- [x] CONFIG.effects spec complete
- [x] CONFIG.colorPalette complete
- [x] Permanent controls panel designed (5 actions)
- [x] "How to Play" overlay designed (4 bullets)
- [x] Controls panel ALWAYS visible
- [x] Tutorial has dismiss button + localStorage