Build worlds where everything matters

SpatialOS is a computation platform that allows you to exceed the power of a single game engine or server.

Get SpatialOS Alpha now

Code Beyond Server Boundaries

SpatialOS can create a swarm of hundreds of conventional game engines that overlap together to create a huge, seamless world. Develop unconstrained by the computational and concurrent player limits of a single engine.

Grow a Persistent World

A SpatialOS world can contain millions of persistent entities and manage their state and history. Design gameplay that allows players to affect the world in meaningful, long-lasting ways.

Deploy Fast, Iterate Fast

Use just a few CLI commands to run your world on the SpatialOS Platform, then instantly share with players. SpatialOS handles all infrastructure management and data synchronization for you, greatly increasing the speed at which you can build and grow your online world.

Architecture

What is SpatialOS?

The Current Approach

Online worlds or shards are often constrained to the single server running them.

This limits you in terms of world scale, reliability, and concurrent players. The hassle of managing servers yourself results in a much slower development and iteration process.

How SpatialOS is Different

SpatialOS is a cloud-based computational platform that lets you use many servers and engines to power a single world.

The platform coordinates a swarm of micro-services called workers, which overlap and dynamically reorganize to power a huge, seamless world.

The platform also lets you handle a huge number of concurrent players across different devices in one world.

Entity-Component-Worker Model

SpatialOS provides an abstraction that lets you easily code and iterate in this environment.

Entities

All things in your world exist as Entities. SpatialOS maintains the persistent state of all entities across a cluster of servers. Worlds can contain millions of entities.

Components

Entities consist of Components, which define their state and how other entities interact with them. Components are defined in a schema language. Automatically generated integrations then allow different workers to visualize and simulate them.

Workers

Workers are micro-services that simulate the Components of Entities across the world. SpatialOS runs as many workers across your world as needed to simulate every Component in the world. All data synchronization is handled for you.

Code Example

Implementing flammability with SpatialOS and Unity3D

This is a code example from one of our starter tutorials. It introduces a basic concept of flammability to entities in a game world. SpatialOS executes this code across many workers simultaneously, which allows the flammability behaviour to run across a huge number of entities and be visualized by many connected clients simultaneously.

SpatialOS Schema
                // The SpatialOS Schema Language lets you define cross-language 
// Components, that can be implemented and visualized across a
// variety of languages and integrations
component Flammability {
   id = 1000;

   // This property defines the persistent state of this Entity potentially being on fire
   bool is_on_fire = 1;

   // Commands provide a way of Workers interacting with other Workers. 
   // These Workers could be even written in different langauges!
   command IgniteRequest ignite returns Nothing;
}

type IgniteRequest {
   // could contain additional parameters
}
              
Unity Server Worker
                // Would be added to GameObjects that exist on Unity Server Worker.
// Potentially hundreds of Server Workers could be running in the same world.
class PropagateFlamesBehaviour : MonoBehaviour {

   // FlammabilityWriter is code generated for you
   // using our SpatialOS Schema compiler, and injected
   [Require] private FlammabilityWriter flammability;

   void OnEnable() {
      // Set up a handler for when we get an Ignite Command
      flammable.CommandReceiver.OnIgnite += HandleIgnite;
   }

   // When the trigger around the flaming GameObject intersects another Entity
   void OnTriggerEnter(Collider other) {
      if (flammability.Data.isOnFire) {
         // SpatialOS RPCs will route to whichever Worker is simulating this Component.
         flammability.SendCommand(Flammability.Commands.Ignite.Descriptor, 
                 new IgniteRequest(), 
                 other.gameObject.EntityId);
      }
   }

   // Update our Component state if we get an Ignite command
   private void HandleIgnite(ResponseHandle<Flammable.Commands.Ignite, IgniteRequest, Nothing> responseHandle) {
      if (!flammable.Data.isOnFire) {
         flammable.Send(new Flammable.Update().SetIsOnFire(true));
      }
      request.Respond(new Nothing());
   }

   void OnDisable() {
      flammable.CommandReceiver.OnIgnite -= HandleIgnite;
   }
}
              
Unity Client Worker
                // Would be added to GameObjects that exist on Unity Client Worker.
// Arbitrarily many Unity Clients would be running this code
class FlamesVisualizer : MonoBehaviour {

   // FlammabilityReader is code generated for you
   // using our SpatialOS Schema compiler, and injected
   [Require] private FlammabilityReader flammability;

