Eve library

Tri-Planar System Design

Guide

Revision 1

On this page

Document Version: 1.0.0 Game Mode: The Veil War (Mode 1) Design Date: December 2024 Status: Initial Design


Overview#

The Tri-Planar System forms the foundational geography of The Veil War, creating a multi-dimensional battleground where players contest control across three interconnected planes of existence. Each plane operates with distinct mechanics while maintaining meaningful interactions with the others.

Design Principles:

  1. Layered Complexity: Each plane is simple individually, complexity emerges from interactions
  2. Asymmetric Value: Different planes offer different strategic advantages
  3. Cross-Plane Synergy: Controlling multiple planes in a region amplifies benefits
  4. Full Dominion: Complete tri-planar control of a territory grants ultimate power

1. Material Plane#

The Material Plane represents physical reality - the tangible world where armies march, fortresses rise, and resources are extracted. This is the most intuitive plane for traditional strategy players.

1.1 Territory Node Structure#

Node Types:

Node Type Base Capacity Resource Slots Fortification Limit Strategic Value
Heartland 12 units 3 2 High
Borderland 8 units 2 3 Medium-High
Wasteland 6 units 1 1 Low
Sacred Site 4 units 0 0 Variable (cross-plane)
Nexus 10 units 2 2 Critical (all planes)

Node Attributes:

typescript
interface MaterialNode {
  id: string;
  type: 'heartland' | 'borderland' | 'wasteland' | 'sacred_site' | 'nexus';
  position: { x: number; y: number };

  // Capacity and limits
  unitCapacity: number;
  resourceSlots: number;
  fortificationLimit: number;

  // Current state
  controller: PlayerId | null;
  armies: Army[];
  fortifications: Fortification[];
  resources: Resource[];
  supplyStatus: SupplyStatus;

  // Connections
  adjacentNodes: NodeId[];
  supplyRoutes: SupplyRoute[];

  // Cross-plane references
  resonanceNodeId: NodeId; // Corresponding Resonance Plane node
  voidNodeId: NodeId; // Corresponding Void Plane node
}

1.2 Army Units#

Unit Categories:

Infantry (Foundation Units) | Unit | Cost | Strength | Movement | Special | |------|------|----------|----------|---------| | Militia | 1 | 1 | 2 | Recruit anywhere | | Regulars | 2 | 2 | 2 | Standard line unit | | Veterans | 4 | 3 | 2 | +1 defense in fortifications | | Elite Guard | 6 | 4 | 1 | Counter-attack on defense |

Cavalry (Mobile Units) | Unit | Cost | Strength | Movement | Special | |------|------|----------|----------|---------| | Scouts | 2 | 1 | 4 | Reveal fog of war, retreat freely | | Light Cavalry | 3 | 2 | 4 | Flank bonus (+1 attack from rear) | | Heavy Cavalry | 5 | 4 | 3 | Charge (double damage first round) | | War Riders | 7 | 3 | 3 | Ignore terrain penalties |

Siege (Specialized Units) | Unit | Cost | Strength | Movement | Special | |------|------|----------|----------|---------| | Engineers | 3 | 1 | 2 | Build fortifications, reduce siege time | | Siege Engines | 6 | 5 vs forts | 1 | +3 attack vs fortifications | | War Machines | 8 | 3 | 1 | Area damage (hits multiple units) |

Unit Data Structure:

typescript
interface Army {
  id: string;
  unitType: UnitType;
  owner: PlayerId;

  // Stats
  baseCost: number;
  baseStrength: number;
  currentStrength: number; // Can be modified by effects
  movement: number;

  // State
  currentNode: NodeId;
  hasActed: boolean;
  supplyState: 'supplied' | 'foraging' | 'starving';
  morale: number; // 0-100, affects combat effectiveness

  // Modifiers
  attachedCommander: CommanderId | null;
  activeBuffs: Buff[];
  activeDebuffs: Debuff[];

  // Special abilities
  abilities: UnitAbility[];
}

1.3 Resource System#

Resource Types:

Resource Source Primary Use Cross-Plane Synergy
Gold Heartlands, Trade Unit recruitment, upkeep Resonance: Amplify spells
Iron Borderlands Equipment, fortifications Void: Resistance wards
Food Heartlands Supply chain sustenance Material: Army morale
Arcane Ore Sacred Sites Resonance construction Resonance: Required for nodes
Void Essence Corrupted zones Void manipulation Void: Fuel void abilities

Resource Extraction:

typescript
interface Resource {
  type: ResourceType;
  node: NodeId;

  // Production
  baseYield: number;
  currentYield: number; // Modified by improvements, effects
  extractionEfficiency: number; // 0.0 - 1.0

  // Modifiers
  improvementLevel: number; // 0-3
  workerCount: number;
  resonanceBonus: number; // From ley line connection
  voidCorruption: number; // Reduces yield
}

// Resource calculation
function calculateResourceYield(resource: Resource): number {
  const base = resource.baseYield;
  const improvement = 1 + resource.improvementLevel * 0.25;
  const workers = Math.min(resource.workerCount / 3, 1.5);
  const resonance = 1 + resource.resonanceBonus * 0.1;
  const corruption = 1 - resource.voidCorruption * 0.2;

  return Math.floor(base * improvement * workers * resonance * corruption);
}

1.4 Fortification System#

Fortification Types:

Fortification Cost Defense Bonus Garrison Capacity Build Time
Watchtower 3 Gold, 1 Iron +1 2 1 turn
Palisade 5 Gold, 2 Iron +2 4 2 turns
Stone Fort 10 Gold, 5 Iron +4 8 3 turns
Citadel 20 Gold, 10 Iron +6 12 5 turns
Veil Fortress 30 Gold, 15 Iron, 5 Arcane Ore +8, cross-plane resist 16 7 turns

Fortification Mechanics:

typescript
interface Fortification {
  id: string;
  type: FortificationType;
  node: NodeId;
  owner: PlayerId;

  // Defense
  defenseBonus: number;
  garrisonCapacity: number;
  currentGarrison: Army[];

  // State
  integrity: number; // 0-100, affects defense bonus
  underConstruction: boolean;
  turnsRemaining: number;

  // Special features
  hasWatchtower: boolean; // Extends visibility
  hasSupplyCache: boolean; // Local supply for 3 turns
  hasResonanceWard: boolean; // Resists magical attacks
  hasVoidAnchor: boolean; // Resists void corruption
}

// Defense calculation in combat
function calculateDefenseBonus(fort: Fortification, defender: Army): number {
  const integrityFactor = fort.integrity / 100;
  const baseBonus = fort.defenseBonus * integrityFactor;

  // Veteran bonus
  const veteranBonus = defender.unitType === 'veterans' ? 1 : 0;

  // Cross-plane modifiers
  const resonanceWardBonus = fort.hasResonanceWard ? 2 : 0;
  const voidAnchorBonus = fort.hasVoidAnchor ? 2 : 0;

  return baseBonus + veteranBonus + resonanceWardBonus + voidAnchorBonus;
}

1.5 Supply Line System#

Supply lines are critical infrastructure connecting territory nodes and enabling army sustenance.

Supply Mechanics:

Supply Status Effect Duration Limit
Supplied Full combat effectiveness Unlimited
Foraging -25% strength, damages local resources 3 turns
Starving -50% strength, attrition each turn Until supplied or destroyed

Supply Route Definition:

typescript
interface SupplyRoute {
  id: string;
  sourceNode: NodeId;
  targetNode: NodeId;
  owner: PlayerId;

  // Capacity
  throughput: number; // Units suppliable per turn
  distance: number; // Affects delivery time

  // State
  isSecure: boolean; // Not threatened by enemy
  isInterdicted: boolean; // Enemy cavalry/void presence
  efficiency: number; // 0.0 - 1.0, modified by terrain, attacks

  // Requirements
  requiredFortifications: NodeId[]; // Forts that secure this route
  vulnerablePoints: NodeId[]; // Nodes where route can be cut
}

// Supply propagation algorithm
function propagateSupply(
  network: SupplyNetwork,
  sourceNodes: NodeId[]
): Map<NodeId, SupplyStatus> {
  const supplyMap = new Map<NodeId, SupplyStatus>();
  const visited = new Set<NodeId>();
  const queue: { node: NodeId; remaining: number }[] = [];

  // Initialize source nodes
  for (const source of sourceNodes) {
    queue.push({ node: source, remaining: getSupplyCapacity(source) });
    supplyMap.set(source, 'supplied');
  }

  // BFS supply propagation
  while (queue.length > 0) {
    const { node, remaining } = queue.shift()!;
    if (visited.has(node) || remaining <= 0) continue;
    visited.add(node);

    const nodeData = network.nodes.get(node)!;
    const armyDemand = calculateArmyDemand(nodeData.armies);
    const surplus = remaining - armyDemand;

    if (surplus >= 0) {
      supplyMap.set(node, 'supplied');
      // Propagate surplus to connected nodes
      for (const route of nodeData.supplyRoutes) {
        if (route.isSecure && !route.isInterdicted) {
          const deliverable = Math.floor(surplus * route.efficiency);
          queue.push({ node: route.targetNode, remaining: deliverable });
        }
      }
    } else {
      supplyMap.set(node, 'foraging');
    }
  }

  // Mark unreached nodes as starving
  for (const [nodeId] of network.nodes) {
    if (!supplyMap.has(nodeId)) {
      supplyMap.set(nodeId, 'starving');
    }
  }

  return supplyMap;
}

Supply Interdiction:

  • Enemy units in adjacent nodes threaten supply routes
  • Cavalry units can perform "raid" actions to cut supply
  • Void corruption can destabilize supply routes
  • Resonance spells can create temporary supply disruption

2. Resonance Plane#

The Resonance Plane represents the magical infrastructure underlying reality - a network of ley lines connecting power nodes where mystical energies flow and can be harnessed.

2.1 Ley Line Topology#

Ley Line Types:

Line Type Power Flow Capacity Stability Special
Minor Ley 1-2 power/turn 5 High Common, forms base network
Major Ley 3-5 power/turn 15 Medium Connects major nodes
Primal Ley 6-10 power/turn 30 Low Ancient, volatile power
Confluence Variable Unlimited Variable Multiple lines merge

Ley Line Data Structure:

typescript
interface LeyLine {
  id: string;
  type: 'minor' | 'major' | 'primal' | 'confluence';

  // Endpoints
  nodeA: ResonanceNodeId;
  nodeB: ResonanceNodeId;

  // Power characteristics
  basePowerFlow: number;
  currentPowerFlow: number;
  capacity: number;
  stability: number; // 0-100, affects reliability

  // State
  controller: PlayerId | null; // null = contested or neutral
  controlStrength: number; // 0-100
  isDisrupted: boolean;
  disruptionSource: 'void' | 'combat' | 'spell' | null;

  // Flow direction (can be reversed by control)
  flowDirection: 'a_to_b' | 'b_to_a' | 'bidirectional';
}

// Ley line control calculation
function calculateLeyLineControl(
  line: LeyLine,
  state: GameState
): ControlResult {
  const nodeAControl = state.resonanceNodes.get(line.nodeA)!.controller;
  const nodeBControl = state.resonanceNodes.get(line.nodeB)!.controller;

  if (nodeAControl === nodeBControl && nodeAControl !== null) {
    // Same player controls both endpoints
    return { controller: nodeAControl, strength: 100, contested: false };
  }

  if (nodeAControl === null || nodeBControl === null) {
    // At least one endpoint uncontrolled
    const controlled = nodeAControl ?? nodeBControl;
    return { controller: controlled, strength: 50, contested: false };
  }

  // Different players control endpoints - contested
  const strengthA = state.resonanceNodes.get(line.nodeA)!.controlStrength;
  const strengthB = state.resonanceNodes.get(line.nodeB)!.controlStrength;

  if (Math.abs(strengthA - strengthB) < 20) {
    // Closely contested - neither controls
    return { controller: null, strength: 0, contested: true };
  }

  // Stronger side has partial control
  const winner = strengthA > strengthB ? nodeAControl : nodeBControl;
  const difference = Math.abs(strengthA - strengthB);
  return {
    controller: winner,
    strength: Math.min(difference, 75),
    contested: true,
  };
}

