Skip to content

petegilb/peterpong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Peter Pong

A two-player Pong game built in C++ using the raylib game library. Developed as a hands-on C++ project to practice game architecture, object-oriented design, and real-time game loop patterns.

Features

  • Two-player local multiplayer on a single keyboard
  • Ball speed increases with each paddle hit, up to a configurable maximum, creating escalating difficulty
  • Angle-based ball deflection — where the ball hits the paddle determines its outgoing trajectory
  • First to 11 points wins, with a game-over screen and win sound effect
  • Round timer with a short delay between points before the next round starts
  • Custom warm color palette with pixel-art style paddle textures
  • Sound effects for ball hits, scoring, and game win
  • Locked at 60 FPS for consistent gameplay

Technical Highlights

  • Object-oriented design with PongGame, Player, and Ball classes
  • Game loop split into a GameTick (logic) and RenderTick (rendering) for clean separation of concerns
  • std::unique_ptr used throughout for safe memory management
  • Ball physics driven by velocity vectors with configurable speed constants (InitialBallSpeed, MaxBallSpeed, BallSpeedStep)
  • Goal detection via a std::function callback (OnGoal) decoupling the ball from game state
  • State machine managing PreGame, MidGame, and EndGame phases
  • CMake build system with raylib fetched and built automatically as a dependency

Controls

Player Up Down
Player 1 W S
Player 2

Play

Download the executable from the GitHub Releases page and run it — no install required.

Build from Source

Requires CMake 3.15+ and a C++17 compiler. raylib is fetched automatically.

cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
cmake --build cmake-build-release

Third Party Assets

Screenshot

game screenshot

About

pong implementation for learning + practicing C++ using raylib

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors