Multiplayer online 8-ball pool game in C++.

Multiplayer online 8-ball pool game in C++.

-
completed
1
3 weeks
C++/Python/FastAPI/Docker/SFML
March 2024
Network Game 2D C++ Python FastAPI Docker SFML SAE

Context

This project was carried out during the first half of a course module on Computer Network at SAE Institut Geneva as part of the second year of the Bachelor’s degree in Games Programming. This half of the module focused on programming network applications (packets, protocols, lobbies, etc.) communicating with a database.

We had to make an online turn-based game using our from scratch physics engine created during the first course module of the same year. We had to create a network protocol for the gameplay, add a basic ranking system with a database and add a lobby system.

I decided to create a 8 ball pool game where each victory increases the player’s elo while each defeat decreases his elo.

Showcase

Demo of my 8-ball pool. It shows two players (blue and red windows) playing a network game

Client connection and identification.

If the player already has a name in the game, they can log in directly. Otherwise, they must create a new name to be added to the database containing the player rankings.

Demo of client identification in my app.

Demo of client identification in my app.

Joining a lobby.

When the player presses the ‘Play’ button, the server searches for the first available lobby and puts the client on hold for another player.

Demo of two clients joining a lobby.

Demo of two clients joining a lobby.

End of game and update of players’ elo.

When the game ends, the winner gains elo points and the loser loses elo points. Players are then redirected to the main menu, where they can quickly start a new game.

Demo of a player winning the game + the ability to restart a game easily.

Network code documentation.

If you are intersted in the network code I made for my game, you can check the documentation :
turn-based game network code documentation

What did I learn ?

  • The basics of network programming.
    • sending and receiving packets.
    • making and handling HTTP requests using FastAPI (in python) and SFML (in C++).
    • The theoretical basis of network layers.
  • Creating my own network protocol for gameplay.
  • Implementing a simple lobby system.
  • Using a SQL database through an Object-Relational Mapper (ORM).
  • Creating a graphical interface to test my database with PySide (Qt binding for Python).
  • Containerizing the project using Docker to ensure consistent development and deployment environments.
  • Document my API using Doxygen.

Related Blog Posts

© 2025 Pachoud Olivier