C# Godot Addon that facilitates creating robust multiplayer games using the Client-Authoritative Server architecture, including client side prediction, entity interpolation, lag compensation and more!
Warning
MonkeNet uses its own fork of Godot-Jolt for networked physics, in this repository I've only provided the binaries for Windows, if you are on Mac/Linux you will have to compile Jolt yourself (it's a simple process)
After many years since my first attempt at making a functional multiplayer game, I came to one conclusion: developing multiplayer games is hard, specially when leaving the P2P architecture and opting for a more "competitive" approach like having an authoritative server. This project aims to provide a starting point that can be used to speed up the time it takes to go from idea to reality, utilizing its features like:
- CharacterBody Client Side Prediction and Reconciliation
- Snapshot Interpolation for smooth visuals
- Clock Synchronization between the server and clients
- State Replication between clients
- Delta Compression for inputs/entity states
- Lag Compensation for client to client interactions
Important
Keep in mind my approach was completely personal, as I don't have prior experience with any other networking solutions for game engines like Fishnet/Fusion/UnrealEngine etc, I wrote what was useful for me and that might not be the best approach, if you have any thought/opinion about how the addon does stuff please let me know.
MonkeNet requires your game project to use .NET 8, also it heavily uses ImGui to display very important debug information, this means you will also have to install ImGui Godot in your project, that's MonkeNet only dependency, altough I plan to remove it/make it modular in the future.
MonkeNet is a Godot addon, to start using it copy the addons\monke-net\
folder, paste it into your project addons\
folder, and enable the plugin in your project settings. After this, you will have access to all MonkeNet resources.
This repository is the developing environment for the addon, including tests and a demo project showcasing MonkeNet capabilities. If you have any trouble getting it to work, cloning this repository might be a good starting point that you can later adapt to your games requirements.
2024-12-15.01-11-03.mp4
MonkeNet is structured in different "components" that are Nodes inside the Godot engine, these components work together to provide different functionalities. Usually for the same funcionality there is a Client component and a Server component altough they do different things. Here there are some examples:
ClientEntityManager.cs
handles requesting an entity on the server whileServerEntityManager.cs
actually takes that request and spawns the entity.ClientNetworkClock.cs
receives clock data from the server and updates its internal state, while theServerNetworkClock.cs
just runs a simple clock that increments each tick.
The MonkeNetManager
class is a singleton that can be used anywhere in your project and allows you to start either a server or a client.
- Client Manager
- Entity Manager
- Network Clock
- Snapshot Interpolator
- Snapshot Rollbacker
- Input Manager
- Server Manager
- Entity Manager
- Network Clock
- Input Receiver
- Message Serializer
- Entity Spawner
- Network Manager
- MonkeNet Config
If you have any questions, please contact me on Discord, I'll be happy to help.