OSRS is a simple game written in C++ designed to implement a custom networking framework inspired by OneLoneCoder.
The framework utilizes a server-client topology and is developed using C++ with the asynchronous ASIO library, featuring custom messages, a thread-safe queue, client validation, and more. The game utilizes the SDL2 API to handle graphics, sound, and user input.
This project looks to test scalability techniques in networked video games and is part of one of my final year degree projects in university.
- Server-Client Topology: Implements a networked game architecture with a dedicated server and capability for multiple clients.
- Custom Messages: Supports custom message types to handle communication. Messages contain a header and a body. The payload of the body can be of any type thanks to the use of templates or enum classes.
- Thread-Safe Queue: Implements a thread-safe queue that uses locks to handle message communication.
- Client Validation: Data is encrypted with a scramble algorithm to validate clients with a handshake.
- Performance: Server includes a flag to maximize CPU usage (dedicated server) or maintain a balanced workload distribution.
- SDL2 API: Uses SDL2 for rendering graphics and handling user input.
The idea of the game is straightforward. You play as a dwarf in an ore quarry with a single ore vein. It's an incremental game, where upgrading your pickaxes in the shop increases your mining speed. Compete with your friends to see who can accumulate more riches!
WASDto move around.Spaceto interact. Hold to mine ore, tap to open or close the shop.Tabto view scoreboard.1 2 3 4 5to buy new pickaxes in the shop.
- C++: 17 or later
- SDL2: v2.30.3
- SDL2_image: v2.8.2
- SDL2_ttf: v2.22.0
- SDL2_mixer: v2.8.0
- ASIO: non-Boost
- Download the latest zip file from the releases page.
- Extract the zip file to your desired location.
- Navigate to the location of the executables:
osrs > x64 > Debug - Run the server and client. Make sure to update the
hostnameandportparameters in the OnUserCreate() method in Client.cpp to match the address where your server will be hosted. It defaults to the localhost address127.0.0.1. Additionally, the main function of the Server.cpp class allows you to modify theportthe server will be listening on, which defaults to60000.
-
Clone the repository:
git clone https://github.com/fluffles64/OSRS.git cd OSRS -
Install the required dependencies:
-
Build the project:
If you are using Visual Studio:
- Add the SDL2, SDL2_image, SDL2_ttf, SDL2_mixer, and ASIO /include folders into
Configuration Properties > VC++ Directories > Include Libraries. - Similarly, add the SDL2, SDL2_image, SDL2_ttf, and SDL2_mixer .lib files into
Linker > Input > Additional Dependencies. - Add the SDL2, SDL2_image, SDL2_ttf, and SDL2_mixer /lib/x64 folders into
Configuration Properties > VC++ Directories > Library Directories. - Finally, make sure you copy and paste the SDL2, SDL2_image, SDL2_ttf, and SDL2_mixer .dll files into the same directory the client and the server executables are at.
- The recommended setup is to create three different solutions: One for the client, one for the server and one for the framework. You can then add the framework project as a dependency when building the client and server projects in
Build Dependencies > Project Dependencies.
If you are using CMake or vcpkg:
Create the appropriate CMakeLists.txt file and set up environment variables or a CMakePresets.json file. You can refer to examples and best practices in the following resources: CMake and vcpkg.
-
Build the project:
mkdir build cd build cmake .. make -
Run the server and client:
./server ./client
- Add the SDL2, SDL2_image, SDL2_ttf, SDL2_mixer, and ASIO /include folders into
Disclaimer: The media folder in the source doesn't include fonts and sfx, as they might contain copyrighted material.
-
Fork the repository.
-
Create a new branch:
git checkout -b feature/YourFeature
-
Commit your changes:
git commit -m 'Add some feature' -
Push to the branch:
git push origin feature/YourFeature
-
Open a pull request.
This project is dual-licensed under the MIT License and the original OLC-3 License from OneLoneCoder, ensuring compliance with any external dependencies.

