Skip to content

Implementation of the classic game 'Pong' in C/C++. The game is played over a network, all that is needed is the binary 'netpong' on each machine

Notifications You must be signed in to change notification settings

fritzwill/tcp-pong-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

tcp-pong-game

This a full implementation of the game 'Pong'. This specific implementation of the game is played between two people over a tcp socket network.

One of the two people playing will have to be the host.

Getting Started

First we want to build the binary on both machines intending to play pong with eachother. To do this we use the following commands from:

$ cd ./pong
$ make
g++ -std=c++11 -c -o netpong.o netpong.cpp
g++ -o netpong -std=c++11 -lncurses -lpthread -lz netpong.o

With the binaries now created we have to first run this on the host machine (DIFFICULTY = 'easy','medium', or 'hard':

$ ./netpong --host [PORT NUMBER] [DIFFICULTY]

Then, on the other machine we connect to the host by using the following:

$ ./netpong [HOST NAME] [PORT NUMBER]

Example

Host

$ ./netpong --host 4000 easy
Waiting for challengers on port 4000

Challenger (2nd player besides host)

$ ./netpong student02.cse.nd.edu 4000

The pong game will then begin on both the Host and Challenger machine

About

Implementation of the classic game 'Pong' in C/C++. The game is played over a network, all that is needed is the binary 'netpong' on each machine

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages