Skip to content

Ronit178693/TDASS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

33 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TDASS Header


Typing SVG







A real-time, AI-powered tactical battlefield simulation where a trained LSTM Oracle predicts enemy movements, classifies hostile intent, generates probability heatmaps, and drives intelligent Blue-force decision-making โ€” all rendered through a cinematic Cyber-Directive neon interface.



๐Ÿ“‘ Table of Contents

๐Ÿ”ฝ Click to Expand Full Navigation
# Section Description
1 ๐ŸŽฏ Project Overview What TDASS is and why it exists
2 ๐Ÿ—๏ธ System Architecture Full multi-layer architecture diagram
3 ๐Ÿ“‚ Project Structure Complete file tree with descriptions
4 โš™๏ธ The Battlefield Engine Gymnasium environment deep-dive
5 ๐Ÿง  The Oracle Intelligence LSTM models, training, and inference
6 ๐ŸŽ–๏ธ The Tactical Brain Decision orchestration layer
7 ๐Ÿ”ด The Red Bot AI Enemy OODA-loop state machine
8 ๐Ÿ“Š The Feasibility Engine Risk and logistics scoring
9 ๐Ÿ–ฅ๏ธ The Cyber-Directive Visualizer Neon HUD and rendering pipeline
10 ๐Ÿ“ˆ Data Pipeline Synthetic dataset generation
11 ๐Ÿš€ Quick Start Installation and launch guide
12 ๐Ÿ”ฌ Technical Specifications Model hyperparameters and constants
13 ๐Ÿ—บ๏ธ Roadmap Future development plans

๐ŸŽฏ Project Overview

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                                                                      โ•‘
โ•‘   TDASS is not a game. It is an AI warfare research platform.        โ•‘
โ•‘                                                                      โ•‘
โ•‘   It simulates a multi-agent tactical battlefield where a trained    โ•‘
โ•‘   neural Oracle (LSTM) predicts enemy behavior in real-time,         โ•‘
โ•‘   generates spatial threat maps, and drives autonomous Blue-force    โ•‘
โ•‘   decision-making through a feasibility-weighted action scoring      โ•‘
โ•‘   system โ€” all visualized through a cinematic neon command center.   โ•‘
โ•‘                                                                      โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿ”‘ Core Capabilities

Capability Implementation Status
Enemy Movement Prediction 2-Layer Bidirectional LSTM (Action Predictor) โœ… Trained
Hostile Intent Classification 2-Layer Bidirectional LSTM (Posture Classifier) โœ… Trained
Spatial Threat Mapping Monte Carlo Rollout + Gaussian Diffusion Heatmaps โœ… Live
Autonomous Blue-Force AI Feasibility-Weighted Action Scoring via Tactical Brain โœ… Active
Adversarial Red Bot 5-Posture OODA-Loop State Machine (SCOUT/ATTACK/RETREAT/FLANK/RESUPPLY) โœ… Active
Rich Battlefield Physics 6 Terrains, Fog of War, Elevation, Morale, Supply Drops, Combat โœ… Simulated
Cinematic Visualization Neon Cyber-Directive HUD with CRT Scanlines, Laser VFX, Pulsing Radar โœ… Rendered
Full Codebase Annotation Every single line of code has a descriptive comment โœ… 100%

๐Ÿ—๏ธ System Architecture

graph TB
    subgraph VIS["๐Ÿ–ฅ๏ธ CYBER-DIRECTIVE VISUALIZER"]
        direction LR
        V1["Neon Grid<br/>Renderer"]
        V2["Oracle HUD<br/>Dashboard"]
        V3["CRT Scanline<br/>Post-FX"]
        V4["Laser Combat<br/>VFX"]
    end

    subgraph BRAIN["๐Ÿง  TACTICAL BRAIN (Orchestrator)"]
        direction LR
        B0["Unit<br/>Identifier"]
        B1["What-If<br/>Simulator"]
        B2["Action<br/>Scorer"]
    end

    subgraph ORACLE["๐Ÿ”ฎ ORACLE INTELLIGENCE"]
        direction TB
        O1["LSTM Action<br/>Predictor<br/>(2-Layer BiLSTM)"]
        O2["Intent<br/>Classifier<br/>(2-Layer BiLSTM)"]
        O3["Heatmap<br/>Generator<br/>(Monte Carlo +<br/>Gaussian)"]
        O4["Inference<br/>Engine<br/>(Rolling Buffer)"]
    end

    subgraph FEAS["๐Ÿ“Š FEASIBILITY ENGINE"]
        direction LR
        F1["Logistics<br/>Calculator"]
        F2["Combat Risk<br/>Evaluator"]
        F3["Elevation<br/>Analyzer"]
    end

    subgraph ENV["โš”๏ธ BATTLEFIELD ENGINE (Gymnasium)"]
        direction TB
        E1["Terrain<br/>Map"]
        E2["Unit<br/>Manager"]
        E3["Combat<br/>System"]
        E4["Fog of<br/>War"]
        E5["Supply<br/>Drops"]
        E6["Morale<br/>System"]
    end

    subgraph RED["๐Ÿ”ด RED BOT AI"]
        direction LR
        R1["Posture<br/>State Machine"]
        R2["Pathfinding<br/>Heuristics"]
    end

    ENV -->|"State Dict"| ORACLE
    ORACLE -->|"Prediction"| BRAIN
    BRAIN -->|"Action"| ENV
    FEAS -->|"Score"| BRAIN
    RED -->|"Red Action"| ENV
    ENV -->|"Render Data"| VIS
    ORACLE -->|"Heatmap + Intent"| VIS

    style VIS fill:#0a0e1a,stroke:#00c8ff,stroke-width:3px,color:#fff
    style BRAIN fill:#0a0e1a,stroke:#00ffb4,stroke-width:3px,color:#fff
    style ORACLE fill:#0a0e1a,stroke:#ff6b35,stroke-width:3px,color:#fff
    style FEAS fill:#0a0e1a,stroke:#a855f7,stroke-width:3px,color:#fff
    style ENV fill:#0a0e1a,stroke:#ffd700,stroke-width:3px,color:#fff
    style RED fill:#0a0e1a,stroke:#ff1e50,stroke-width:3px,color:#fff
Loading

๐Ÿ”„ Data Flow โ€” One Complete Tick

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  BATTLEFIELD โ”‚โ”€โ”€โ”€โ–ทโ”‚    ORACLE     โ”‚โ”€โ”€โ”€โ–ทโ”‚ TACTICAL BRAIN โ”‚โ”€โ”€โ”€โ–ทโ”‚  BATTLEFIELD โ”‚
โ”‚  State Dict  โ”‚    โ”‚  Prediction  โ”‚    โ”‚  Best Action   โ”‚    โ”‚  Next State  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚                  โ”‚                     โ”‚                     โ”‚
       โ”‚           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”‚
       โ”‚           โ”‚ โ€ข Heatmap   โ”‚        โ”‚ โ€ข 6 Actionsโ”‚             โ”‚
       โ”‚           โ”‚ โ€ข Intent    โ”‚        โ”‚ โ€ข What-If  โ”‚             โ”‚
       โ”‚           โ”‚ โ€ข Confidenceโ”‚        โ”‚ โ€ข Scoring  โ”‚             โ”‚
       โ”‚           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ”‚
       โ”‚                                                             โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              LOOP (1 FPS)

๐Ÿ“‚ Project Structure

TDASS/
โ”‚
โ”œโ”€โ”€ ๐Ÿ–ฅ๏ธ  visualize_oracle.py          โ† MAIN ENTRY POINT โ€” Cyber-Directive Visualizer
โ”œโ”€โ”€ โš”๏ธ  battle_env.py                โ† Gymnasium Battlefield Engine (953 lines)
โ”œโ”€โ”€ ๐ŸŽฒ  simulation.py                โ† Synthetic Data Generation Pipeline
โ”œโ”€โ”€ ๐Ÿ“‹  requirements.txt             โ† Python Dependencies
โ”‚
โ”œโ”€โ”€ ๐Ÿง  oracle/                       โ† NEURAL INTELLIGENCE MODULE
โ”‚   โ”œโ”€โ”€ __init__.py                  โ† Module registration & docstring
โ”‚   โ”œโ”€โ”€ data_loader.py               โ† B1: CSV preprocessing & windowed sequences
โ”‚   โ”œโ”€โ”€ lstm_predictor.py            โ† B2: 2-Layer BiLSTM Action Predictor
โ”‚   โ”œโ”€โ”€ intent_classifier.py         โ† B3: 2-Layer BiLSTM Intent Classifier
โ”‚   โ”œโ”€โ”€ heatmap_generator.py         โ† B4: Monte Carlo + Gaussian Heatmaps
โ”‚   โ”œโ”€โ”€ inference_engine.py          โ† B6: Stateful Real-Time Inference Wrapper
โ”‚   โ”œโ”€โ”€ train_oracle.py              โ† B5: Full Training Pipeline + Checkpointing
โ”‚   โ””โ”€โ”€ checkpoints/
โ”‚       โ”œโ”€โ”€ action_predictor_best.pt โ† Trained LSTM weights (2.3 MB)
โ”‚       โ”œโ”€โ”€ intent_classifier_best.ptโ† Trained Classifier weights (1.5 MB)
โ”‚       โ”œโ”€โ”€ training_curves.png      โ† Loss/Accuracy visualization
โ”‚       โ””โ”€โ”€ training_summary.json    โ† Hyperparameter archive
โ”‚
โ”œโ”€โ”€ ๐ŸŽ–๏ธ brain/                        โ† DECISION ORCHESTRATION MODULE
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ tactical_brain.py            โ† v14.0: Oracle + Feasibility Integration
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š feasibility/                   โ† RISK & LOGISTICS MODULE
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ feasibility_engine.py        โ† Path cost, combat risk, elevation scoring
โ”‚
โ””โ”€โ”€ ๐Ÿ”ด Element_Logic/                 โ† ADVERSARIAL AI MODULE
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ red_strategy.py              โ† 5-Posture OODA-Loop State Machine
    โ””โ”€โ”€ Synthetic_dataset/
        โ””โ”€โ”€ battle_data.csv          โ† 100,000-row training dataset (9.9 MB)

โš™๏ธ The Battlefield Engine โ€” battle_env.py

The heart of TDASS. A fully custom OpenAI Gymnasium environment that simulates a rich, multi-agent tactical battlefield.

๐Ÿ—บ๏ธ Terrain System (6 Types)

Code Terrain Move Cost Cover (DMG Reduction) Passable Visual
0 Plains 1.0ร— 0% โœ… ๐ŸŸซ
1 Wall โˆž โ€” โŒ โฌ›
2 Forest 1.5ร— 30% โœ… ๐ŸŸฉ
3 Water โˆž โ€” โŒ ๐ŸŸฆ
4 Urban 2.0ร— 40% โœ… ๐Ÿ™๏ธ
5 Road 0.5ร— 0% โœ… ๐ŸŸจ

๐ŸŽ–๏ธ Unit Resource Model

Every unit (Blue & Red) carries individual state:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  UNIT STATE DICTIONARY                               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  id          โ”‚  Unique identifier (e.g., "B0", "R1") โ”‚
โ”‚  team        โ”‚  "blue" or "red"                       โ”‚
โ”‚  pos         โ”‚  [row, col] grid coordinate            โ”‚
โ”‚  hp          โ”‚  0โ€“100 (Health Points)                 โ”‚
โ”‚  ammo        โ”‚  0โ€“50  (Projectile Count)              โ”‚
โ”‚  fuel        โ”‚  0โ€“100 (Movement Energy)               โ”‚
โ”‚  morale      โ”‚  20โ€“150 (Psychological State)          โ”‚
โ”‚  kills       โ”‚  Kill counter                          โ”‚
โ”‚  alive       โ”‚  Boolean existence flag                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โš”๏ธ Combat Mechanics

Type Damage Range Ammo Cost Notes
Melee 30 base Adjacent (1) 0 Triggers counter-attack (15 dmg) on survival
Ranged 20 base โ‰ค 3 Manhattan 5 Auto-targets nearest enemy in range

Damage Modifiers Stack Multiplicatively:

Final Damage = Base ร— (1 - Cover%) ร— Elevation Bonus ร— Morale Multiplier

Where:
  โ€ข Cover%         = 0.0 (Plains/Road) | 0.3 (Forest) | 0.4 (Urban)
  โ€ข Elevation      = 1.25ร— if attacker is higher | 1.0ร— otherwise
  โ€ข Morale Factor  = 0.5 + 0.5 ร— (morale / 100)

๐ŸŒซ๏ธ Fog of War

  • Each Blue unit reveals tiles within Manhattan distance 4
  • Red units in fogged tiles are invisible to the visualizer
  • The Oracle still tracks Red positions for prediction

๐Ÿ“ฆ Supply Drop System

Property Value
Spawn Chance 8% per tick
HP Restored +25
Ammo Restored +15
Fuel Restored +30
Pickup Automatic on tile entry

๐Ÿ’€ Morale System

Event                    โ”‚ Effect
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Friendly unit dies       โ”‚ -20 morale (team-wide)
Enemy unit killed        โ”‚ +15 morale (team-wide)
HP drops below 30        โ”‚ -10 morale (per tick)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Range: [20, 150]         โ”‚ Default: 100

๐Ÿ“ Elevation Layer

Height Map (10ร—10):
  โ€ข [4:6, 4:6] = 2 (Urban Hilltop โ€” Strategic Chokepoint)
  โ€ข [0:2, 0:2] = 1 (Blue Spawn Ridge)
  โ€ข [8:10, 8:10] = 1 (Red Spawn Ridge)
  โ€ข [3, 7] = 2 (Sniper Bluff โ€” Overlooks Water)
  
  High Ground Bonus: +25% damage when attacking downhill

๐ŸŽฌ Particle System

The engine includes a lightweight VFX particle emitter for:

  • ๐Ÿ’ฅ Melee impacts โ€” Golden sparks (12 particles, speed 4.0)
  • ๐Ÿ”ซ Ranged tracers โ€” Orange impact + blue muzzle flash
  • Particles have randomized angle, speed, lifetime, and size

๐Ÿง  The Oracle Intelligence โ€” oracle/

The Oracle is a 6-component neural intelligence pipeline that observes enemy behavior in real-time and predicts what they will do next.

๐Ÿ”ฎ Oracle Component Map

graph LR
    A["๐Ÿ“Š B1<br/>Data Loader"] --> B["๐Ÿง  B2<br/>LSTM Predictor"]
    A --> C["๐ŸŽฏ B3<br/>Intent Classifier"]
    B --> D["๐Ÿ—บ๏ธ B4<br/>Heatmap Generator"]
    B --> E["โšก B6<br/>Inference Engine"]
    C --> E
    D --> E
    E --> F["๐ŸŽ–๏ธ Tactical Brain"]

    style A fill:#1a1a2e,stroke:#ffd700,color:#fff
    style B fill:#1a1a2e,stroke:#00c8ff,color:#fff
    style C fill:#1a1a2e,stroke:#ff1e50,color:#fff
    style D fill:#1a1a2e,stroke:#00ffb4,color:#fff
    style E fill:#1a1a2e,stroke:#a855f7,color:#fff
    style F fill:#1a1a2e,stroke:#fff,color:#fff
Loading

๐Ÿ“Š B1 โ€” Data Loader (data_loader.py)

Purpose: Transforms raw CSV battle data into normalized, windowed sequences for LSTM training.

Feature Vector (12 Dimensions):

# Feature Normalization Range Description
1 red_x [0, 9] Red horizontal position
2 red_y [0, 9] Red vertical position
3 blue_x [0, 9] Blue horizontal position
4 blue_y [0, 9] Blue vertical position
5 red_hp [0, 100] Red health points
6 red_ammo [0, 50] Red ammunition
7 red_fuel [0, 100] Red movement energy
8 red_morale [20, 150] Red psychological state
9 red_elevation [0, 2] Red height advantage
10 distance [0, 18] Manhattan distance between forces
11 fog_visible [0, 1] Blue's sensor visibility
12 red_prev_action [0, 5] Red's last executed action

Sliding Window: Sequences of 10 consecutive timesteps are formed for temporal pattern learning.


๐Ÿง  B2 โ€” LSTM Action Predictor (lstm_predictor.py)

Purpose: Predicts the next action (0โ€“5) the Red unit will take.

Architecture:
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  Input: (batch, seq_len=10, features=12)            โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
  โ”‚  โ”‚  nn.LSTM                        โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข hidden_size = 128            โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข num_layers  = 2              โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข bidirectional = True         โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข dropout = 0.2               โ”‚                โ”‚
  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  Last Timestep Extraction: lstm_out[:, -1, :]       โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
  โ”‚  โ”‚  Classifier Head                โ”‚                โ”‚
  โ”‚  โ”‚  Linear(256 โ†’ 128) โ†’ ReLU      โ”‚                โ”‚
  โ”‚  โ”‚  Dropout(0.2)                   โ”‚                โ”‚
  โ”‚  โ”‚  Linear(128 โ†’ 6)               โ”‚                โ”‚
  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  Output: 6-class action probabilities               โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  Total Parameters: ~2.3 MB
  Checkpoint: oracle/checkpoints/action_predictor_best.pt

๐ŸŽฏ B3 โ€” Intent Classifier (intent_classifier.py)

Purpose: Classifies the Red unit's tactical posture (SCOUT/ATTACK/RETREAT/FLANK/RESUPPLY).

Architecture:
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  Input: (batch, seq_len=10, features=12)            โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
  โ”‚  โ”‚  Feedforward Encoder            โ”‚                โ”‚
  โ”‚  โ”‚  Linear(12 โ†’ 64) โ†’ ReLU        โ”‚                โ”‚
  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
  โ”‚  โ”‚  nn.LSTM                        โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข input_size   = 64            โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข hidden_size  = 96            โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข num_layers   = 2             โ”‚                โ”‚
  โ”‚  โ”‚  โ€ข bidirectional = True         โ”‚                โ”‚
  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  Mean Pooling: torch.mean(lstm_out, dim=1)          โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
  โ”‚  โ”‚  Classifier Head                โ”‚                โ”‚
  โ”‚  โ”‚  Linear(192 โ†’ 96) โ†’ ReLU       โ”‚                โ”‚
  โ”‚  โ”‚  Dropout(0.2)                   โ”‚                โ”‚
  โ”‚  โ”‚  Linear(96 โ†’ 5)                โ”‚                โ”‚
  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
  โ”‚                    โ–ผ                                โ”‚
  โ”‚  Output: 5-class posture probabilities              โ”‚
  โ”‚  [SCOUT, ATTACK, RETREAT, FLANK, RESUPPLY]          โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  Total Parameters: ~1.5 MB
  Checkpoint: oracle/checkpoints/intent_classifier_best.pt

Key Difference from B2: Uses a feedforward encoder before the LSTM and mean pooling (instead of last-step extraction) for more robust temporal representation.


๐Ÿ—บ๏ธ B4 โ€” Heatmap Generator (heatmap_generator.py)

Purpose: Generates a 10ร—10 probability grid predicting where the Red unit is most likely to be in N future steps.

Two Complementary Methods:

Method Speed Accuracy Algorithm
Monte Carlo Rollout ๐Ÿข Slow ๐ŸŽฏ High Simulates N steps using LSTM action distribution; averages positions over K rollouts
Gaussian Diffusion โšก Fast ๐Ÿ“ Approximate Converts LSTM action probabilities into directional weights; applies scipy.ndimage.gaussian_filter blur
Monte Carlo Pipeline:
  1. Get LSTM softmax output โ†’ action probabilities
  2. Sample K trajectories (default 50)
  3. For each trajectory, simulate N steps
  4. Accumulate visited positions into 10ร—10 grid
  5. Normalize to [0, 1] probability distribution

Gaussian Pipeline:
  1. Get LSTM softmax output โ†’ action probabilities
  2. Map probabilities to (ฮ”row, ฮ”col) weighted vectors
  3. Shift current position by weighted direction
  4. Apply gaussian_filter(sigma=1.5) for spatial diffusion
  5. Normalize to [0, 1]

โšก B6 โ€” Inference Engine (inference_engine.py)

Purpose: The real-time orchestrator that ties all Oracle components together during live simulation.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   INFERENCE ENGINE                            โ”‚
โ”‚                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                             โ”‚
โ”‚  โ”‚ Rolling      โ”‚  Maintains a deque of the last 10 state    โ”‚
โ”‚  โ”‚ History      โ”‚  vectors for windowed LSTM input.           โ”‚
โ”‚  โ”‚ Buffer       โ”‚  (collections.deque, maxlen=10)            โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                             โ”‚
โ”‚         โ–ผ                                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚  โ”‚ B2: Action   โ”‚  โ”‚ B3: Intent   โ”‚  โ”‚ B4: Heatmap  โ”‚       โ”‚
โ”‚  โ”‚ Predictor    โ”‚  โ”‚ Classifier   โ”‚  โ”‚ Generator    โ”‚       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ”‚         โ–ผ                 โ–ผ                 โ–ผ                โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚
โ”‚  โ”‚                PREDICTION DICT                    โ”‚        โ”‚
โ”‚  โ”‚  {                                                โ”‚        โ”‚
โ”‚  โ”‚    'posture':    "ATTACK",                        โ”‚        โ”‚
โ”‚  โ”‚    'confidence': 0.847,                           โ”‚        โ”‚
โ”‚  โ”‚    'heatmap':    np.array(10ร—10),                 โ”‚        โ”‚
โ”‚  โ”‚    'action_probs': [0.05, 0.1, 0.6, ...]         โ”‚        โ”‚
โ”‚  โ”‚  }                                                โ”‚        โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Critical Design Decision: The Oracle's LSTM hidden states are updated exactly once per turn to prevent simulation freezes and ensure temporal consistency.


๐Ÿ‹๏ธ B5 โ€” Training Pipeline (train_oracle.py)

Full training loop with:

  • 80/20 train/validation split
  • Adam optimizer with learning rate scheduling
  • CrossEntropyLoss for both models
  • Best-model checkpointing based on validation loss
  • Training curve visualization (saved as PNG)
  • JSON summary export of hyperparameters

๐ŸŽ–๏ธ The Tactical Brain โ€” brain/tactical_brain.py

The Brain is the central command layer that combines Oracle predictions with the Feasibility Engine to select the best action for each Blue unit.

Decision Algorithm (Per Unit Per Tick)

FOR each of 6 possible actions (Stay, Up, Down, Left, Right, RangedAttack):

  1. SIMULATE the hypothetical new position
  2. CHECK boundary validity
  3. QUERY Feasibility Engine:
     โ”œโ”€โ”€ Logistics Score  (fuel cost vs. current fuel)     ร— 0.4 weight
     โ”œโ”€โ”€ Survival Score   (HP vs. Oracle threat at tile)   ร— 0.5 weight
     โ””โ”€โ”€ Elevation Score  (uphill penalty = 0.8)           ร— 0.1 weight
  4. ADD Strategic Bias:
     โ”œโ”€โ”€ ATTACK bonus:  +15.0 if enemy in range AND ammo > 0
     โ”œโ”€โ”€ NO-AMMO penalty: -20.0 if trying to fire empty
     โ”œโ”€โ”€ AGGRESSION bias: +0.5 if move closes distance to enemy
     โ””โ”€โ”€ ROAD bonus: +0.2 if destination is a road tile

  RETURN action with highest total score (argmax)

๐Ÿ”ด The Red Bot AI โ€” Element_Logic/red_strategy.py

The enemy operates on a 5-posture OODA (Observe-Orient-Decide-Act) loop:

stateDiagram-v2
    [*] --> SCOUT
    SCOUT --> ATTACK : dist โ‰ค 3 AND hp โ‰ฅ 50 AND ammo โ‰ฅ 5
    SCOUT --> FLANK : 3 < dist โ‰ค 6 AND hp โ‰ฅ 40
    SCOUT --> RETREAT : hp โ‰ค 25 OR fuel โ‰ค 5 OR morale โ‰ค 30
    SCOUT --> RESUPPLY : low resources AND crate nearby

    ATTACK --> RETREAT : hp โ‰ค 25
    ATTACK --> RESUPPLY : ammo โ‰ค 10 AND crate nearby
    ATTACK --> SCOUT : target lost

    FLANK --> ATTACK : dist โ‰ค 2
    FLANK --> RETREAT : hp โ‰ค 25

    RETREAT --> RESUPPLY : crate within 4 tiles
    RETREAT --> SCOUT : safe distance reached

    RESUPPLY --> SCOUT : crate consumed
    RESUPPLY --> ATTACK : enemy closes in
Loading

Posture Behaviors

Posture Movement Logic Combat
๐Ÿ” SCOUT Random valid movement None
โš”๏ธ ATTACK Minimize distance to nearest Blue Ranged fire at โ‰ค3 range
๐Ÿ›ก๏ธ RETREAT Maximize distance + seek Forest/Urban cover None
๐Ÿ”„ FLANK Perpendicular movement, then close in Switch to ATTACK at โ‰ค2
๐Ÿ“ฆ RESUPPLY Path toward nearest supply crate None

Pathfinding Heuristics

Function Algorithm Purpose
_action_toward() Greedy Manhattan minimization Close distance to target
_action_away() Greedy Manhattan maximization Increase distance from threat
_action_toward_cover() Distance + Cover bonus scoring Retreat to defensive terrain
_action_flank() Lateral axis detection + perpendicular movement Indirect approach
_get_valid_actions() Boundary + terrain passability filter Movement validation

๐Ÿ“Š The Feasibility Engine โ€” feasibility/feasibility_engine.py

Validates proposed actions by computing a weighted feasibility score (0.0 โ€“ 1.0):

Final Score = (Logistics ร— 0.4) + (Survival ร— 0.5) + (Elevation ร— 0.1)

Three Evaluation Axes

Axis Method Formula
Logistics calculate_path_cost() 1.0 - (terrain_cost ร— distance) / fuel
Survival evaluate_combat_risk() (hp / 100) ร— (1.0 - oracle_threat) โ€” scans 3ร—3 kernel around target tile
Elevation Direct comparison 1.0 if flat/downhill, 0.8 if uphill (20% penalty)

Terrain Cost Table (Feasibility Engine)

Terrain Engine Cost Note
Plains 1.0 Standard
Wall 99.0 Effectively impassable
Forest 2.0 Slow but safe
Water 5.0 Very difficult
Road 0.5 Most efficient
Urban 1.5 Moderate

๐Ÿ–ฅ๏ธ The Cyber-Directive Visualizer โ€” visualize_oracle.py

The visualizer renders the entire system through a cinematic military command center aesthetic.

๐ŸŽจ Screen Layout

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                      โ”‚                            โ”‚
โ”‚                                      โ”‚  ๐Ÿง  ORACLE INTEL DASHBOARD โ”‚
โ”‚                                      โ”‚                            โ”‚
โ”‚                                      โ”‚  PREDICTED ENEMY INTENT:   โ”‚
โ”‚                                      โ”‚  [ ATTACK ]                โ”‚
โ”‚        10ร—10 TACTICAL GRID           โ”‚                            โ”‚
โ”‚    (600ร—600px with 60px tiles)       โ”‚  ORACLE CONFIDENCE: 84.7%  โ”‚
โ”‚                                      โ”‚  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘        โ”‚
โ”‚    โ€ข Neon grid lines                 โ”‚                            โ”‚
โ”‚    โ€ข Pulsing Oracle heatmap          โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚    โ€ข Fog of War overlay              โ”‚                            โ”‚
โ”‚    โ€ข Floating HP bars                โ”‚  ๐Ÿ”ด ENEMY THREAT STATUS    โ”‚
โ”‚    โ€ข Glowing unit rings              โ”‚                            โ”‚
โ”‚    โ€ข Neon laser combat VFX           โ”‚  R0: POS [5,3] HP:โ–“โ–“โ–“โ–‘    โ”‚
โ”‚    โ€ข Animated "?" on risk tiles      โ”‚  R1: --- NEUTRALIZED ---   โ”‚
โ”‚    โ€ข Golden supply crate icons       โ”‚                            โ”‚
โ”‚    โ€ข Crosshair hover highlight       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                      โ”‚                            โ”‚
โ”‚                                      โ”‚  ๐Ÿ”Ž ORACLE RISK SIGNATURE  โ”‚
โ”‚                                      โ”‚  PROBE: [4, 7]             โ”‚
โ”‚                                      โ”‚  TERRAIN: FOREST           โ”‚
โ”‚                                      โ”‚  THREAT: 23.45%            โ”‚
โ”‚                                      โ”‚                            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         GRID AREA (680px)                   HUD PANEL (540px)

๐ŸŒˆ Color Theme โ€” Neon Tactical

Element RGB Value Hex Purpose
Background (5, 8, 12) #05080C Deep space black
Grid Lines (20, 35, 55) #142337 Subtle military blue
Blue Units (0, 200, 255) #00C8FF Cyan neon โ€” friendly
Red Units (255, 30, 80) #FF1E50 Hot pink-red โ€” hostile
Supply Crates (255, 215, 0) #FFD700 Gold โ€” resources
Intel Labels (0, 255, 180) #00FFB4 Tech-green โ€” data
Body Text (200, 220, 240) #C8DCF0 Off-white โ€” readable

โœจ Visual Effects Pipeline

Layer Effect Implementation
0 Background Fill screen.fill(COLOR_BG)
1 Crosshair Highlight Semi-transparent row + column rectangle on hover
2 Terrain Grid Color-mapped 60ร—60 rectangles per tile
3 Oracle Heatmap Sinusoidal pulsing alpha overlay + animated ? glyphs
4 Fog of War Dark navy overlay (alpha=210) on invisible tiles
5 Supply Crates White border + golden inner square
6 Unit Rings 3-ring concentric glow + solid core circle
7 HP Bars Floating green bars directly under units
8 Neon Lasers Flickering yellow/white tracer lines on combat
9 HUD Dashboard Dark panel with intent card, threat scanner, risk probe
10 CRT Scanlines Semi-transparent horizontal lines every 4px (alpha=45)

๐Ÿ“ˆ Data Pipeline โ€” simulation.py

