Networking solution for RTS with 10,000+ entities.

I’m working on an RTS, and I’d like to be able to have multiplayer capabilities. Each player can possibly have up to a couple thousand units which need to be communicated across a server. A game can have up to 10 players. This is my first networking attempt, and I have no real idea where to start. There are many solution and many opinions. I started with a SmartFoxServer (SFS), but the video documentation is a bit lacking. There are unity project examples in SFS, but I definitely need my hand held through the implementation process for this. So, anyone know of a service that has great documentation and might be able to handle passing loads of data? (I would like to attempt Deterministic Lockstep to try and reduce the amount of serverdata being processed, but again, I would need very thorough documentation on how to implement that).

TL;DR
What is a good Massive RTS networking solution?

Any help, suggestions, and opinions are appreciated.

1 Like

The only good way to network a game with this many entities is to rely on complete determinism

In short; instead this:

  • client commands group of units to move to position A (sends a move command to server)
  • server processes move command and makes units move
  • server sends pos/rot sync messages to all clients for all moving units

you would have this:

  • client commands group of units to move to position A (sends a move command to server)

  • client makes units move locally

  • server receives move command and forwards it to every other client as well

  • server and all non-owning clients revert their entire world to how it was at the timestamp of the move command (compensates for lag), applies command, and fastforwards back to present while making units move locally

  • because of determinism, both clients and server will have units do the exact same movement, but there will be no need to sync anything except move commands

So instead of sending 10k positions and rotations every frame over network, you’ll be sending one single “I clicked move at that position” message once in a while

But, if this is your first networking project, you might want to consider something simpler first. There’s a reason why it’s uncommon to see this sort of scale in online games, and it’s not because people haven’t thought about it :smile:

With that said, DOTS has intentions of being completely deterministic one day, and I’m pretty sure the reason why Unity are putting so much effort on determinism is to make this kind of thing possible

2 Likes

Gotcha. Thank you! Do you have any suggestions for a networking service that could be good for someone getting into networking? Regardless of its ability to handle the deterministic commands.

You’ll have to wait for DOTS NetCode to come out. The multiplayer sample shooter game shown at last Unite should come out Soon™ and I’m guessing it’ll include a new release of DOTS Netcode. But in the meantime, there’s a temporary version publicly available now if you want to look at it: https://github.com/Unity-Technologies/multiplayer

If you’re looking for networking outside of DOTS, it’s always been hard to find a good solution. Most asset store solutions are very focused on accessibility to beginners, which is totally fine, but there is always a price to pay in power and versatility

1 Like

Okay, I’ll keep a watch on the DOTS NetCode. Thank you!

Here is another material for networking details in Microsoft’s classic Age of Empires.

Our friends from Factorio wrote a lot of blog posts about it:
https://www.google.com/search?q=factorio+multiplayer+blog

Their multiplayer is working with 200 players :slight_smile:

They use:

  1. Complete determinism with desync checks
  2. Two worlds
    a) Server authoritative world (stepped when server sends “inputs” packet)
    b) Client predicted world (based on authoritative world + local client input, few frames ahead of auth world)

Main advantage using ECS with this solution is that:

  1. Very little MP complexity
  2. Tiny data transfers (user input)
  3. ECS allows easy and safe world copy (when auth world changes)
  4. ECS is not hard to make deterministic (use fixed point and be careful with parallel collections)
1 Like

As someone here in the forum lately pointed me to the interesting GDC Vault Talk from a Blizzard Employee about Overwatch and their ECS - they use the same design as OndrejP mentions, but use a different technique for missed input iirc:

They use:
1) Complete determinism with desync checks
2) Two worlds
a) Server authoritative world (stepped when server sends "inputs" packet)
b) Client predicted world (based on authoritative world + local client input, few frames ahead of auth world)

And this is the actual FF Blog Post Ondrej mentions: FF-302

1 Like

So, I’ve been looking at the NetCode docs (https://docs.unity3d.com/Packages/com.unity.netcode@0.0/manual/getting-started.html) and noticed that in this example, only commands are being sent to the server and the clients simulate those commands on their side.

Is this a concrete example for what you described:

?

My hope is that if the networking team will start with a shooter netcode example and also generate an RTS networking model. As mentioned they have completely different synchronization models.