Get SpatialOS

Sites

Menu
These are the docs for 13.2, an old version of SpatialOS. 13.3 is the newest →

World, entities, components

This page covers: The game world. Entities and components.

Before you read this page, you should read What is SpatialOS?

The SpatialOS world

In a game running on SpatialOS, the game world is a core concept. By this we mean the SpatialOS world: the canonical source of truth about things in your game.

Entities

Entities are the objects in your game. All of the data that you want to share between worker instances needs to be stored in entities, using their components.

For example, in a world with rabbits and lettuces:

Entities example

Components

On those entities, the components might look something like this:

Components example

As a developer working with SpatialOS, you will:

  • define components, i.e. what data entities can be composed of (write a schema)
  • place entities into your world to form a starting point for your game (create a snapshot) (there are alternative ways to set up a game world)

The components on entities act as the data of the game world. And you’ll write code, within workers: game logic makes use of that data to work.

Read more about workers

Why is this necessary?

The reason for having this separately-defined world is to store the state of the game world in such a way that many instances of server-workers and client-workers can access and change it, without needing to communicate with each other.

A major reason to use SpatialOS is to exceed those limits: instead of one server looking after the server-side of the game world, SpatialOS coordinates multiple programs (server-workers) to do that.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums