- Project overview
- Technologies
- Features
- Game Architecture
- Limitations
- Process
- What I learned
- How can it be improved
- Running the project
- Preview
This project implements the classic Pong game in Python using Pygame, featuring local multiplayer gameplay where two players control opposite paddles. The objective of the game is to score three points against your opponent to win.
- Python
- Pygame
Here is what you can do:
- Classic Pong gameplay: A Python implementation of the original Pong game.
- Local multiplayer Two players can play on the same keyboard, controlling the left and right paddles using the following controls:
Left player:
| Function | Command |
|---|---|
| Move up | W |
| Move down | S |
Right player:
| Function | Command |
|---|---|
| Move up | ↑ (Up arrow) |
| Move down | ↓ (Down arrow) |
- Score tracking: Real-time score display for both players.
The game architecture is structured as follows:
The main limitations of this project are:
- The game does not include an AI opponent.
- No graphical user interface or menus.
- No configuration options.
First, I defined the window size and core game parameters, including colors, paddle dimensions, ball radius, font settings for the score display, the winning condition, and an original configuration of 60 frames per second (FPS).
Next, I created two main classes, Paddle and Ball, to define the behavior of the game elements, such as movement, velocity, collision logic, and rendering. Handling ball collisions requires special attention to the angle of impact. Collisions with the screen boundaries simply reverse the ball’s direction, while paddle collisions depend on the displacement between the center of the ball and the center of the paddle, as shown in the image below:
We can calculate the midpoint of the paddle
To adjust the ball’s velocity after a collision, we need to consider a reduction factor
As we want to allow the ball’s speed and direction to vary depending on the impact point we need to divide the paddle into sections based on the máximum displacement of the ball from a paddle corner to the center of the paddle, which is
This can be represented as follows:
The number of possible bounce angles depends on the chosen
Finally, I created the main game loop and integrated all components.
The most important thing I learned from this project is that designing collision mechanics is a complex task that requires handle of multiple conditions. However, it is possible to build simplified yet effective physics models for games and simulations.
- Create an AI opponent.
- Add new gameplay modes and mechanics.
- Design a title screen and improve the visuals.
To run the project, download the Pong.py file and execute it. Make sure you have Pygame installed before running the game.
This is how the game is supposed to look:


