https://github.com/brej-29/space-ping-pong
Space Ping Pong is a neon, arcade-style 2D pong game built with Python + Pygame. Play vs computer (E/M/H) or local two-player. Includes power-ups, particle effects, starfield, screen shake, and persistent high scores. Modular codebase (ball/paddle/powerups/game) easy to extend.
https://github.com/brej-29/space-ping-pong
2d-game ai-opponent arcade game game-development gamedev high-scores local-multiplayer open-source particle-effects ping-pong power-ups pygame python retro screen-shake starfield
Last synced: 3 months ago
JSON representation
Space Ping Pong is a neon, arcade-style 2D pong game built with Python + Pygame. Play vs computer (E/M/H) or local two-player. Includes power-ups, particle effects, starfield, screen shake, and persistent high scores. Modular codebase (ball/paddle/powerups/game) easy to extend.
- Host: GitHub
- URL: https://github.com/brej-29/space-ping-pong
- Owner: brej-29
- License: mit
- Created: 2025-09-18T17:40:09.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-18T18:53:23.000Z (9 months ago)
- Last Synced: 2025-09-18T21:24:25.251Z (9 months ago)
- Topics: 2d-game, ai-opponent, arcade, game, game-development, gamedev, high-scores, local-multiplayer, open-source, particle-effects, ping-pong, power-ups, pygame, python, retro, screen-shake, starfield
- Language: Python
- Homepage:
- Size: 6.05 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
π°οΈ Space Ping Pong
An arcade-style, neon space-themed ping pong game built with Python & Pygame
Built with the tools and technologies:
Python | Pygame | dataclasses | Enum | JSON (local storage) | OOP
---
## **Table of Contents**
* [Overview](#overview)
* [Features](#features)
* [Getting Started](#getting-started)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Configuration](#configuration)
* [Usage](#usage)
* [Project Structure](#project-structure)
* [Controls](#controls)
* [Difficulty & Power-ups](#difficulty--power-ups)
* [License](#license)
* [Contact](#contact)
---
## **Overview**
**Space Ping Pong** is a colorful, fast-paced desktop game. It features a starfield background, particle effects, power-ups, screen shake, a high-score table, and both **Single-player (vs Computer)** and **Local Two-player** modes. The animated menu lets you pick a mode, toggle difficulty (E/M/H), view high scores, and exit.
> The game stores high scores locally (JSON), so your top results persist between runs.
### **Project Highlights**
- **Two Modes:** Play vs Computer (AI) or Local Human vs Human.
- **Dynamic Feel:** Particle bursts, pulsing menu text, starfield, and subtle screen shake.
- **Power-ups:** Speed Boost, Paddle Grow/Shrink, Shield, Multi-Ball, and Freeze.
- **High Scores:** Auto-saved locally and shown in a dedicated screen.
- **Lightweight:** Only external dependency is `pygame`.
---
## **Features**
- Animated main menu with difficulty toggle (E/M/H).
- AI opponent with difficulty scaling.
- Local 2-player option (separate key bindings).
- Multiple power-ups with visual feedback.
- Particle effects for hits/scoring and a trailing ball effect.
- Persistent high scores (JSON file).
- Clean, modular Python code split across multiple files.
---
## **Getting Started**
Follow these steps to set up and run the project on your machine.
### **Prerequisites**
- **Python 3.8+**
- **pip** (Python package manager)
### **Installation**
1. **Clone the repository (or download the source code):**
``` sh
git clone https://github.com/brej-29/space-ping-pong.git
cd
```
2. **Install dependencies:**
``` sh
pip install -r requirements.txt
```
### Configuration
This game runs out-of-the-box. Optional tweaks:
- **Window & FPS:** edit SCREEN_WIDTH, SCREEN_HEIGHT, and FPS in settings.py.
- **Default Difficulty:** in game.py (self.difficulty = Difficulty.MEDIUM), change to EASY or HARD.
- **High Scores file path:** adjust in storage.py if you want to store it somewhere else (e.g., a data/ folder).
### Usage
Run the game from the project root:
``` sh
python main.py
```
> If youβre using a virtual environment, activate it first (see above).
---
## Project Structure
``` bash
.
ββ LICENSE
ββ README.md
ββ requirements.txt
ββ gifs/
β ββ space-ping-pong.gif # gameplay preview (update name if different)
ββ main.py # entrypoint (runs the game)
ββ game.py # Game loop, states, drawing, event handling
ββ settings.py # screen size, FPS, colors, etc.
ββ enums.py # GameState, Difficulty, PowerUpType
ββ vector.py # lightweight Vector2D
ββ ball.py # Ball entity, physics & trail
ββ paddle.py # Paddle entity, player/AI logic & effects
ββ particles.py # Particle & Star classes
ββ powerups.py # PowerUp entity & visuals
ββ storage.py # load/save high scores (JSON)
```
---
## **Controls**
**Menu**
- `1` β Play vs Computer
- `2` β Play vs Human
- `3` β High Scores
- `E / M / H` β Change difficulty
- `ESC` β Quit
**Gameplay**
- **Player 1 (Right):** Arrow `β` / `β`
- **Player 2 (Left, only in Human vs Human):** `W` / `S`
- `SPACE` β Pause / Resume
---
## **Difficulty & Power-ups**
- **Difficulty**
- The AI paddle behavior changes based on `Difficulty` (EASY / MEDIUM / HARD).
- You can toggle it from the menu using `E`, `M`, or `H`.
- To change the default, set `self.difficulty` in `game.py`.
- **Power-ups**
- **Speed Boost** β temporarily increases ball speed.
- **Paddle Grow / Shrink** β temporarily changes paddle size.
- **Shield** β gives a paddle a one-time protective barrier.
- **Multi-Ball** β spawns an additional ball.
- **Freeze** β briefly pauses ball/paddle updates.
> Power-ups spawn periodically and are collected when the ball collides with them. Particle bursts and highlights indicate pickups.
---
## **License**
This project is licensed under the **MIT License**. See the [`LICENSE`](LICENSE) file for details.
---
## **Contact**
Questions or feedback or want to collaborate? Reach out via my
**LinkedIn:** [Brejesh Balakrishnan](https://www.linkedin.com/in/brejesh-balakrishnan-7855051b9/)