This codebase provides a suite of tools and libraries to simplify the development of multi-player modifications and ensure consistency across all of them. The primary goal is to provide a common foundation and interface, in regards to shared functionality and data. It covers many fields we found important during the development of multi-player mods, such as:
- Networking: The core of the framework, it provides all the necessary tools to synchronize data between players.
- ECS: Backed by a strong ECS framework that simplifies entity management and world streaming, it is also easily extensible.
- Scripting: The Node.js scripting layer provides an easy way to create and manage resources used on game servers. It also provides a common interface accross all multi-player mods, making it easy to create and manage shared resources between games.
- Logging: It is always important to log actions and errors, so the framework provides a simple way to do so.
- GUI: It also provides a simple way to create and manage GUI elements using the Chromium Embedded Framework library.
- Sentry: The framework provides a simple way to report errors and exceptions to the Sentry service.
- Firebase: It is used to easily store and retrieve data from the Firebase service. Including stats, player data, and more.
- Externals: Contains wrappers for various libraries and services used within the framework.
- Integrations: Provides a simple server and client moddable setup that combines various framework components together allowing you to focus on game-specific features themselves.
- Utils: It provides a collection of useful functions and classes that are used throughout the framework.
MafiaHub Services are NOT part of this project, but our framework provides a simple way to integrate them. Feel free to ask us for more information about this service, so we could provide the resources and a license to use it.
We're always looking for new contributors, so if you have any ideas or suggestions, please let us know and we'll see what we can do to make it better. You can either reach us at our Discord server MafiaHub, or by raising an issue on our repository.
If you're interested in development, please read our Contribution Guidelines.
We use CMake to build our projects, so you can use any of the supported build systems. We support Windows, Linux, and MacOS operating systems at the moment. You can follow this guide to get started:
First make sure your Git client supports LFS objects, visit Git LFS page for more info.
# Clone the repo
git clone https://github.com/MafiaHub/Framework.git
cd Framework
Note: If you have issues cloning the repository (Git LFS related errors), first ensure you have Git LFS support enabled. If you do and this looks to be a server issue, please contact @ZaKlaus on our Discord server to investigate it.
# Configure CMake project
cmake -B build
# Build framework
cmake --build build
# Run framework tests
cmake --build build --target RunFrameworkTests
Ensure you have the cmake tools installed in your copy of Visual Studio first. Open your newly cloned Framework repository folder in Visual Studio and it will automagically set up everything for you!
Things to note:
code/projects
folder is hidden by default as it's ignored by Git, in Solution Explorer, enable Show All Files option to see your project files.- Changes in your project's cmake will not be auto-detected, cmake will only reload config on build, otherwise you can do it yourself in the Projects section in main menu.
- Visual Studio 2022 embeds an old and unsupported version of ClangFormat, we highly recommend you to install LLVM tools and set up a custom ClangFormat executable in VS's
Tools > Options > Text Editor > C/C++ > Code Style > Formatting > Use custom clang-format.exe file
property.
The guide on how to set up the project files for CLion is available here.
Multi-player modifications are cloned into the code/projects
directory and are automatically picked up by the framework. We use this approach so that we can easily manage the projects and their dependencies, perform mass changes and general maintenance during the development.
# Create and navigate to folder
mkdir -p code/projects
cd code/projects
# Clone a MP repo that uses the framework
git clone [email protected]:<your-awesome-username>/<your-amazing-project>.git
# e.g.
git clone https://github.com/MafiaHub/MafiaMP.git
Now you can access your targets and build them within the framework.
To exclude a project from compilation, simply create an empty file called IGNORE
in the root of the project.
The code is licensed under the MafiaHub OSS license.
The 5th clause exists to ensure that the work can focus primarily on this repository, as we provide an access to the framework and its services. This is important to ensure that the framework is not used for other purposes, such as the creation of other projects, that would diverge from the framework. This approach guarantees that the changes are directly made to the framework itself, having a healthy ecosystem in mind.