3. Offloaded and zoned servers
In the same way that native Unreal uses a single server and multiple clients, SpatialOS uses multiple server-worker instances and multiple client-worker instances.
Out of the box, the GDK’s SpatialOS networking is similar to native Unreal networking: a single server with multiple clients. However, when your game uses SpatialOS networking, it can also run on multiple servers.
In SpatialOS, the servers are called server-worker instances and clients are called client-worker instances (or game clients):
- SpatialOS uses one or more server-worker instances to compute your game world.
- Each player uses a client-worker instance to connect to and interact with your game world.
In a multiserver game world, load balancing strategies distribute computational load over two or more server-worker instances. This enables games to scale beyond what would be possible with a single Unreal Server. The GDK for Unreal has two pre-defined load balancing strategies:
- Offloaded servers
- Zoned servers
You are not limited to one load balancing strategy per game. For example, you can offload the AI computation to a dedicated AI server-worker and then you can also implement zoned servers for the same game with another set of server-workers. You can also use the GDK for Unreal to develop your own load balancing strategies.
Offloaded servers distribute computational load. They define a set of server-worker instances that each computes one set of Actor types across the game world. For example, server-worker instances that are dedicated to processing AI computation.
AI is a good candidate for offloading because it is computationally expensive but latency-tolerant. It leaves your game’s main server-worker instance free to run other game systems at a larger scale.
Zoned servers divide your game world into areas of authority with a different server-worker instance responsible for each area. The server-worker instance responsible for an area updates the entities in it. Each zone is computed by one server-worker instance.
If you deploy your game on a virtual machine or a bare-metal machine in the cloud, then the server-worker instance resides on that machine. SpatialOS supports both bare-metal and virtual machines in the cloud and a hybrid infrastructure that uses both.
Image: Zoning the game world with multiple server-worker instances