Skip to content

In high school, I built a 3D Pong game using Python and the VPython library to explore game development. The game features paddles, a ball, and collision detection in a 3D environment, with difficulty levels and scoring. This project helped me learn programming basics, 3D object manipulation, and event-driven game loops. (December 2021)

Notifications You must be signed in to change notification settings

Joel04kayy/3D-Pong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

3D-Pong

This 3D Pong game is an enhanced version of the classic Pong game, implemented in Python using the VPython library. It is a visually engaging game where players control paddles to hit a ball in a 3D environment.

Languages and Tools Used

  • Python: Used to structure the game logic. Python is known for its simplicity and readability, making it ideal for projects like this.
  • VPython: A Python library that allows for creating and manipulating 3D objects. It is used to render the game objects, such as paddles, balls, and walls, in a 3D space.
  • Random and Math Modules: The random module is used for randomizing ball positions, and math is likely used for geometric or trigonometric calculations.

Key Concepts

1. 3D Object Manipulation

Objects in the game (paddles, ball, walls) are represented as 3D objects using VPython's vector system. These objects move along the X, Y, and Z axes, allowing players to interact with them in three dimensions.

2. Collision Detection

The game implements a collision detection system that ensures the ball interacts with walls and paddles accurately. The ball's velocity is adjusted upon impact to simulate real-world physics in the virtual environment.

3. Event Handling

The game responds to keyboard inputs, allowing players to control paddles, pause the game, and quit. For example, arrow keys or WASD keys move the paddles in 3D space, while other keys control game functions like pausing or quitting.

4. Game Loop

The game operates through a continuous loop that updates the game state, checking for user input, updating the positions of objects, detecting collisions, and rendering new frames.

5. Difficulty Levels

The game includes various difficulty levels (easy, medium, hard), likely adjusting the speed of the ball or the size of the paddles to increase the challenge.

6. User Interface (UI)

Text elements are displayed using VPython to show important information such as instructions, scores, and game-over messages. The game transitions smoothly between different screens like the title screen and losing screen.

Gameplay

  • Title Screen: Players can choose the difficulty level on the title screen before starting the game.
  • 3D Arena: The arena consists of walls and paddles controlled by players. The ball moves in 3D space and interacts with these objects using collision detection.
  • Scoring: Players earn points when their opponent fails to return the ball. The ball is reset to a random position after a point is scored.
  • Endgame: When a player loses, the game transitions to a losing screen, where they can restart or quit.

Game Logic

  • Movement and Collision Detection: The game handles paddle movement and ball-object collisions using VPython's 3D rendering capabilities.
  • Scoring: Points are awarded when a player fails to return the ball.
  • Key Input Detection: The game listens for specific key presses to control movement and other game actions like pausing.
  • Screen Transitions: The game smoothly transitions between the title screen, gameplay, and the losing screen.

Overall Experience

This project demonstrates the use of 3D game development concepts, including object manipulation, collision detection, and real-time event handling. By leveraging Python and VPython, the game offers a fun and educational introduction to 3D game programming.

Installation

  1. Install Python from https://www.python.org/downloads/.

  2. Install VPython via pip:

    pip install vpython
  3. Run the game by executing the Python script:

    python 3DPongMainGOOD.py

Conclusion

This 3D Pong game provides a visually engaging and interactive experience that enhances the classic Pong game. It's a great project for learning about 3D game development, object manipulation, and event-driven programming using Python. """

About

In high school, I built a 3D Pong game using Python and the VPython library to explore game development. The game features paddles, a ball, and collision detection in a 3D environment, with difficulty levels and scoring. This project helped me learn programming basics, 3D object manipulation, and event-driven game loops. (December 2021)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages