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.
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.
This project is built on a decoupled architecture, separating the Physics/Rendering engine from the AI computing engine:
- Handles 60 FPS rendering, collision detection, and bounding boxes using
QGraphicsSceneandQGraphicsPixmapItem. - 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.
- 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.
- Start the AI Brain (Server):
Open your terminal, activate your virtual environment, and run the Python server.
python brain_server.py
- 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.
- Controls:
W, A, S, Dto maneuver the aircraft.SPACEto fire your own weapons.
Developed by Enes Taşçı. This project was built to explore the intersection of object-oriented game development, network programming, and applied machine learning models.