2.2 Power Nodes#

Power Node Types:

Node Type Base Power Storage Special Ability
Font 3 10 Generates power each turn
Well 1 30 Stores excess power
Forge 0 5 Converts power to Material effects
Sanctum 2 15 Enhances spell range/power
Nexus 5 50 All abilities, cross-plane anchor

Power Node Mechanics:

typescript
interface ResonanceNode {
  id: string;
  type: 'font' | 'well' | 'forge' | 'sanctum' | 'nexus';
  materialNodeId: NodeId; // Corresponding Material Plane node

  // Power generation and storage
  basePowerGeneration: number;
  currentPowerGeneration: number;
  powerStorage: number;
  maxStorage: number;

  // Control
  controller: PlayerId | null;
  controlStrength: number; // 0-100
  contestingPlayers: PlayerId[];

  // Connections
  connectedLeyLines: LeyLineId[];
  incomingPower: number; // Power flowing in this turn
  outgoingPower: number; // Power flowing out this turn

  // Constructions
  constructions: ResonanceConstruction[];

  // State
  isActivated: boolean; // Can use special ability this turn
  voidCorruption: number; // Reduces effectiveness
}

// Power flow calculation for a network
function calculatePowerDistribution(
  network: ResonanceNetwork
): PowerDistribution {
  const distribution = new Map<ResonanceNodeId, number>();

  // Step 1: Calculate generation
  for (const [nodeId, node] of network.nodes) {
    const corruption = 1 - node.voidCorruption * 0.15;
    const generation = Math.floor(node.basePowerGeneration * corruption);
    distribution.set(nodeId, generation);
  }

  // Step 2: Propagate through ley lines (iterative relaxation)
  for (let iteration = 0; iteration < 10; iteration++) {
    for (const [lineId, line] of network.leyLines) {
      if (line.isDisrupted) continue;

      const nodeA = distribution.get(line.nodeA)!;
      const nodeB = distribution.get(line.nodeB)!;
      const flowCapacity = line.currentPowerFlow * (line.stability / 100);

      // Power flows from higher to lower
      if (nodeA > nodeB) {
        const flow = Math.min((nodeA - nodeB) / 2, flowCapacity);
        distribution.set(line.nodeA, nodeA - flow);
        distribution.set(line.nodeB, nodeB + flow);
      } else if (nodeB > nodeA) {
        const flow = Math.min((nodeB - nodeA) / 2, flowCapacity);
        distribution.set(line.nodeB, nodeB - flow);
        distribution.set(line.nodeA, nodeA + flow);
      }
    }
  }

  // Step 3: Cap at storage limits
  for (const [nodeId, power] of distribution) {
    const node = network.nodes.get(nodeId)!;
    distribution.set(nodeId, Math.min(power, node.maxStorage));
  }

  return distribution;
}

2.3 Casting Zones#

Casting zones define areas where magical abilities can be activated and spells can be cast.

Casting Zone Mechanics:

Zone Type Radius Power Cost Effect
Basic Aura 1 node 2/turn Enable basic spells
Extended Aura 2 nodes 5/turn Enable moderate spells
Domain 3 nodes 10/turn Enable powerful spells
Absolute Authority 4 nodes 20/turn Enable legendary spells

Casting Zone Implementation:

typescript
interface CastingZone {
  id: string;
  sourceNode: ResonanceNodeId;
  owner: PlayerId;

  // Zone properties
  type: 'basic_aura' | 'extended_aura' | 'domain' | 'absolute_authority';
  radius: number;
  powerCostPerTurn: number;

  // Coverage
  coveredMaterialNodes: NodeId[];
  coveredResonanceNodes: ResonanceNodeId[];
  coveredVoidNodes: VoidNodeId[];

  // Spell access
  enabledSpellTiers: SpellTier[];
  spellPowerBonus: number;

  // State
  isActive: boolean;
  turnsSustained: number;
  sustainedPowerInvested: number;
}

// Calculate spell power in a casting zone
function calculateSpellPower(
  zone: CastingZone,
  spell: Spell,
  caster: Commander,
  state: GameState
): number {
  // Base spell power
  let power = spell.basePower;

  // Zone bonus
  power += zone.spellPowerBonus;

  // Caster skill bonus
  power += caster.resonanceSkill * 0.5;

  // Ley line amplification
  const sourceNode = state.resonanceNodes.get(zone.sourceNode)!;
  const leyLineCount = sourceNode.connectedLeyLines.length;
  power += leyLineCount * 2;

  // Sustained zone bonus (zones get stronger over time)
  if (zone.turnsSustained > 3) {
    power += Math.min(zone.turnsSustained - 3, 5);
  }

  // Void corruption penalty
  const corruption = sourceNode.voidCorruption;
  power *= 1 - corruption * 0.1;

  return Math.floor(power);
}

2.4 Veil-Strike Mechanics#

Veil-Strikes are powerful magical attacks that affect the Material Plane from the Resonance Plane.

Veil-Strike Types:

Strike Type Power Cost Material Effect Resonance Effect
Resonance Bolt 5 3 damage to unit Minor ley disruption
Ley Surge 10 5 damage, knockback Strengthen connected lines
Planar Rift 20 Area damage (2 node radius) Create temporary void seepage
Reality Tear 40 Massive damage, terrain change Destabilize all connected nodes
Cataclysm 80 Destroy fortification Create permanent void node

Veil-Strike Resolution:

typescript
interface VeilStrike {
  type: VeilStrikeType;
  caster: CommanderId;
  sourceNode: ResonanceNodeId;
  targetMaterialNode: NodeId;

