Features!
Client Side Prediction
When the user presses a button, we want to see that reflected immediately similar to a one player game. Client side prediction runs your players inputs locally, then when a snapshot comes from the server we can adjust things using a rollback process that makes sure the server is still the authority. This is done without any jitter or jerky movements, except in the extreme cases of players being hit hard and fast off course by other players. In such an event, things are corrected and the player is back client side predicting accurately again.
Deterministic 2D physics and Cross Platform Play
Having deterministic physics means we avoid jitter on client side prediction, but also its been done in a way to allow cross platform play.
Unity uses Box2D which does not achieve the above well, so this project has a simple 2D AABB physics system written from scratch using the SoftFloat library.
Floats in code are great, except each different cpu architecture decides how to deal with rounding on the trail end, which can screw up determinism between platforms, especially on physics and animation. By using SoftFloat, the maths is done in software in a predictable way
Entity Interpolation
Client side prediction covers the current player, but everything else a player views around them, such as other players, items, monsters etc, then that’s covered with entity interpolation. Fancy words, in short; positions of other things in the world are lerped between their last 2 snapshots from the server, to create smooth movement without any jarring jumps
Ghost Manager
If your game has a lot of players or networked things in the world, too many to fit their snapshot data into a single packet, ghost manager helps here. It collects data of all the closest world entities to each player to send them unique snapshot data of relevant parts of the world to them.
This means you can cram your world with things and it wont break the packet size. Being limited on entities would be quite annoying. This will take care of that for you automatically.
Client-Server Model with Master Server
Some networked solutions don't let you control the server tech, which means you are locked into requiring their existence to continue your game community and likely paying to keep it alive. This project gives you all of it, so you can host it anywhere you want. No reliance on anyone specific and even handy if you plan to give it to your community later in the cycle so they can keep the legacy going
Out of the box you get a master server, which is used to keep track of clients and servers and helps them connect.
The game server code is written in such a way that you run them as dedicated servers or as peer hosted servers, where the server can also be a player. Dedicated is good for big community or deathmatch types of games, where as the peer hosted approach is great for letting players host their own co-op experience to play with friends
Client Hot Joining
At the moment the current engine is only sending sync packets. This data is information relevant to around the current player. Since its all the data needed, then new players joining part way through a game will be able to join relatively quickly. As soon as the next sync packet is in, they'll be up to date with the server.
NAT Punchthrough
With the master server running, you can use it to help servers and clients connect. Part of this process is using NAT punchthrough, which helps connections happen without the need for port forwarding on the server and client sides. As long as the master server is hosted in a way where its portforwarded, then it can help others connect without the hassle
Linux Compilation Ready
Out of the box this works great on Windows, but its been tested and tweaked to run well on Linux too. Server hosting is a great deal cheaper if you run a Linux instance, which is what I do on Linode for about $5 a month. On that $5 instance I can run about 10+ servers of the sample project and get 30 odd players joining on each.
Plus a working example with PVP and PVE baked in
The project has a first to 10 kills top down deathmatch mode in place, with some random monsters on the field to show how AI/PVE stuff could work too. You could take this starting point and take it in many directions.
Cyborg Netcode Source Code
You get access to the code raw, so feel free to make changes to it. You can share it amongst your team, but please don’t give the project out to the public for free or resell it. I’m a solo dev so any funds raised from sales helps me maintain the product with updates and new features.