Skip to content

chronomancy-io/chronocom

Repository files navigation

ChronoCOM

Complete combat and AI overhaul for XCOM 2: War of the Chosen.

standard-readme compliant License WASP v1.0.0 CDE v1.0.0 MSS v1.0.0

Transforms XCOM 2 into a tactical chess match with predictable calculations, adaptive AI, and zero performance impact.

Background

WASP Problem Definition

ChronoCOM implements the WASP (Workload-Aware Sufficient Placement) framework for real-time tactical AI decision-making.

Dataset & Workload

  • D (Dataset): Set of all possible tactical game states — unit positions, health, cover, abilities, influence fields
  • W (Workload):
    • Q1: "Given a unit's tactical situation, choose the best ability and target"
    • Q2: "Given a world position, evaluate its tactical value (cover, threat, influence)"
    • Q3: "Given a turn boundary, update influence fields and invalidate stale caches"

Encoding Tuple (k, E, I, T, {F_q}):

Symbol ChronoCOM Mapping
k = 4 Spatial state, Unit state, Influence fields, Temporal state
E(r) (32×32 grids + tile class, TacticalSituation hash + hit cache, 4 influence grids [1024 floats], turn/frame/AdaptiveMemory)
I(c) InfluenceField grids, TileScoringCache, VisibilityCache, AIDecisionCache, TacticalPrecalculation
T(q) BT_InitGenericAbilities (Q1), SampleInfluence + GetTacticalGradient (Q2), UpdateInfluenceField (Q3)
{F_q} Confidence threshold >=70, grid bounds check, cache age filter (MAX_CACHE_AGE=5), dirty flags

WASP Guarantees:

  1. Sufficiency: Ans(q) ⊆ Cand(q) — 4 dimensions capture all tactical AI decision inputs; no game-state aspect is unrepresented
  2. Exactness: F_q(Cand(q)) = Ans(q) — confidence thresholds + cache invalidation ensure current-state decisions
  3. Bounded Work: Work(q) <= gamma * |Ans(q)| + beta — all spatial queries O(1) via 32×32 grid; decision cache O(1) via hash
  4. Minimality: Each dimension carries unique tactical information; removing any loses capability

CDE 4-Phase Pipeline

Phase 1: Workload Analysis

ChronoCOM AI must answer three query classes:

  • Q1 (Ability Selection): Given a unit's TacticalSituation, select the optimal ability and target
  • Q2 (Position Evaluation): Given world coordinates, compute tactical gradient (threat, danger, control, interest)
  • Q3 (State Maintenance): Given a turn/frame boundary, propagate dirty flags and rebuild stale caches

Phase 2: Coordinate Encoding (E(r))

Four dimensions encode the tactical game state:

  • Spatial (positions, cover, elevation): 32×32 influence grids (GRID_CELL_SIZE=384 world units), tile classifications from TacticalPrecalculation
  • Unit (HP, abilities, action points): TacticalSituation struct hashed to int for cache keying
  • Influence (threat, danger, control, interest): 4 InfluenceField grids with decay rates, each 1024 floats
  • Temporal (turn number, cache validity, adaptive memory): AdaptiveMemory pattern buckets, frame-based cache ages

Phase 3: Index Construction (I(c))

Pre-computed and cached data structures:

  • InfluenceField.GridValues[1024]: Flattened 32×32 grid, O(1) spatial read via SampleInfluence
  • VisibilityCache: (ShooterID, TargetID) → LoS result, frame-validated
  • AIDecisionCache: TacticalSituation hash → (ability, target, confidence)
  • TacticalPrecalculation: Mission-start tile classification and zone distances (Phase 3 front-loaded at load screen)
  • TileScoringCache: Pre-evaluated tile tactical values

Phase 4: Query Translation (T(q)) + Local Filtering ({F_q})

  • T(q): BT_InitGenericAbilities checks decision cache first (O(1)), falls back to full BT evaluation only on cache miss. SampleInfluence reads grid at quantized position. GetTacticalGradient samples 4 neighbors for directional gradient.
  • {F_q}: CONFIDENCE_THRESHOLD=70 filters low-quality cached decisions. Grid bounds check returns 0.0 for out-of-bounds. MAX_CACHE_AGE=5 filters stale LoS data. Dirty flags (bNeedsUpdate) filter stale unit data.

MSS Claim Classification

The AI's tactical decisions are fully determined by:

  • Spatial state (where everything is and what's visible)
  • Unit state (capabilities and condition)
  • Influence fields (accumulated tactical intelligence)
  • Temporal state (adaptation and cache validity)

This is the MSS for tactical AI: the smallest state that can answer any query about what the AI should do.

# Claim Category Enforcement
D1 Spatial state = positions + cover + elevation Definition
D2 Unit state = HP + abilities + AP + ammo Definition
D3 Influence field = 32×32 float grid with decay Definition
D4 Temporal state = turn counter + cache frame + AdaptiveMemory Definition
G1 All spatial queries O(1) via grid quantization Guarantee Fixed 32×32 grid; SampleInfluence is array index
G2 Decision cache O(1) lookup via hash Guarantee Hash-based GetCachedDecision
G3 Influence field update O(1024) = O(1) constant Guarantee Fixed grid size iteration
G4 Cyclomatic complexity <= 4 per function Guarantee Documented per function; code review enforced
G5 Cache invalidation on unit movement Guarantee MarkUnitDirty called on state changes
G6 Overwatch zone test is O(1) (dot product) Guarantee Geometric cone test
A1 4 dimensions sufficient for emergent AI behavior Assumption Demonstrated by gameplay; no formal proof
A2 Confidence threshold of 70 filters bad decisions Assumption Tuned empirically
A3 Grid cell size of 384 (4 tiles) is optimal Assumption Chosen for balance
A4 Perceptual O(1) via time-reordered computation Assumption Camera-based priority; depends on viewing angle
A5 Adaptive memory detects player patterns Assumption Bucket-based heuristic; accuracy not formally measured
U1 Actual gamma, beta bounds for Q1 Unknown Need profiling under real gameplay
U2 Optimal influence decay rates Unknown Current values tuned by feel

Install

Requirements

  • XCOM 2: War of the Chosen
  • X2WOTCCommunityHighlander v1.30.4+

Installation

  1. Subscribe via Steam Workshop or extract to XCOM 2\XComGame\Mods\ChronoCOM\
  2. Enable in XCOM 2 Mod Launcher
  3. Start new campaign or continue existing saves

Usage

Compatibility

  • Compatible with most AI mods (uses ModClassOverride)
  • Works with existing saves
  • Incompatible with other accuracy overhaul mods

Architecture

ChronoCOM uses a hybrid ModClassOverride + template replacement approach for maximum compatibility and performance.

Technical Approach:

  • ModClassOverride for AI behavior (engine-level compatibility)
  • Template replacement for combat systems (selective modification)
  • 32×32 influence grids for spatial reasoning
  • Comprehensive caching system for constant-time operations

See docs/README.md for complete documentation index.

Contributing

Report issues via GitHub Issues. Check logs in Launch.log for ChronoCOM: entries.

License

Apache-2.0 © 2026 Jacob Coleman — See LICENSE for details.

About

XCOM 2 AI overhaul. Deterministic hit formula, precomputed overwatch zones, diffusing influence fields. CDE/WASP/MSS.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors