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.
๐ฝ 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 |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ 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. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| 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% |
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
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ BATTLEFIELD โโโโโทโ ORACLE โโโโโทโ TACTICAL BRAIN โโโโโทโ BATTLEFIELD โ
โ State Dict โ โ Prediction โ โ Best Action โ โ Next State โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ โ โ โ
โ โโโโโโโโดโโโโโโโ โโโโโโโดโโโโโโโ โ
โ โ โข Heatmap โ โ โข 6 Actionsโ โ
โ โ โข Intent โ โ โข What-If โ โ
โ โ โข Confidenceโ โ โข Scoring โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
LOOP (1 FPS)
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 heart of TDASS. A fully custom OpenAI Gymnasium environment that simulates a rich, multi-agent tactical battlefield.
| 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% | โ | ๐จ |
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 โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| 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)
- 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
| Property | Value |
|---|---|
| Spawn Chance | 8% per tick |
| HP Restored | +25 |
| Ammo Restored | +15 |
| Fuel Restored | +30 |
| Pickup | Automatic on tile entry |
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
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
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 is a 6-component neural intelligence pipeline that observes enemy behavior in real-time and predicts what they will do next.
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
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.
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
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.
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]
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.
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 Brain is the central command layer that combines Oracle predictions with the Feasibility Engine to select the best action for each Blue unit.
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 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
| 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 |
| 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 |
Validates proposed actions by computing a weighted feasibility score (0.0 โ 1.0):
Final Score = (Logistics ร 0.4) + (Survival ร 0.5) + (Elevation ร 0.1)
| 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 | 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 visualizer renders the entire system through a cinematic military command center aesthetic.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โ ๐ง 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)
| 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 |
| 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) |
Automated pipeline that runs 5,000 simulated matches between Red bots and random Blue movers, logging 27 columns per timestep:
| 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 |
- Python 3.12+
- NVIDIA GPU (optional, CPU inference supported)
# 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.txtpython visualize_oracle.pypython simulation.pypython -m oracle.train_oracle| 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 |
| 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 |
| 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 |
| 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 |