A network-based Pong game, written in C++.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Aadhavan Srinivasan 352d3f26f1 Moved struct definition to separate file, and added check for displaying GUI
I moved the GameType struct (and the Mode enum) to a separate file, as I will need
to use it in the check_server and check_client functions as well. I also added the
signum function (which was previously in sign.hpp) to this file, since it was the only
function in sign.hpp. Finally, I added a check, that will only display the GUI, if the
user didn't provide any command-line arguments.
7 months ago
includes
subprojects
.gitignore
.gitmodules
README.md
ball.cpp
check_input.cpp
client.cpp
connect_code.cpp
create_release_mingw.sh
easysock.cpp
main.cpp
meson.build
numeric_base.cpp
paddle.cpp
serialization.c
server.cpp
sock.cpp
todo.txt

README.md

Netpong - A Pong game for the internet era

Netpong is a network-enabled Pong game, written in C++. It enables two players to play against each other, provided an IP address and a port. It also supports a single-player mode.

How it works

The game has only one runtime dependency: The raylib graphics system. In order to write idiomatic C++, I chose to use the raylib-cpp wrapper, which provides an object-oriented interface to the Raylib library. However, this wrapper is bundled with the project, and is thus not required to be installed.

Building

This application uses Meson as a build system. To build the application:

  1. Install meson from the link above.

  2. Install raylib from the link above (THIS IS OPTIONAL, SEE STEP 5)

  3. Set up the build directory with the meson setup build command.

  4. Compile the application, with the existing raylib installation, using meson compile -C build.

  5. If you don't have raylib installed, you can create a statically linked version of the library on Linux by running the following commands:

    meson configure -Ddefault_library=static build/
    meson compile -C build -Ddefault_library=static
    

Running

  • To run in single-player mode:

    • Run the application with no arguments: build/pong
    • Left paddle is controlled with W and S keys, right paddle is controlled with Up and Down arrow keys.
  • To run in multi-player mode:

    • One player runs the application in Server mode, specifying their IP address and a port: build/pong -S <ip_address> <port>
    • The other player connects to the first player by running in Client mode, specifying the first player's IP address and port: build/pong -C <ip_address> <port>.
    • The server controls the left paddle by default (WIP to allow the user to modify this), and the client controls the right paddle.