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 53282727ec Removed testing code 11 months ago
includes Removed ip_ver parameter 11 months ago
subprojects Added raylib submodule, under subprojects directory 11 months ago
.gitignore Added .gitignore 11 months ago
.gitmodules Added raylib submodule, under subprojects directory 11 months ago
README.md Updated README 11 months ago
ball.cpp Fixed misaligned bracket 11 months ago
check_input.cpp Rudimentary support for IPv6 in server socket creation 11 months ago
client.cpp Updated files to reflect change in easysock (from CPP to C) 11 months ago
connect_code.cpp Removed testing code 11 months ago
create_release_mingw.sh Added bash flag to fail if any command in the script fails 11 months ago
create_static_linux.sh Finished script to create and package statically linked binary on Linux 11 months ago
easysock.c Converted easysock from CPP to C, because it was mostly just C code anyways 11 months ago
main.cpp Started working on better error handling, by throwing exceptions and displaying error messages in the GUI 11 months ago
meson.build Updated files to reflect change in easysock (from CPP to C) 11 months ago
numeric_base.cpp Convert character to upper-case before converting to decimal 11 months ago
paddle.cpp Created method to set position of paddle 11 months ago
raygui_helpers.cpp Moved display_text_centered() into a separate file, since I could possibly extend this file with other raygui helper functions 11 months ago
serialization.c Replaced 'linux' with '__unix__' because the same header files are included on macOS as well. 11 months ago
server.cpp Updated files to reflect change in easysock (from CPP to C) 11 months ago
sock.cpp Removed ip_ver parameter 11 months ago
timer.c Split timer into header and implementation file 11 months ago
todo.txt Updated TODO 11 months ago

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 library. In order to write idiomatic C++, I chose to use the raylib-cpp wrapper, which provides an object-oriented interface to the Raylib library.

Building

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

  1. Install meson from the link above.

  2. Set up the build directory.

    meson setup build
    
  3. Compile the application. Meson should use a system installation of raylib, if it exists. If not, it falls back to a bundled version.

    meson compile -C build
    
  4. You can also create a statically-linked version of the game (with no runtime dependencies) 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.

TODO

See todo.txt.