PongPlusPlus is an in-progress experiment using C++ and SDL for game-design, inspired by the classic video game Pong.
In order to run this game, you will need to install the SDL and SDL-ttf library on your computer. Instructions for installation are listed below:
- cmake >= 3.7
- All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 3.81 (Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- SDL2 >= 2.0
- All installation instructions can be found here
Note that for Linux, an
apt
orapt-get
installation is preferred to building from source. - SDL Extensions
- SDL True Type Fonts (TTF) - Installation instructions here
- On linux, the preference would be to use
sudo apt-get install libsdl2-ttf-dev
- gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- Clone this repo.
- Make a build directory in the top level directory:
mkdir build && cd build
- Compile:
cmake .. && make
- NOTE: If you are compiling on Windows and want make files, you can use the
-G "Unix Makefiles"
flag. - NOTE: If you are getting errors linking to SDL, you can run cmake with a pointer to the library as below:
cmake .. -D CMAKE_PREFIX_PATH="C:\Users\jtass\vcpkg\packages" -G "Unix Makefiles"
- NOTE: If you are compiling on Windows and want make files, you can use the
- Run it:
./PongPlusPlus
.
In the below image, various game objects have been highlighted with colored boxes:
- Red: The paddle zone. Paddles will move up and down along this boundary.
- Yellow: The score board. Each side of the field has a score indicator for their respective players.
- Pink: Ball start. This is the location where the ball will always start before being served.
- Green: Current active powerup. Each player's powerup is displayed here by color. When used, the box becomes hollow.
Recommended Number of Players: 2
Gameplay Loop:
- Each player takes control of a paddle.
- The serve owner serves the ball at the opposing player - on bootup, this will always be player 1.
- Players move vertically on their respective halves of the field to bounce the ball back and forth, speeding the ball up each time.
- If the ball passes your paddle, the opposing player will be rewarded with a point. You will be awarded the next serve.
- Play continues until either player reaches 10 points, at which point the game will be reset.
Once per point, a user can attempt to catch the ball. Doing so successfully will award the user a game-altering powerup. But beware, missing a catch will reduce the size of the paddle by 10%, down to a minimum size of 30%.
Powerup Varieties:
- Fire
- Effect: Increases the ball speed by 2x immediately. Each subsequent hit will increase ball speed by 10%, rather than the usual 5%.
- Duration: 10 Hits
Fire.Ball.mp4
- Ice
- Effect: Each time a paddle is contacted by the ice ball, its speed decreases by 20%.
- Duration: 10 Hits
Ice.Ball.mp4
- Sun
- Effect: Both players are blinded. The color contrast between the ball and the background become more difficult to distinguish.
- Duration: 5 Hits
Sun.Ball.mp4
- Shadow
- Effect: Shadows erupt around the opposing player's side, rendering them unable to see their paddle.
- Duration: 3 Hits
Shadow.Ball.mp4
- Confusion
- Effect: The ball begins to move in wave patterns and behaves in unexpected ways when objects are contacted.
- Duration: 5 Hits
Confuse.Ball.mp4
Player 1:
- Move Paddle Up: W
- Move Paddle Down: S
- Catch Ball: D
- Serve Ball: Space
Player 2:
- Move Paddle Up: Arrow-Up
- Move Paddle Down: Arrow-Down
- Catch Ball: Right-CTRL
- Serve Ball: Return (Enter) or Numpad-Enter
- More Powerups:
- Root ball
- Shrink ball
- Energy ball
- LOVE ball
- Computer-controlled Player 2
- Menus, including power-up selection
- Stat-tracking