THIS PROJECT WAS THE WORK OF 2 PEOPLE BUT I COULDN'T FORK THE ORIGINAL REPO DUE TO MY SCHOOL'S ORGANIZATION
- [Skaro971] (https://github.com/Skaro971)
This is a C++ project developed using SFML for the rendering and Winsock2 (Windows.h).
It includes a Client and a Server, built with modular libraries (Core and Engine).
This project shows the implentation of a server transmitting data to several players using socket in native C++. This allow the players to see themselve and other player's movement.
Technologies used:
- C++17
- SFML 2.6.1
- Winsock2 for networking (socket)
- A small custom 2D Engine
- CMake for build management
- Visual Studio 2022 (or compatible)
- CMake >= 3.21
- Git
- Clone the repository (or download and de-zip):
git clone https://github.com/tiagzoc/MultiPlayer.git
- Create a build directory and navigate into it:
mkdir build && cd build
- Run CMake to configure the project:
cmake ..
- Navigate to your build directory and open
MultiPlayer.slnx:
If you are not using Visual Studio as an IDE, click on the
Serverproject and thenSet as Startup Project.
- Run the
Serverexecutable first, then how manyClientyou want.
Note: SFML DLLs are automatically copied next to the executables after build with CMake.
- The Server handles network connections, player management, and message broadcasting.
- The Client connects to the server, sends input data, and renders the game state using SFML.
- The Core library provides shared utilities and structures used by both Client and Server.
- The Engine library builds on Core to handle gameplay logic and network interactions.
- Networking is event-driven, with a system of handlers for different package types.
- Using Winsock2 library to create networking and connection between client / server from scratch.
- Setting up a modular C++ project with multiple libraries and executables.
- Using CMake with FetchContent to automatically manage dependencies and copy DLLs to the right directory.
- Implementing precompiled headers (PCH) for faster compilation.
- Working with SFML for rendering and window management.
- Handling networked gameplay and event-driven communication.
- Add the removing of entity (currently player can only join).
- Create a mini space-war game to have an actual use for the networking.
- Fix the crash when you close a window (related to issue 1).
- Refactor some Engine code for better maintainability and flexibility.
- Add support for cross-platform builds (Linux / macOS) beyond Windows.