I have implemented a reinforcement learning (RL) pong agent, using a Deep Q Network. The game uses Pygame for visualisation and PyTorch. Key Features include:
•
Speed Control: The agent can control its speed and position by moving up and down each lane as well as how quickly.
•
State Normalisation: Paddle and ball, speeds and positions are scaled to [0,1] for better DQN learning.
•
Rewards: Rewards are given for scoring.
•
Visualisation: Displays episode/reward and gameplay using Pygame.
This project is designed to run on either CPU or GPU.
Loss Function and Optimiser: Uses MSE Loss and Adam Optimiser(lr=0.001)
Improvements
The agent struggles to deal with the ball being hit at just before the corner so it has to change direction rapidly. Also, the model struggles with the initial start of the game, where the ball is moving directly horizontally.