Skip to content

xe-nvdk/ai-war-games

Repository files navigation

AI War Games: Strategic Combat Simulator ๐ŸŽฎโš”๏ธ

A sophisticated war game simulator where different AI models (GPT, DeepSeek, Claude) control real countries and make strategic military decisions based on actual capabilities, geography, and economic data.

AI War Demo License APIs

๐ŸŒŸ Features

Real AI Decision Making

  • GPT-4o-mini: Balanced strategist with diplomatic focus
  • DeepSeek: Aggressive risk-taker with overwhelming force tactics
  • Claude: Cautious diplomat emphasizing defensive positioning

Realistic Country Data (2024)

  • Actual GDP, military spending, and technology levels
  • Geographic constraints (distance, terrain, borders)
  • Real alliance systems and diplomatic relationships
  • Nuclear capabilities and cyber warfare capacity

Multi-Dimensional Warfare

  • Military: Army, Navy, Air Force operations with tech modifiers
  • Cyber: Infrastructure attacks and system disruption
  • Economic: Sanctions and financial warfare
  • Diplomatic: Alliance formation and coalition building
  • Intelligence: Reconnaissance and strategic planning

๐Ÿš€ Quick Start

Installation

git clone https://github.com/yourusername/ai-war-games.git
cd ai-war-games
pip install -r requirements.txt

Configure API Keys

cp .env.example .env
# Edit .env with your API keys:
# - OpenAI: https://platform.openai.com/api-keys
# - DeepSeek: https://platform.deepseek.com/
# - Anthropic: https://console.anthropic.com/

Run a Battle

# Quick demo (works without API keys)
python demo.py

# Test your API connections
python test_apis.py

# Interactive battle
python run_custom.py

# Single decision analysis
python single_decision_test.py

๐ŸŽฏ Example Scenarios

Realistic Conflicts

# Middle East tension
Israel (GPT) vs Iran (DeepSeek)

# Pacific theater  
USA (GPT) vs China (DeepSeek)

# Regional powers
India (Claude) vs Pakistan (GPT)

Unexpected Alliances

The AIs make pragmatic decisions that often result in hilarious real-politik:

Turn 7: Ukraine forms strategic alliance with China
Turn 8: North Korea allies with United Kingdom  
Turn 9: Iran recruits Germany as military partner

Why? The AIs prioritize winning over ideology, leading to pure game theory in action!

๐Ÿ—๏ธ Architecture

Core Components

# AI strategists make real decisions
from ai_interface import GPTStrategist, DeepSeekStrategist, ClaudeStrategist

# Real country data with actual capabilities  
from countries_database import COUNTRIES_DATABASE

# Combat resolution with geographic constraints
from war_simulator import WarSimulator, WarVisualizer

Strategic Decision Flow

  1. Context Analysis: AI receives military strength, economy, geography, recent events
  2. API Call: Real strategic decision via OpenAI/DeepSeek/Anthropic
  3. Combat Resolution: Geographic/technological modifiers applied
  4. State Update: Casualties, territory, alliances updated
  5. Victory Check: Multiple win conditions evaluated

๐Ÿ“Š Available Countries

Country GDP ($B) Tech Level Military Strength Special Notes
United States 27,000 10/10 Navy: 95, Air: 95 Global superpower
China 17,900 8/10 Army: 90, Navy: 75 Massive land forces
Russia 2,100 7/10 Nuclear: 95 Nuclear superpower
Israel 530 10/10 Cyber: 95, Air: 85 Tech advantage
Iran 413 6/10 Army: 70 Regional power
North Korea 40 4/10 Army: 75, Nuclear: 40 Asymmetric threat

Full database includes 12 countries with detailed military, economic, and geographic data.

๐Ÿ’ฐ Cost Analysis

API Costs per 20-turn battle:

  • GPT-4o-mini: $0.04-0.12 (โญ Recommended)
  • DeepSeek: $0.004-0.02 (๐Ÿ’ฐ Cheapest)
  • Claude Opus: $0.40-1.20 (๐Ÿ’Ž Premium)

Without API Keys:

  • Simulation Mode: Free! Rule-based decisions with realistic country data

๐ŸŽฒ Battle Examples

Decisive Victory

Israel vs Iran (500km distance)
โ€ข Turn 3: Israel cyber attack succeeds
โ€ข Turn 6: Air superiority established  
โ€ข Turn 8: Iran territory control drops to 15%
โ€ข Result: Israeli victory via tech dominance

Prolonged Conflict

USA vs Russia (5000km distance)
โ€ข Geographic distance limits effectiveness
โ€ข Nuclear deterrence prevents escalation
โ€ข Economic warfare dominates
โ€ข Result: Attrition stalemate

๐Ÿ”ง Configuration

Model Selection

# config.py
GPT_MODEL = "gpt-4o-mini-2024-07-18"  # Cost-effective
DEEPSEEK_MODEL = "deepseek-chat"      # Very cheap
CLAUDE_MODEL = "claude-3-opus-20240229"  # Premium

Combat Modifiers

# Terrain effects on defense
TERRAIN_EFFECTS = {
    "mountains": {"defense": 1.5},    # +50% defensive bonus
    "islands": {"defense": 1.4},      # Hard to invade
    "desert": {"supply_cost": 1.5},   # Logistics penalty
}

๐Ÿง  AI Personalities Observed

After running hundreds of simulations:

GPT-4o-mini

  • Strategy: Balanced with diplomatic solutions
  • Favorite Actions: Coalition building, precision strikes
  • Risk Profile: Moderate, calculated decisions
  • Quote: "Forming strategic alliance with Germany for mutual defense"

DeepSeek

  • Strategy: Aggressive overwhelming force
  • Favorite Actions: Preemptive strikes, cyber warfare
  • Risk Profile: High-risk, high-reward
  • Quote: "Launch immediate offensive to seize initiative before enemy mobilization"

Claude

  • Strategy: Defensive positioning, patience
  • Favorite Actions: Intelligence gathering, fortification
  • Risk Profile: Conservative, long-term planning
  • Quote: "Establish defensive perimeter while building international coalition support"

๐Ÿ”ฎ Future Roadmap

  • Multi-faction warfare: 3+ countries simultaneously
  • Historical scenarios: WWII with AI strategic thinking
  • Economic simulation: Full supply chains and trade routes
  • AI learning: Models that adapt from previous battles
  • Web interface: Browser-based battle visualization
  • Tournament mode: AI bracket competitions

๐Ÿค Contributing

Contributions welcome! Areas of interest:

  • New countries: Add more nations with detailed capabilities
  • Battle mechanics: Enhanced combat resolution systems
  • AI personalities: New strategic behavior patterns
  • Visualization: Better battle graphics and statistics
  • Historical data: Past conflicts for AI analysis

โš–๏ธ Disclaimer

This is an educational simulation for understanding AI decision-making and strategic planning. It does not promote or glorify warfare. Real conflicts have devastating human costs that cannot be captured in any simulation.

The project explores:

  • AI strategic reasoning under constraints
  • Game theory and alliance formation
  • Geographic and economic factors in conflict
  • Emergent behavior in multi-agent systems

๐Ÿ“ License

MIT License - feel free to use, modify, and distribute.

๐Ÿ™‹ FAQ

Q: Do I need API keys to run this?
A: No! Simulation mode works without keys using realistic decision rules.

Q: Which AI model is best?
A: GPT-4o-mini offers the best balance of intelligence and cost. DeepSeek is incredibly cheap for experimentation.

Q: Can I add new countries?
A: Yes! Edit countries_database.py with new country data.

Q: Why do AIs make weird alliances?
A: They prioritize winning over realism - pure strategic thinking without political constraints!


Ready to watch AIs wage strategic warfare? Clone the repo and let the games begin! ๐ŸŽฎ

Created with โค๏ธ for AI enthusiasts and strategy game fans

About

AI War Games: Strategic combat simulator where GPT, DeepSeek & Claude control real countries with actual military data. Watch AIs make hilarious alliances like "North Korea + UK" while prioritizing victory over politics. Features real geography, economics & multi-dimensional warfare.

Resources

License

Stars

Watchers

Forks

Contributors

Languages