PongRL Pro documentation

Introduction

PongRL Pro transforms raw 210×160 RGB Atari 2600 video frames into an autonomous, competitive game-playing agent using Deep Reinforcement Learning. Ask technical questions, inspect PyTorch architectures, and explore the mathematical foundations of visual policy acquisition.

Turn visual pixels into optimal paddle velocities

Standard supervised learning requires massive datasets of human gameplay demonstrations. PongRL Pro operates under the Markov Decision Process (MDP) framework where the agent learns purely through trial and error, receiving sparse scalar rewards ({-1, 0, +1}) when a point is won or conceded.

Observation

210×160 RGB Frames

100,800 raw color pixels emitted at 60 FPS by the Stella 2600 engine.

State Vector

80×80 Difference

Temporal differencing Δst = st - st-1 directly encodes ball velocity.

Action Space

{ UP, DOWN, IDLE }

Discrete joystick commands executed with a 4-frame action repeat.

Quickstart: Running Locally

You can launch the complete full-stack environment with a single command or double-click:

Terminal (Powershell / CMD)
.\\start_website.bat

This starts the FastAPI Python server on port 8000 and the Next.js frontend on port 3000, then automatically opens your browser.

Implemented Algorithms

The project provides clean, modularized PyTorch implementations of the three landmark algorithms in Deep RL:

1. REINFORCE (Policy Gradient)

Active Run (6,001 Eps)

Direct policy search optimizing expected cumulative returns with standardized rewards. Reaches a peak 100-episode moving average reward of -1.47.

2. Deep Q-Networks (DQN)

Nature CNN

Off-policy temporal difference Q-learning using experience replay buffer (100k capacity) and target network synchronization every 1,000 steps.

3. Proximal Policy Optimization (PPO)

Actor-Critic

Clipped surrogate objective with Generalized Advantage Estimation (GAE λ = 0.95), preventing catastrophic policy collapse.

Temporal Frame Differencing (Δst)

In Atari Pong, a single static frame cannot reveal whether the ball is traveling toward the agent or away from it. Rather than maintaining a memory-intensive 4-frame queue, we compute the difference between the current frame and previous frame:

Δs_t = Current_Frame(t) - Previous_Frame(t - 1)

In the resulting binary matrix, $+1$ marks the current ball position and $-1$ marks its previous position. The spatial displacement between $+1$ and $-1$ directly supplies the 2-layer MLP with the velocity vector $(v_x, v_y)$.

uint8 Replay Buffer Compression (93.75% Savings)

Storing 100,000 observations naively as standard PyTorch 32-bit floats consumes:

100,000 transitions × 4 frames × 84 × 84 pixels × 4 bytes = 11.29 GB (State) + 11.29 GB (Next State) = 22.58 GB RAM

With uint8 quantization (1 byte / pixel): 1.41 GB RAM total (93.75% memory compression).

FastAPI REST Endpoints

The Python backend exposes interactive endpoints for telemetry and real-time inference:

MethodEndpointDescription
GET/api/summaryProject KPIs, algorithm configurations, and hardware stats
GET/api/metrics/trainingFull 6,001-episode training curve and moving averages
POST/api/game/actionReal-time PyTorch forward pass returning action and P(UP) probability
POST/api/game/session/stepSteps the headless ALE/Pong-v5 Gymnasium environment

Viva Voce Defense Preparation

Q: Why did REINFORCE plateau at -1.47 instead of +21?

In Atari Pong, games are played to 21 points. A reward of -1.47 means the agent won approximately 48.8% of individual rallies against the built-in heuristic opponent, producing match scores like 19–21 or 20–21 with sustained 18+ return rallies.

Next Section

Algorithm Comparison →

Review REINFORCE vs DQN vs PPO benchmarks.

Capstone Dossier

Full Viva Q&A & IEEE Citations →

Access thesis formulations and references.