Making an online multi-player game

edited in Projects

I've always been interested in the social aspects achieved in online multi-player games.
It's fascinating to see how in some online games (COD, Battlefield, Escape from Tarkov etc) one can have a high ping/latency of 150ms for example, yet it feels like an offline game when it comes to local performance. How the hell do they do that so effectively? :)

I'm well aware this is not a trivial exercise, but I see it as a fun challenge to understand how it could be accomplished and learn from it. Hopefully others here on MGSA are interested in this too, have attempted same and we can compare notes?

Prototype Goals:
1) Self-hosted server (Azure Windows VM running a Unity "headless" server. Headless to save server resources by switching graphics off)
2) Authoritative server to combat cheaters. (Server sends game state to un-trustworthy clients who update game state accordingly)
3) Support for Unity Physics on the authoratitive server (because, why not)
4) High speed, fast action, twitch type game. Not turn-based.
5) Client-Side Prediction (the client(s) only send control inputs to the server, which then responds with the world state so they can update/smooth positions etc accordingly)
6) Lag compensation on each client for remote players (interpolation)

There is a great resource here that describes what needs to happen from an architecture/logic point of view:

I started the exercise by looking at the awesome free networking engine (DarkRift 2 Networking) which is very powerful and has no CCU (concurrent user) licensing limits:

It is also not only limited to Unity and supports both TCP (reliable, slower) and UDP (unreliable, faster) protocols for sending messages between clients and server. There is a cool tutorial on the DarkRift site that allows one to get a demo up and running fairly easily. The tutorial uses a console server (non-Unity) and doesn't focus on physics, but it showcases their networking technology.
It has a Unity server available out-of-the-box for those who use that engine too.

To understand further how the deterministic Unity Physics engine can possibly be included in all this, I found a useful article with code examples:

I've done a bit of research and made some good progress in making an initial prototype so far.

The prototype uses an authoritative server that supports Unity physics. Currently basic position/rotation changes, chat and physics collisions are in that I test on local ( for now. I have a long way to go still to understand optimising performance regarding data sent and saving precious server resources when many players connect.

If I get any further and anyone is interested in this type of thing and want to follow along, I might post updates on progress made and perhaps something playable that is hosted on a server somewhere? Perhaps Cyborg Online will make an appearance one day :-P


  • edited
    Just leaving this here should anyone want to do similar.

    To test the prototype I needed an actual server. I got one for free for 30 days by creating a new Outlook email address and signing up to Microsoft Azure. I then created a Windows 2012 VM on the Azure West EU shard into which I can remote desktop. After copying the server.exe onto the VM one has to setup inbound firewall rules as well as configure the VM Network Security Group inbound rules on the Azure portal...

    and voila, a dedicated server is up and running in Europe. I get a nice high ping (214ms) from SA to test how the game client will perform so it can be optimised to cater for such a high latency.

    Here's the server view (via RDC) and the local client has connected from my desktop PC:

  • I want to tackle this one day, so thanks for doing some legwork and sharing resources! Much appreciated!
    Thanked by 1konman
Sign In or Register to comment.