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:
An entity is defined by a set of components. Common components in a game might be things like
Navigation. Every entity has a
component, designating where they are in the world, and an
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,
- events, which are things that can happen to an entity (for example,
- commands that another worker can call to ask the component to do something, optionally returning a value (for example,
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.