   // This will reference a ParticleSystem on the GameObject
   public ParticleSystem particles;

   void OnEnable() {
      // Re-visualize when we're set on fire
      flammability.IsOnFireChanged += UpdateVisualization;
      UpdateVisualization(flammability.Data.isOnFire)
   }

   void UpdateVisualization(bool isOnFire) {
      // Enable the ParticleSystem as appropriate
      if (isOnFire) {
         particles.Start();
      } else {
         particles.Stop();
      }
   }
}
              
                // The SpatialOS Schema Language lets you define cross-language 
// Components, that can be implemented and visualized across a
// variety of languages and integrations
component Flammability {
   id = 1000;

   // This property defines the persistent state of this Entity potentially being on fire
   bool is_on_fire = 1;

   // Commands provide a way of Workers interacting with other Workers. 
   // These Workers could be even written in different langauges!
   command IgniteRequest ignite returns Nothing;
}

type IgniteRequest {
   // could contain additional parameters
}
              
                // Would be added to GameObjects that exist on Unity Server Worker.
// Potentially hundreds of Server Workers could be running in the same world.
class PropagateFlamesBehaviour : MonoBehaviour {

   // FlammabilityWriter is code generated for you
   // using our SpatialOS Schema compiler, and injected
   [Require] private FlammabilityWriter flammability;

   void OnEnable() {
      // Set up a handler for when we get an Ignite Command
      flammable.CommandReceiver.OnIgnite += HandleIgnite;
   }

   // When the trigger around the flaming GameObject intersects another Entity
   void OnTriggerEnter(Collider other) {
      if (flammability.Data.isOnFire) {
         // SpatialOS RPCs will route to whichever Worker is simulating this Component.
         flammability.SendCommand(Flammability.Commands.Ignite.Descriptor, 
                 new IgniteRequest(), 
                 other.gameObject.EntityId);
      }
   }

   // Update our Component state if we get an Ignite command
   private void HandleIgnite(ResponseHandle<Flammable.Commands.Ignite, IgniteRequest, Nothing> responseHandle) {
      if (!flammable.Data.isOnFire) {
         flammable.Send(new Flammable.Update().SetIsOnFire(true));
      }
      request.Respond(new Nothing());
   }

   void OnDisable() {
      flammable.CommandReceiver.OnIgnite -= HandleIgnite;
   }
}
              
                // Would be added to GameObjects that exist on Unity Client Worker.
// Arbitrarily many Unity Clients would be running this code
class FlamesVisualizer : MonoBehaviour {

   // FlammabilityReader is code generated for you
   // using our SpatialOS Schema compiler, and injected
   [Require] private FlammabilityReader flammability;

   // This will reference a ParticleSystem on the GameObject
   public ParticleSystem particles;

   void OnEnable() {
      // Re-visualize when we're set on fire
      flammability.IsOnFireChanged += UpdateVisualization;
      UpdateVisualization(flammability.Data.isOnFire)
   }

   void UpdateVisualization(bool isOnFire) {
      // Enable the ParticleSystem as appropriate
      if (isOnFire) {
         particles.Start();
      } else {
         particles.Stop();
      }
   }
}
              

Code Example in Action

Try setting your own entities on fire across multiple workers in the Hello World Tutorial!

You’ll need to sign up for the Alpha first.

Workflow

Go from Prototype to Production

Prototype

Develop a prototype with your team.

Iterate

Quickly deploy to SpatialOS and iterate rapidly with live players.

Grow

As your project scales you can easily use as much compute as your world needs.

Features

Here’s what you get:

Engine Integration

Use Unity to build your server logic and clients, with other integrations (Unreal, C#, C++, Java) coming soon.

Deployment Console

Explore and manage your deployment within a web browser.

Inspector

Explore your world from above and track the movement of players and game objects in a massive space.

Easy Deployment Commands

Deploying your game is as easy as running a few CLI commands.

Log Viewer

Easily explore the logs generated by your game in order to diagnose production issues and identify patterns.

Snapshots

Manage and evolve the state of your worlds over time using a suite of CLI tools and APIs.

SpatialOS Community

SpatialOS developers are experimenting and sharing technical approaches and gameplay ideas.

Share your ideas, help each other out on forums, play each other’s games. We’re in it together!

Build worlds where everything matters

Get SpatialOS Alpha now