A snapshot is a representation of the state of a SpatialOS world at a given point in time. It stores each persistent SpatialOS entity and the values of their SpatialOS components’ properties (SpatialOS documentation).
You need a snapshot as the starting point (using an “initial snapshot”) for your SpatialOS world when you deploy your game either locally or to the cloud. In the GDK, you need to generate a snapshot when you make certain changes to your project configuration; see How to generate a snapshot, below.
What’s listed in snapshots
The GDK snapshots contain three kinds of SpatialOS entities: Startup Actors, critical entities, and placeholder entities.
Startup Actors are stably named replicated Actors (Unreal documentation) that you have placed in a Level. The startup Actors need to be listed in the snapshot so that SpatialOS spawns an entity only once for each Actor. If the startup Actors are not in the snapshot, you may get multiple entities for each Actor when you launch multiple server-workers.
Critical entities are listed in snapshots by default.
Critical entities are functionality critical for the GDK; do not delete them. SpatialOS needs them for launching a deployment. You save these into your initial snapshot when you generate it.
The critical entities are:
SpatialSpawner- an entity with the
PlayerSpawnercomponent which contains the
spawn_playercommand. Client-workers connecting to a deployment use this entity to spawn their player.
GlobalStateManager- an entity with the
GlobalStateManagercomponent which has a map of singleton classes to entity IDs (see Global State manager glossary entry). The GDK uses this entity to orchestrate the replication of Singleton Actors.
Placeholder entities are listed in snapshots by default.
These entities exists only to set up server-worker boundaries in a way that is easy to test with multiple server-workers. These entities do not spawn as Actors when checked out by a worker and serve no purpose within the GDK. For most intents and purposes, you can safely ignore them.
How to generate a snapshot
To generate a snapshot, use the Snapshot button on the SpatialOS GDK toolbar in the Unreal Editor.
This creates a snapshot called
default.snapshot which you can find in
If you want your snapshots to be exported to a different path you can specify the output path and file name of the snapshot using the GDK toolbar settings.
When to generate a snapshot
You need to regenerate a snapshot when: 1. Generating schema for a new class. 1. Modifying replicated properties or RPC signatures for any class whose schema was previously generated. 1. Placing or removing replicated Actors in the Level. 1. Modifying replicated values on placed replicated Actors. 1. Adding or removing a singleton class.