  // Costs
  powerCost: number;
  additionalCosts: ResourceCost[];

  // Effects
  materialDamage: number;
  materialAreaRadius: number;
  resonanceEffect: ResonanceEffect;
  voidSideEffect: VoidEffect | null;

  // Requirements
  minimumCastingZone: CastingZoneType;
  channelTime: number; // Turns to prepare
  interruptible: boolean;
}

// Resolve a Veil-Strike
function resolveVeilStrike(strike: VeilStrike, state: GameState): StrikeResult {
  const source = state.resonanceNodes.get(strike.sourceNode)!;
  const target = state.materialNodes.get(strike.targetMaterialNode)!;

  // Check power availability
  if (source.powerStorage < strike.powerCost) {
    return { success: false, reason: 'insufficient_power' };
  }

  // Check casting zone requirements
  const zone = findCastingZone(source.id, state);
  if (!zone || !meetsZoneRequirement(zone, strike.minimumCastingZone)) {
    return { success: false, reason: 'insufficient_casting_zone' };
  }

  // Deduct power
  source.powerStorage -= strike.powerCost;

  // Apply material damage
  const damages: UnitDamage[] = [];
  for (const army of target.armies) {
    if (army.owner !== strike.caster) {
      const damage = calculateVeilStrikeDamage(strike, army, state);
      army.currentStrength -= damage;
      damages.push({ unit: army.id, damage });

      // Check for destruction
      if (army.currentStrength <= 0) {
        destroyArmy(army, state);
      }
    }
  }

  // Apply area damage if applicable
  if (strike.materialAreaRadius > 0) {
    const affectedNodes = getNodesInRadius(
      target.id,
      strike.materialAreaRadius,
      state
    );
    for (const nodeId of affectedNodes) {
      applyAreaDamage(nodeId, strike.materialDamage * 0.5, state);
    }
  }

  // Apply resonance effect
  applyResonanceEffect(strike.resonanceEffect, source, state);

  // Apply void side effect if any
  if (strike.voidSideEffect) {
    const voidNode = state.voidNodes.get(target.voidNodeId)!;
    applyVoidEffect(strike.voidSideEffect, voidNode, state);
  }

  return { success: true, damages, resonanceEffect: strike.resonanceEffect };
}

3. Void Plane#

The Void Plane represents entropy, chaos, and the spaces between reality - a dangerous dimension that threatens to unmake both Material and Resonance planes, but offers immense power to those who dare tap it.

3.1 Entropy Zones#

Entropy Zone Levels:

Level Name Spread Rate Effects Reversibility
0 Stable N/A Normal conditions N/A
1 Seepage 5%/turn -10% resource yield Easy
2 Corruption 15%/turn -25% yield, -1 morale Moderate
3 Breach 30%/turn -50% yield, -2 morale, unit attrition Difficult
4 Rupture 50%/turn Void creatures spawn, ley disruption Hard
5 Annihilation 100%/turn Terrain destruction, permanent damage Requires ritual

Entropy Zone Data Structure:

typescript
interface EntropyZone {
  id: string;
  voidNodeId: VoidNodeId;

  // Entropy state
  entropyLevel: 0 | 1 | 2 | 3 | 4 | 5;
  entropyAccumulation: number; // Progress to next level (0-100)
  spreadRate: number; // Percentage chance to spread per turn

  // Effects
  resourceYieldPenalty: number;
  moralePenalty: number;
  attritionRate: number; // Units lost per turn at level 3+

  // Void creature spawning (level 4+)
  spawnTimer: number;
  spawnedCreatures: VoidCreatureId[];

  // Ley line effects
  leyLineDisruption: boolean;
  resonanceNodeCorruption: number;

  // Stabilization attempts
  stabilizationProgress: number; // 0-100
  activeStabilizers: PlayerId[];
}

// Entropy spread calculation
function calculateEntropySpread(
  zone: EntropyZone,
  state: GameState
): SpreadResult[] {
  if (zone.entropyLevel === 0) return [];

  const results: SpreadResult[] = [];
  const voidNode = state.voidNodes.get(zone.voidNodeId)!;

  for (const adjacentId of voidNode.adjacentNodes) {
    const adjacent = state.voidNodes.get(adjacentId)!;
    const adjacentZone = state.entropyZones.get(adjacent.entropyZoneId)!;

    // Can't spread to higher or equal level
    if (adjacentZone.entropyLevel >= zone.entropyLevel) continue;

    // Calculate spread chance
    let spreadChance = zone.spreadRate;

    // Void anchors reduce spread
    const materialNode = state.materialNodes.get(adjacent.materialNodeId)!;
    if (materialNode.fortifications.some((f) => f.hasVoidAnchor)) {
      spreadChance *= 0.5;
    }

    // Resonance stability reduces spread
    const resonanceNode = state.resonanceNodes.get(adjacent.resonanceNodeId)!;
    if (resonanceNode.powerStorage > 20) {
      spreadChance *= 0.75;
    }

    // Roll for spread
    if (Math.random() * 100 < spreadChance) {
      results.push({
        targetZone: adjacentZone.id,
        newLevel: Math.min(
          adjacentZone.entropyLevel + 1,
          zone.entropyLevel
        ) as EntropyLevel,
        spreadChance,
      });
    }
  }

  return results;
}

3.2 Paradox Wells#

Paradox Wells are concentrated points of void energy that can be harnessed for power or cause devastating effects.

Paradox Well Properties:

Property Range Effect
Instability 0-100 Higher = more powerful but risky
Depth 1-5 Determines harvestable void essence
Resonance Negative to Positive Interaction with ley lines
Temporal Flux 0-10 Affects time-based mechanics

Paradox Well Implementation:

typescript
interface ParadoxWell {
  id: string;
  voidNodeId: VoidNodeId;

  // Core properties
  instability: number; // 0-100
  depth: 1 | 2 | 3 | 4 | 5;
  resonanceInteraction: number; // -100 to +100
  temporalFlux: number; // 0-10

  // Harvesting
  voidEssenceYield: number;
  harvestRisk: number; // Chance of negative effect
  harvestedThisTurn: boolean;
  totalHarvested: number; // Affects depletion

  // State
  isCollapsing: boolean;
  collapseProgress: number;
  collapseEffect: CollapseEffect | null;

  // Interactions
  connectedWells: ParadoxWellId[]; // Can form chains
  attractedCreatures: VoidCreatureId[];
}

// Harvest void essence from a paradox well
function harvestParadoxWell(
  well: ParadoxWell,
  harvester: Commander,
  state: GameState
): HarvestResult {
  if (well.harvestedThisTurn) {
    return { success: false, reason: 'already_harvested' };
  }

  // Calculate yield based on depth and harvester skill
  const baseYield = well.depth * 3;
  const skillBonus = harvester.voidSkill * 0.5;
  const instabilityBonus = well.instability * 0.1;
  const yield_ = Math.floor(baseYield + skillBonus + instabilityBonus);

  // Calculate risk
  let risk = well.harvestRisk;
  risk += well.instability * 0.5;
  risk -= harvester.voidSkill * 2;
  risk = Math.max(5, Math.min(95, risk)); // 5-95% range

  // Roll for negative effect
  const negativeEffect = Math.random() * 100 < risk;

  // Mark as harvested
  well.harvestedThisTurn = true;
  well.totalHarvested += yield_;

  // Increase instability
  well.instability = Math.min(100, well.instability + 5);

  // Check for depletion
  if (well.totalHarvested > well.depth * 50) {
    well.isCollapsing = true;
    well.collapseEffect = generateCollapseEffect(well);
  }

  // Apply negative effect if rolled
  let effect: NegativeHarvestEffect | null = null;
  if (negativeEffect) {
    effect = applyNegativeHarvestEffect(well, harvester, state);
  }

  // Grant void essence
  state.players.get(harvester.owner)!.resources.voidEssence += yield_;

  return {
    success: true,
    yield: yield_,
    negativeEffect: effect,
    wellCollapsing: well.isCollapsing,
  };
}

3.3 Hidden Passages#

Hidden Passages are void-based shortcuts that allow rapid movement across the map at great risk.

Passage Types:

Type Distance Risk Level Requirements
Shadow Step 1-2 nodes Low (10%) Void affinity 1+
Void Corridor 3-5 nodes Medium (25%) Void affinity 2+, Void Essence
Abyssal Gate 6-10 nodes High (50%) Void affinity 3+, Paradox Well access
Reality Fold Any distance Extreme (75%) Void affinity 5+, Major ritual

Hidden Passage Implementation:

typescript
interface HiddenPassage {
  id: string;
  type: 'shadow_step' | 'void_corridor' | 'abyssal_gate' | 'reality_fold';

  // Endpoints
  entryVoidNode: VoidNodeId;
  exitVoidNode: VoidNodeId;

  // Properties
  maxDistance: number;
  riskLevel: number; // Base chance of negative effect
  voidAffinityRequired: number;
  voidEssenceCost: number;

  // State
  isDiscovered: boolean;
  discoveredBy: PlayerId[];
  stability: number; // 0-100, affects risk
  usesRemaining: number | null; // null = unlimited

  // Passage effects
  transitTime: number; // Turns to traverse (0 = instant)
  unitCapacity: number; // Max units per use
}

// Use a hidden passage
function useHiddenPassage(
  passage: HiddenPassage,
  units: Army[],
  commander: Commander,
  state: GameState
): PassageResult {
  // Validation
  if (units.length > passage.unitCapacity) {
    return { success: false, reason: 'exceeds_capacity' };
  }

  if (commander.voidAffinity < passage.voidAffinityRequired) {
    return { success: false, reason: 'insufficient_affinity' };
  }

  const player = state.players.get(commander.owner)!;
  if (player.resources.voidEssence < passage.voidEssenceCost) {
    return { success: false, reason: 'insufficient_essence' };
  }

  // Deduct cost
  player.resources.voidEssence -= passage.voidEssenceCost;

  // Calculate actual risk
  let risk = passage.riskLevel;
  risk -= commander.voidSkill * 3;
  risk += (100 - passage.stability) * 0.2;
  risk = Math.max(5, Math.min(90, risk));

  // Process each unit
  const arrivals: Army[] = [];
  const casualties: Army[] = [];
  const corrupted: Army[] = [];

  for (const unit of units) {
    const roll = Math.random() * 100;

    if (roll < risk * 0.3) {
      // Unit lost to void
      casualties.push(unit);
      destroyArmy(unit, state);
    } else if (roll < risk) {
      // Unit arrives but corrupted
      unit.currentNode = getExitMaterialNode(passage.exitVoidNode, state);
      unit.activeDebuffs.push(createVoidCorruptionDebuff());
      corrupted.push(unit);
      arrivals.push(unit);
    } else {
      // Safe arrival
      unit.currentNode = getExitMaterialNode(passage.exitVoidNode, state);
      arrivals.push(unit);
    }
  }

  // Decrease passage stability
  passage.stability = Math.max(0, passage.stability - 10);

  // Decrease uses if limited
  if (passage.usesRemaining !== null) {
    passage.usesRemaining--;
    if (passage.usesRemaining <= 0) {
      collapsePassage(passage, state);
    }
  }

  return {
    success: true,
    arrivals,
    casualties,
    corrupted,
    passageStability: passage.stability,
  };
}

3.4 Void Creatures#

Void Creatures are entities spawned from high-entropy zones that threaten all players.

Creature Types:

Creature Spawn Level Strength Behavior Special
Shadow Wisp 2+ 1 Wander Drains morale
Entropy Hound 3+ 3 Hunt weak units Pack tactics
Void Stalker 4+ 5 Hunt commanders Phase shift
Abyssal Horror 5 10 Destroy everything Area corruption
Reality Eater 5 (rare) 15 Seek ley nodes Consume resonance

Void Creature Implementation:

typescript
interface VoidCreature {
  id: string;
  type: VoidCreatureType;