Automated pipeline that runs 5,000 simulated matches between Red bots and random Blue movers, logging 27 columns per timestep:

CSV Schema (battle_data.csv)

Column Type Description
step int Timestep within match
match_id int Unique match identifier
blue_id str Nearest Blue unit ID
blue_x, blue_y int Blue grid position
blue_hp, blue_ammo, blue_fuel int Blue resources
blue_terrain str Blue's current terrain name
blue_morale int Blue psychological state
blue_elevation int Blue height level
blue_kills int Blue kill count
red_id str Red unit ID
red_x, red_y int Red grid position
red_hp, red_ammo, red_fuel int Red resources
red_terrain str Red's current terrain name
red_morale int Red psychological state
red_elevation int Red height level
red_kills int Red kill count
red_posture str Current tactical posture (SCOUT/ATTACK/...)
red_prev_action int Last executed action ID
red_next_action int Label โ€” action to predict
distance int Manhattan distance between units
fog_visible bool Is Red visible to Blue?
nearby_supplies int Supply crates within 3 tiles
outcome str Match result status

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.12+
  • NVIDIA GPU (optional, CPU inference supported)

Installation

# 1. Clone the repository
git clone https://github.com/your-username/TDASS.git
cd TDASS

# 2. Create virtual environment
python -m venv venv

# 3. Activate (Windows)
venv\Scripts\activate

# 4. Install dependencies
pip install -r requirements.txt

๐ŸŽฎ Launch the Visualizer

python visualize_oracle.py

๐ŸŽฒ Generate Training Data (Optional)

python simulation.py

๐Ÿง  Retrain the Oracle (Optional)

python -m oracle.train_oracle

๐Ÿ”ฌ Technical Specifications

Environment

Spec Value
Python 3.12.5
Pygame 2.6.1 (SDL 2.28.4)
PyTorch 2.0+
Gymnasium 1.0+
NumPy 1.24+
SciPy Latest (Gaussian filter)
OS Windows 10/11

Model Hyperparameters

Parameter Action Predictor (B2) Intent Classifier (B3)
Architecture 2-Layer BiLSTM 2-Layer BiLSTM
Input Size 12 12 (โ†’ 64 via encoder)
Hidden Size 128 96
Bidirectional โœ… Yes โœ… Yes
Dropout 0.2 0.2
Output Classes 6 (actions) 5 (postures)
Pooling Last timestep Mean pooling
Checkpoint Size 2.3 MB 1.5 MB

Simulation Constants

Constant Value Purpose
GRID_SIZE 10ร—10 Battlefield dimensions
MAX_STEPS 200 Match timeout
FOG_VISION_RADIUS 4 Manhattan sight range
RANGED_RANGE 3 Weapon effective distance
MELEE_DAMAGE 30 Close-combat base damage
RANGED_DAMAGE 20 Projectile base damage
ELEVATION_BONUS +25% High-ground multiplier
SUPPLY_SPAWN_CHANCE 8% Crate probability per tick
SEQUENCE_LENGTH 10 LSTM temporal window

๐Ÿ—บ๏ธ Roadmap

Phase Feature Status
A Gymnasium Environment + Terrain + Units โœ… Complete
A+ Fog of War + Supply Drops + Elevation + Morale โœ… Complete
A4+ Red Bot 5-Posture OODA State Machine โœ… Complete
A5+ 100K-Row Synthetic Dataset Generation โœ… Complete
B Oracle LSTM Training Pipeline โœ… Complete
C Cyber-Directive Pygame Visualizer โœ… Complete
D Tactical Brain + Feasibility Engine Integration โœ… Complete
E Full Codebase Line-by-Line Annotation โœ… Complete
F ๐Ÿ”œ Deep Feasibility (A* Pathfinding) ๐Ÿ“‹ Planned
G ๐Ÿ”œ Reinforcement Learning Blue Agent ๐Ÿ“‹ Planned
H ๐Ÿ”œ Multi-Map Terrain Generation ๐Ÿ“‹ Planned



Built with ๐Ÿง  Neural Intelligence and โš”๏ธ Tactical Precision




"The supreme art of war is to subdue the enemy without fighting."
                                              โ€” Sun Tzu

TDASS โ€” Tactical Decision & Analysis Support System ยฉ 2026

About

An intelligent strategic advisor for simulated battlefield environments. Automates the OODA loop using Gymnasium, LSTM-based intent prediction, and Monte Carlo Tree Search (MCTS) to recommend optimal Courses of Action (COA).

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages