Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
/ Pong Public archive

A basic Pong game built for the windows console

License

Notifications You must be signed in to change notification settings

thebigpotatoe/Pong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pong - An interactive demo

Main Menu

Overview

This is a side project I was asked to complete for evaluation. The requirement was to build Pong, a retro game from 1972 launched commissioned originally by atari as a training exercise then later put into production as one of the first successful video games. I wanted my recreation to feel "from the era", so to achieve this I built the game in the windows console complete with sound to achieve the look and feel of a retro game.

How to compile

The game is contained in a single .cpp file called Pong.cpp due to its simple nature. In this file are all of the class definitions, the logic of the game, and the windows functions used for drawing.

Since the game uses functions on a windows console to constantly refresh the current screen buffer, it is currently limited to windows environments as it uses windows specific functions from windows.h and the User32.lib. If you wish to port this to a different OS you will have to change the various functions that are used to write to the conosle. These are mostly concentrated in the drawing utilities part of the Game class, however there are some scattered in the Player and Ball class as well.

For windows though, the compiler chosen to create the .exe in this repo was MSVC 64bit for x86 processors. This should allow the .exe to be opened on most modern windows computers. However if you want to compile from source the following command was used (from visual studio) to create the current .exe, modify this as you see fit.

cl.exe /Zi /EHsc /Fe: "Pong.exe" "Pong.cpp"

Please note that you need to have either Visual Studio or Microsoft Build Tools installed and working to use the cl command. An easy way to run the command is to use the Developer Command Prompt to run the command above.

How to Play

Game Modes

Main Menu

The game has serval modes you can play. These are selected from the starting menu using the suggested keys. Each mode offers a unique playing experience from multiplayer to various computer based games. Below is the list of modes and a brief of how they operate.

  • Multiplayer - for playing against a friend.
  • Easy - Sets the computer to an easy to beat difficulty.
  • Medium - Sets the computer to a moderate to beat difficulty.
  • Hard - Sets the computer to hard to beat difficulty.
  • Survival - Sets the mode to impossible to beat, see how long you can last!

You can quit the game from the main menu by hitting ESC or by closing the console window.

Game Start and Controls

PVP

Player 1 is to the left of the screen, while Player 2 is to the right. To move player 1, you need to press W to go up and S to go down, while Player 2 uses the UP ARROW to go up and the DOWN ARROW to go down. When playing against the computer in any computer based game mode, the player will be player one on the left of the screen.

At the beginning of the game you can start anytime by pressing the SPACE button. This will randomly choose a direction for the ball and starts play.

During the play of the game you can press P to pause play where it is or ESC to exit back to the main menu.

Scoring points

PVP

In all modes except survival the aim is to hit the ball back towards your opponent and prevent it from hitting the wall behind you. To score a point, all you 1need to do is hit the ball past the other player into their the end zone. When a player or the computer has reached 5 points the game is won and the winner screen is shown.

For the survival mode there is no end. The score is how many times you are able to return the ball before missing it. The higher the better!