  // Location (exists on all planes simultaneously)
  currentVoidNode: VoidNodeId;
  currentMaterialNode: NodeId;
  currentResonanceNode: ResonanceNodeId;

  // Stats
  strength: number;
  currentHealth: number;
  maxHealth: number;
  movement: number;

  // Behavior
  behaviorPattern:
    | 'wander'
    | 'hunt_weak'
    | 'hunt_commanders'
    | 'destroy_all'
    | 'seek_resonance';
  currentTarget: UnitId | NodeId | null;
  aggroRange: number;

  // Abilities
  abilities: VoidCreatureAbility[];
  passiveEffects: PassiveEffect[];

  // State
  isEnraged: boolean;
  enrageThreshold: number;
  turnsActive: number;
  killCount: number;
}

// Void creature AI behavior
function executeVoidCreatureTurn(
  creature: VoidCreature,
  state: GameState
): CreatureTurnResult {
  const actions: CreatureAction[] = [];

  // Apply passive effects
  for (const effect of creature.passiveEffects) {
    actions.push(...applyPassiveEffect(effect, creature, state));
  }

  // Determine behavior
  switch (creature.behaviorPattern) {
    case 'wander':
      actions.push(wanderBehavior(creature, state));
      break;

    case 'hunt_weak':
      const weakTarget = findWeakestUnit(creature, state);
      if (weakTarget) {
        creature.currentTarget = weakTarget.id;
        actions.push(huntBehavior(creature, weakTarget, state));
      } else {
        actions.push(wanderBehavior(creature, state));
      }
      break;

    case 'hunt_commanders':
      const commander = findNearestCommander(creature, state);
      if (
        commander &&
        getDistance(creature, commander, state) <= creature.aggroRange
      ) {
        creature.currentTarget = commander.id;
        actions.push(huntBehavior(creature, commander, state));
      } else {
        actions.push(wanderBehavior(creature, state));
      }
      break;

    case 'destroy_all':
      // Attack anything nearby
      const nearbyTargets = findAllTargetsInRange(creature, 1, state);
      for (const target of nearbyTargets) {
        actions.push(attackBehavior(creature, target, state));
      }
      // Also spread corruption
      actions.push(spreadCorruption(creature, state));
      break;

    case 'seek_resonance':
      const leyNode = findNearestActiveResonanceNode(creature, state);
      if (leyNode) {
        creature.currentTarget = leyNode.id;
        if (isAdjacent(creature.currentResonanceNode, leyNode.id, state)) {
          actions.push(consumeResonance(creature, leyNode, state));
        } else {
          actions.push(moveToward(creature, leyNode.id, state));
        }
      }
      break;
  }

  // Check for enrage
  if (
    !creature.isEnraged &&
    creature.currentHealth <= creature.maxHealth * creature.enrageThreshold
  ) {
    creature.isEnraged = true;
    actions.push({ type: 'enrage', creature: creature.id });
  }

  creature.turnsActive++;

  return { creature: creature.id, actions };
}

4. Inter-Plane Interactions#

The three planes are deeply interconnected, with actions on one plane affecting the others.

4.1 Cross-Plane Influence System#

Influence Flow Matrix:

Source Plane Target Plane Influence Type Effect
Material Resonance Control Anchoring +20% control strength when Material controlled
Material Void Stability Fortifications reduce entropy spread
Resonance Material Power Projection Enable Veil-strikes, buff units
Resonance Void Containment Active ley lines slow entropy
Void Material Corruption Entropy degrades resources, morale
Void Resonance Disruption High entropy disrupts ley lines

Cross-Plane Influence Calculation:

typescript
interface CrossPlaneInfluence {
  sourceNode: NodeId;
  sourcePlane: 'material' | 'resonance' | 'void';
  targetNode: NodeId;
  targetPlane: 'material' | 'resonance' | 'void';

  influenceType: InfluenceType;
  magnitude: number; // 0-100
  direction: 'positive' | 'negative';
}

function calculateCrossPlaneInfluence(
  territory: TerritoryId,
  state: GameState
): CrossPlaneInfluence[] {
  const influences: CrossPlaneInfluence[] = [];

  const material = state.materialNodes.get(territory)!;
  const resonance = state.resonanceNodes.get(material.resonanceNodeId)!;
  const void_ = state.voidNodes.get(material.voidNodeId)!;

  // Material → Resonance (Control Anchoring)
  if (material.controller !== null) {
    influences.push({
      sourceNode: territory,
      sourcePlane: 'material',
      targetNode: resonance.id,
      targetPlane: 'resonance',
      influenceType: 'control_anchoring',
      magnitude: 20 + material.fortifications.length * 5,
      direction: 'positive',
    });
  }

  // Material → Void (Stability from fortifications)
  const voidAnchorCount = material.fortifications.filter(
    (f) => f.hasVoidAnchor
  ).length;
  if (voidAnchorCount > 0) {
    influences.push({
      sourceNode: territory,
      sourcePlane: 'material',
      targetNode: void_.id,
      targetPlane: 'void',
      influenceType: 'stability',
      magnitude: voidAnchorCount * 15,
      direction: 'positive',
    });
  }

  // Resonance → Material (Power Projection)
  if (resonance.controller !== null && resonance.powerStorage > 10) {
    influences.push({
      sourceNode: resonance.id,
      sourcePlane: 'resonance',
      targetNode: territory,
      targetPlane: 'material',
      influenceType: 'power_projection',
      magnitude: Math.min(50, resonance.powerStorage),
      direction: 'positive',
    });
  }

  // Resonance → Void (Containment)
  const activeLeyLines = resonance.connectedLeyLines.filter(
    (id) => !state.leyLines.get(id)!.isDisrupted
  ).length;
  if (activeLeyLines > 0) {
    influences.push({
      sourceNode: resonance.id,
      sourcePlane: 'resonance',
      targetNode: void_.id,
      targetPlane: 'void',
      influenceType: 'containment',
      magnitude: activeLeyLines * 10,
      direction: 'positive',
    });
  }

  // Void → Material (Corruption)
  const entropy = state.entropyZones.get(void_.entropyZoneId)!;
  if (entropy.entropyLevel > 0) {
    influences.push({
      sourceNode: void_.id,
      sourcePlane: 'void',
      targetNode: territory,
      targetPlane: 'material',
      influenceType: 'corruption',
      magnitude: entropy.entropyLevel * 20,
      direction: 'negative',
    });
  }

  // Void → Resonance (Disruption)
  if (entropy.entropyLevel >= 3) {
    influences.push({
      sourceNode: void_.id,
      sourcePlane: 'void',
      targetNode: resonance.id,
      targetPlane: 'resonance',
      influenceType: 'disruption',
      magnitude: (entropy.entropyLevel - 2) * 25,
      direction: 'negative',
    });
  }

  return influences;
}

4.2 Full Dominion System#

Full Dominion occurs when a single player controls all three planes of a territory, granting significant bonuses.

Full Dominion Benefits:

Benefit Effect Requirement
Resource Surge +50% all resource yields Control all 3 planes
Defense Amplification +3 defense to all units Control all 3 planes
Cross-Plane Casting Cast spells on any adjacent territory Control all 3 planes
Entropy Immunity Territory immune to entropy spread Control all 3 planes
Void Harvesting Can safely harvest void essence Control all 3 planes

Full Dominion Implementation:

typescript
interface FullDominion {
  territoryId: TerritoryId;
  controller: PlayerId;

  // Bonuses
  resourceBonus: number; // Multiplier (1.5 = +50%)
  defenseBonus: number; // Flat bonus to units
  crossPlaneCasting: boolean; // Can cast on adjacent
  entropyImmunity: boolean; // Immune to spread
  voidHarvestingBonus: number; // Reduced risk percentage

  // State
  turnEstablished: number;
  sustainedTurns: number; // Bonuses increase with time

  // Vulnerabilities
  materialThreat: PlayerId[]; // Players threatening Material control
  resonanceThreat: PlayerId[]; // Players threatening Resonance control
  voidThreat: boolean; // Void creatures threatening
}

function checkFullDominion(
  territoryId: TerritoryId,
  state: GameState
): FullDominion | null {
  const material = state.materialNodes.get(territoryId)!;
  const resonance = state.resonanceNodes.get(material.resonanceNodeId)!;
  const void_ = state.voidNodes.get(material.voidNodeId)!;

  // Check all three planes have same controller
  const materialController = material.controller;
  const resonanceController = resonance.controller;
  const voidController = getVoidController(void_, state);

  if (
    materialController === null ||
    materialController !== resonanceController ||
    materialController !== voidController
  ) {
    return null;
  }

  // Calculate threats
  const materialThreats = getThreateningPlayers(material, 'material', state);
  const resonanceThreats = getThreateningPlayers(resonance, 'resonance', state);
  const entropyZone = state.entropyZones.get(void_.entropyZoneId)!;
  const voidThreat =
    entropyZone.entropyLevel >= 3 || void_.creatures.length > 0;

  // Check for existing dominion
  const existing = state.fullDominions.get(territoryId);
  const sustainedTurns =
    existing?.controller === materialController
      ? existing.sustainedTurns + 1
      : 0;

  // Calculate bonuses (increase with sustained turns)
  const sustainBonus = Math.min(sustainedTurns * 0.1, 0.5); // Max +50% additional

  return {
    territoryId,
    controller: materialController,
    resourceBonus: 1.5 + sustainBonus,
    defenseBonus: 3 + Math.floor(sustainedTurns / 3),
    crossPlaneCasting: sustainedTurns >= 2,
    entropyImmunity: true,
    voidHarvestingBonus: 30 + sustainedTurns * 5,
    turnEstablished: existing?.turnEstablished ?? state.currentTurn,
    sustainedTurns,
    materialThreat: materialThreats,
    resonanceThreat: resonanceThreats,
    voidThreat,
  };
}

// Apply Full Dominion effects during status phase
function applyFullDominionEffects(
  dominion: FullDominion,
  state: GameState
): void {
  const material = state.materialNodes.get(dominion.territoryId)!;
  const resonance = state.resonanceNodes.get(material.resonanceNodeId)!;
  const void_ = state.voidNodes.get(material.voidNodeId)!;

  // Resource bonus
  for (const resource of material.resources) {
    resource.currentYield = Math.floor(
      resource.baseYield * dominion.resourceBonus
    );
  }

  // Defense bonus to all units
  for (const army of material.armies) {
    if (army.owner === dominion.controller) {
      army.activeBuffs.push({
        type: 'full_dominion_defense',
        magnitude: dominion.defenseBonus,
        source: dominion.territoryId,
        duration: 1, // Reapplied each turn
      });
    }
  }

  // Entropy immunity
  const entropyZone = state.entropyZones.get(void_.entropyZoneId)!;
  entropyZone.spreadRate = 0; // Can't spread TO this territory

  // Store dominion state
  state.fullDominions.set(dominion.territoryId, dominion);
}

4.3 Plane-Specific Actions Affecting Other Planes#

Material Actions Affecting Other Planes:

Material Action Resonance Effect Void Effect
Build Fortification +10% node control Void Anchor option
Station Army +5% per unit (max 25%) No direct effect
Siege Victory Capture resonance node Reduce entropy level -1
Raze Territory Destroy ley connections Increase entropy +1

Resonance Actions Affecting Other Planes:

Resonance Action Material Effect Void Effect
Activate Node Enable Veil-strikes -5% entropy spread rate
Strengthen Ley +1 army strength in territory Block void passage
Cast Veil-Strike Damage to units/forts May cause void seepage
Disrupt Enemy Ley No direct effect Create void seepage

Void Actions Affecting Other Planes:

Void Action Material Effect Resonance Effect
Harvest Essence Corruption risk to units Corruption risk to node
Use Passage Move armies Destabilize nearby leys
Summon Creature Creature attacks Material Creature disrupts Resonance
Stabilize Entropy +10% resource yield +10% ley power flow

4.4 Cascading Effects#

Actions can trigger cascading effects across planes.

Cascade Trigger Examples:

typescript
interface CascadeEffect {
  trigger: TriggerCondition;
  primaryPlane: Plane;
  cascadeChain: CascadeStep[];
}

const cascadeEffects: CascadeEffect[] = [
  {
    trigger: { type: 'entropy_reaches_level', level: 5 },
    primaryPlane: 'void',
    cascadeChain: [
      {
        plane: 'resonance',
        effect: 'disrupt_all_connected_leys',
        delay: 0,
      },
      {
        plane: 'material',
        effect: 'destroy_all_fortifications',
        delay: 0,
      },
      {
        plane: 'void',
        effect: 'spawn_abyssal_horror',
        delay: 1,
      },
    ],
  },
  {
    trigger: { type: 'ley_network_severed', nodeCount: 3 },
    primaryPlane: 'resonance',
    cascadeChain: [
      {
        plane: 'void',
        effect: 'increase_entropy_all_disconnected',
        delay: 0,
      },
      {
        plane: 'material',
        effect: 'remove_magical_buffs',
        delay: 0,
      },
    ],
  },
  {
    trigger: { type: 'full_dominion_broken' },
    primaryPlane: 'material',
    cascadeChain: [
      {
        plane: 'resonance',
        effect: 'power_surge_feedback',
        delay: 0,
      },
      {
        plane: 'void',
        effect: 'entropy_spike',
        delay: 0,
      },
    ],
  },
];

// Process cascading effects
function processCascades(
  initialAction: GameAction,
  state: GameState
): CascadeResult[] {
  const results: CascadeResult[] = [];
  const pendingCascades: { effect: CascadeStep; turn: number }[] = [];

  // Check if initial action triggers any cascades
  for (const cascade of cascadeEffects) {
    if (checkTrigger(cascade.trigger, initialAction, state)) {
      for (const step of cascade.cascadeChain) {
        if (step.delay === 0) {
          // Immediate cascade
          const result = applyCascadeEffect(step, state);
          results.push(result);

          // Check for secondary cascades
          const secondaryCascades = checkForTriggeredCascades(result, state);
          for (const secondary of secondaryCascades) {
            if (secondary.delay === 0) {
              results.push(applyCascadeEffect(secondary, state));
            } else {
              pendingCascades.push({
                effect: secondary,
                turn: state.currentTurn + secondary.delay,
              });
            }
          }
        } else {
          // Delayed cascade
          pendingCascades.push({
            effect: step,
            turn: state.currentTurn + step.delay,
          });
        }
      }
    }
  }

  // Store pending cascades for future turns
  state.pendingCascades.push(...pendingCascades);

  return results;
}

5.1 Plane-Specific Victory Paths#

Victory Path Requirement Turns Required
Material Dominion Control 60% of Material nodes Sustain 3 turns
Resonance Ascendancy Control 75% of ley line network Sustain 3 turns
Void Mastery Control or eliminate all level 4+ entropy N/A
Full Dominion Victory 5+ Full Dominion territories Sustain 5 turns
Balance Victory Equal control (±10%) on all planes Sustain 5 turns

5.2 Victory Point Generation#

typescript
interface VictoryPointsPerTurn {
  materialControl: number; // 1 VP per 10% control
  resonanceControl: number; // 1 VP per 10% control
  voidStability: number; // 1 VP per territory with entropy 0
  fullDominions: number; // 3 VP per Full Dominion territory
  specialObjectives: number; // Variable
}

function calculateVictoryPoints(player: PlayerId, state: GameState): number {
  let vp = 0;

  // Material control (1 VP per 10% control)
  const materialControl = calculateMaterialControl(player, state);
  vp += Math.floor(materialControl / 10);

  // Resonance control (1 VP per 10% ley network control)
  const resonanceControl = calculateResonanceControl(player, state);
  vp += Math.floor(resonanceControl / 10);

  // Void stability (1 VP per stable territory)
  const stableVoidTerritories = countStableVoidTerritories(player, state);
  vp += stableVoidTerritories;

  // Full Dominions (3 VP each)
  const fullDominions = countFullDominions(player, state);
  vp += fullDominions * 3;

  // Special objectives (faction-specific)
  vp += calculateSpecialObjectiveVP(player, state);

  return vp;
}

6. Implementation Considerations#

6.1 Data Synchronization#

All three planes must remain synchronized:

  • Node IDs are linked across planes
  • State changes propagate within the same game tick
  • Cross-plane effects calculated after all plane-specific effects

6.2 Performance Optimization#

  • Cache cross-plane influence calculations
  • Incremental updates when single nodes change
  • Spatial indexing for adjacency queries
  • Lazy evaluation for distant territories

6.3 UI/UX Requirements#

  • Clear visual distinction between planes
  • Easy switching between plane views
  • Cross-plane relationship indicators
  • Full Dominion highlighting
  • Cascade effect previews

Appendix: Quick Reference Tables#

A. Node Correspondence Table#

Each geographic location has exactly one node on each plane:

text
Territory ID → Material Node ID → Resonance Node ID → Void Node ID

B. Influence Modifiers Summary#

Modifier Source Material Resonance Void
Army Presence +10%/unit +5%/unit -
Fortification +15%/level +10%/level +5%/level
Ley Connection - +20%/line -10%/line (contained)
Entropy Level -10%/level -15%/level +20%/level
Full Dominion +30% +30% Immune

C. Cross-Plane Action Costs#

Action Type Material Cost Resonance Cost Void Cost
Basic Attack Army strength 0 0
Veil-Strike 0 5-80 power 0
Void Passage 0 0 5-50 essence
Cross-Plane Scout 2 Gold 3 Power 2 Essence
Full Dominion Maintenance 5 Gold/turn 5 Power/turn 0

Document End

Next Document: Territory Control Matrix Related Documents: Asymmetric Faction Design, Combat Resolution System