What's new

These are the docs for 12.1, an old version of SpatialOS.The docs for this version are frozen: we do not correct, update or republish them.14.5 is the newest →

What are entities?

Entities are a core concept in SpatialOS that groups data in a way which is meaningful in a game world. Almost anything
can be an entity, from a player in a game to a car, a building, an island, a trace left by an ant looking for food or
any other object in a simulated world.

Here are the entities that make up a simulated city, as viewed through the Inspector:

Components

An entity is defined by a set of components. Common components in a game might be things like Flammable and
Navigation. Every entity has a Position
component, designating where they are in the world, and an
EntityAcl
component, designating which workers have read access to an entity and which workers have write access to each of its components.

Components can contain:

properties, which describe persistent values that change over time (for example, in a game, Health)

events, which are things that can happen to an entity (for example, StartedWalking)

commands that another worker can call to ask the component to do something, optionally returning a value (for example, Teleport)

An entity can have as many or as few components as you like in addition to the required components. The standard schema library contains some common components.

All components are defined in a global schema. To define an entity, you only need to define the set of components it has.