Gabriel Gambetta is Tech Lead/Manager of the SpatialOS Community team at Improbable.
Imagine building a game world—not one based on scripted events, but on millions of individually simulated entities with rich behaviour. A fully physical, living, breathing simulated reality based on simple rules. A massive world with no artificial boundaries and where nothing is faked. An environment where thousands of players can interact simultaneously, where their actions have long-lasting consequences and create emergent storylines.
That is precisely what Bossa Studios is building with Unity and SpatialOS.
An ambitious idea came up during an internal game jam organised by London-based game developer Bossa Studios in 2014: build a beautiful world with magnificent vistas and vast landscapes players could explore, interacting with creatures with realistic lifecycles and a fully dynamic ecosystem that would respond to their actions.
Players would chop down trees and carve out iron deposits, and craft parts they could use to build floating airships, which then would get involved in massive battles involving cannonball fire and boarding parties. And on top of that, it would be a single, unsharded, massive world where every player would be at the same time.
A rough playable prototype was made during the game jam, using the popular Unity game engine. However, expanding it into a full-blown, always-on online game—thousands of players in a single unsharded, persistent, physically simulated world—would have been too ambitious even for the largest studios, let alone a small one.
The technology to build and manage such a game just didn’t exist. So the idea had to be shelved.
Online games typically use a client-server model—a single massive server receives inputs from the clients, updates the simulated world, and sends updates back to the clients. This imposes a hard limit on the richness of the world: limited hardware resources need to be split between every entity that needs to be simulated.
This necessarily leads to trade-offs. For example, you can choose between realistic physics in a tiny map with a handful of players, or simplified physics in a big map with hundreds of players, but not both. And having millions of entities with complex behaviors is out of the question, resulting in the “theme park” feeling of many MMOs.
In summary, devs are forced to make creative trade-offs and compromise on their game’s design for purely technical limitations. Clearly we need a different way to make games.
The SpatialOS approach is an evolution of the well-known Entity-Component-System architecture. Everything in the world (players, rocks, creatures) is an entity, the core building block of a simulation. Entities are made of components, which describe their different aspects (Health, Physical) and can be combined freely.
Entities components are simulated by workers, a swarm of micro-services dynamically allocated to cope with the changing workload of the simulation. These workers can be game engines such as Unity.
By using a dynamic swarm of workers instead of a single server, SpatialOS lets you build worlds of arbitrary scale and complexity. Each individual entity can have as much compute power as necessary to make it as interesting as you want, without a trade-off dictated by technology limitations, and you can have millions of them.
Building a game client is equally simple; you build it using the game engines you know and love. For example, you can use Unity to visualise the state of the simulation on the player’s machine. In fact, since the game client is just a window into a single ongoing, living world, you can build multiple devices—PC/console, mobile, VR headset—that interact with it simultaneously.
Create your game by defining entities and components and writing client-side visualization code, test it on your local machine with the SpatialOS SDK, and then deploy it to the cloud, making it instantly playable for anyone with a link to the game—potentially thousands of players in the same place at the same time. And you don’t need to write a single line of networking code!
While single-player games are “released”, game worlds are “launched”; they need to be continuously monitored and maintained. SpatialOS runs your game world in a public cloud provider such as GCE, and provides web-based tools to manage and monitor it.
The rest is handled for you – you don’t have to deal with capacity planning, load balancing, fault tolerance or cluster monitoring, which would otherwise require significant resources and effort.
A team of five developers at Bossa Studios decided to port their ambitious prototype to SpatialOS and Unity—and in a short time they managed to build Worlds Adrift, a game world that continues to be interesting independently of players, where you can fully immerse yourself and explore at your leisure.
In Worlds Adrift, thousands of simultaneous players can interact with each other in a massive world that feels real. They can chop down trees, harvest the wood to build a ship, and then fly the ship from one end of the world to the other without running into a single artificial boundary or loading screen.
If the ship succumbs to cannonball fire while fighting another group of players, its pieces will fall to the ground and stay there forever—or at least until another player salvages them, even if it’s two (real-life) years later.
Or they can find the perfect vantage point to watch flocks of marvelous creatures going about their daily lives, feeding, fighting and reproducing.
And when the sun sets, they can craft musical instruments, sit around a campfire, and share their latest adventures with each other.
None of this is faked. There are no scripted events; players create stories by interacting with each other and with the world, a world that feels real due to the complex behaviors that emerge from the interactions of thousands of players and millions of individually simulated entities with detailed AI, such as a fully functional ecosystem. Everything is persistent, so player actions have long-lasting consequences, creating truly meaningful experiences. We have collected some of them here.
In one Worlds Adrift scaling test, we simulated a game world of 25,600 square kilometres—larger than the real-life surface area of Wales—inhabited by four million entities. This required 49 logic workers and 625 Unity engines collaboratively simulating the world’s physics (a hard problem on its own).
At the peak of this playtest, thousands of players were roaming around the islands, harvesting materials, building ships, and engaging in exciting yet completely unscripted battles.
A small team can quickly build a commercial MMO such as Worlds Adrift, set in a world of a scale, complexity and level of detail never attempted before, where thousands of players can interact simultaneously, with no more effort than it takes to build a single-player game.
We can’t wait to see what new kind of games become possible when scale and complexity are not an issue. 10,000 players in a single massive FPS battle? Incredibly realistic worlds on your mobile phone? The kind of immersive experiences VR deserves? Sign up for SpatialOS and decide yourself.