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
Find out more about the SpatialOS implementation of server-workers and client-workers
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 multiple load balancing strategies:
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 zoning for the same game with another set of server-workers.
Offloading distributes computational load by defining a set of server-worker instances that computes one set of Actor types across the game world, such as:
- server-worker instances dedicated to computing process-intensive functionality such as AI-dedicated server-worker instances.
AI is a good candidate for offloading as it is computationally expensive but latency-tolerant, leaving your game's main server-worker instance to run other game systems at a larger scale.
Find out more about Multiserver offloading
Note: Zoning is currently (in preview).
Zoning involves splitting the world into grid-based areas of authority, with a different server-worker instance responsible for each area. A server-worker instance only updates entities that are in its area of authority.
Each zone is computed by one server-worker instance which can reside on a machine in the cloud.
Image: Zoning the game world with multiple server-worker instances
Tip: You can switch between Unreal networking and SpatialOS networking from the Unreal toolbar to speed up development iteration.
- Using SpatialOS networking helps you isolate issues in your game that are related to having multiple server-worker instances.
- However, using Unreal networking lets you iterate on development faster, because it means you can skip various steps (such as generating schema) when you want to test your changes.
SpatialOS hosts your games for you. We call an instance of a running game a deployment.
In a deployment, SpatialOS starts the server-worker instances for you, running them in the cloud. You don’t need to interact with the cloud directly. The game’s client-worker instances connect to the deployment.
Image: A SpatialOS deployment, with connected server-worker and client-worker instances
Because each client-worker instance is tied to a player, and runs on the player's local machine, SpatialOS doesn't manage a client-worker instance's workload in the same way as it manages a server-worker instance's workload. This means that during game development, you set up client-worker types and server-worker types differently. The main difference is around how you synchronize data to and from the game world.
Like server-worker instances, client-worker instances can only see a part of the world. However, client-worker instances can see across server-worker instance boundaries.
Image: A client-worker instance can "see" nearby entities, regardless of the boundaries between server-worker instances
2020-06-24 Page updated with editorial review
2019-07-31 Page updated with limited editorial review
2019-05-21 Page added with editorial review
Updated 9 months ago