Skip to content

enestsc/Phantom-Pilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phantom Pilot: Adaptive Interceptor 🚀🧠

Phantom Pilot is a 2D simulation and game environment designed to demonstrate Swarm Artificial Intelligence (Multi-Agent Swarm AI) and Online Deep Learning in a real-time defense scenario.

Unlike traditional games with hardcoded enemy patterns, this project features a Python-based AI Commander (powered by PyTorch) that dynamically learns the player's evasion tactics via TCP/IP telemetry and orchestrates a coordinated "Pincer" (Kıskaç) attack using four independent turrets.

Phantom Pilot Gameplay

🎯 The Swarm AI Mechanics (Who is doing what?)

The player is trapped in a 1200x800 arena, facing 4 interceptor turrets. Each turret operates on a different mathematical or AI-driven logic, mimicking the famous "Pac-Man" ghost tracking system but upgraded with Deep Learning:

  • Top-Left Turret (The Aggressor): Uses raw Cartesian coordinates. It constantly fires at the player's exact current position, forcing the player to stay in motion.
  • Top-Right Turret (The Predictor): Uses Linear Kinematics. It calculates the player's current velocity vector ($dx, dy$) and fires at the mathematical future position, catching the player if they fly in a straight line.
  • Bottom-Left & Bottom-Right Turrets (The AI Pincer): These are the true threat. They receive commands from the Neural Network. The AI observes the player's complex maneuvers (like circles or zig-zags), predicts the non-linear future location, and fires slightly to the Left and Right of that predicted spot. This creates an inescapable "Net" or "Pincer" movement.

AI Crossfire and Pincer Movement

🧠 System Architecture & Tech Stack

This project is built on a decoupled architecture, separating the Physics/Rendering engine from the AI computing engine:

1. The Frontend / Engine (C++ & Qt Framework)

  • Handles 60 FPS rendering, collision detection, and bounding boxes using QGraphicsScene and QGraphicsPixmapItem.
  • Calculates real-time telemetry ($x, y, dx, dy$).
  • Features a dynamic difficulty multiplier (turrets fire faster as the player survives longer) and a moving health bar.

2. The AI Backend (Python & PyTorch)

  • TCP/IP Socket Bridge: The C++ client streams telemetry data to the Python server at 20 Hz.
  • Online Deep Learning (Training Loop): The AI maintains a temporal memory buffer (Delay Frames). It stores predictions and, 0.6 seconds later, compares them with the player's actual location.
  • Backpropagation: It calculates the Mean Squared Error (MSE Loss) and updates the Adam Optimizer weights in real-time. The longer you play, the smarter the AI gets at countering your specific flight patterns.

⚙️ How to Run

  1. Start the AI Brain (Server): Open your terminal, activate your virtual environment, and run the Python server.
    python brain_server.py
  2. Start the Simulation (Client): Compile and run the C++ Qt project. The game window will open, and the connection to the AI will be established automatically.
  3. Controls:
    • W, A, S, D to maneuver the aircraft.
    • SPACE to fire your own weapons.

👨‍💻 Developer

Developed by Enes Taşçı. This project was built to explore the intersection of object-oriented game development, network programming, and applied machine learning models.

About

A 2D defense simulation demonstrating Swarm AI and Online Deep Learning. Built with a C++/Qt physics engine and a real-time PyTorch neural network backend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors