b. What the project does

The Blank Project offers the basic ability to launch a deployment, connect a client-worker and server-worker to it, and let the Player Lifecycle module create a player entity to represent the client.

This page describes its functionality and introduces the tooling and workflows along the way.

Launch a local deployment

First, hit Ctrl+L on Windows, or Cmd+L on Mac, to launch a local deployment. This opens a new terminal window and launches a local instance of SpatialOS using the default_launch.json launch configuration (located at the root of your SpatialOS project).

Note: you can only have one instance of SpatialOS running on your local machine at a time.

INFO: What's inside default_launch.json

This default_launch.json includes a load balancing configuration where SpatialOS expects at most one UnityGameLogic worker to be spawned in the world.

The manual_worker_connection_only argument is specified to tell your local SpatialOS instance that you will manually connect a worker of that type to the deployment.

When your local instance of SpatialOS is ready, you should see the following message in the window:

    SpatialOS ready. (6.2s)
    Access the Inspector at http://localhost:21000/inspector
    Access the new modular Inspector at http://localhost:21000/inspector-v2

Connect workers to your local deployment

In your Unity Editor, open the DevelopmentScene found in the Assets/Scenes/ folder. You should find a ClientWorker and GameLogicWorker present in the Scene hierarchy.

Image: DevelopmentScene contents, show in your Unity Editor

Select the Play button. This connects both a client-worker instance and a server-worker instance to your local deployment.

You should notice some output in the terminal window indicating that your workers connected to the deployment.

    SpatialOS ready. (6.2s)
    Access the Inspector at http://localhost:21000/inspector
    Access the new modular Inspector at http://localhost:21000/inspector-v2

The SpatiaOS Inspector

Eagle-eyed observers would have paid attention to this line from earlier:

   Access the Inspector at http://localhost:21000/inspector

The SpatialOS Inspector is a web-based tool that you use to explore the current state of a SpatialOS world. It provides a real-time view of what’s happening in your deployment, either locally or in the cloud. Using this tool, you can see:

  • Which SpatialOS entities are in the world, where they are and their component values.
  • The worker instances connected to the deployment.
  • The authority and interest regions for each worker instance.

You can find out more about the SpatialOS Inspector here.

In a browser of your choice, navigate to localhost:21000/inspector. You should be able to validate that two workers are connected to the deployment:

Image: The SpatialOS Inspector's list of worker instances for this deployment

Looking further down, notice that there are four entities in your world:

Image: There are four entities in the SpatialOS game world

The UnityGameLogic-worker and UnityClient-worker are worker entities. These types of entities are spawned and deleted automatically by SpatialOS when a worker of that type connects or disconnects. We will not cover worker entities or system entities in this tutorial, but you can read more about them here.

PlayerCreator entities are used by the PlayerLifecycle module to handle player creation requests. If your world does not contain at least one PlayerCreator entity, the PlayerLifecycle module will not work. To meet this minimum requirement, the default snapshot in the Blank Project includes a PlayerCreator entity.

The Player entity is then created by the Player Lifecycle module as soon as the client-worker connects to the deployment.

Updated about a year ago

b. What the project does

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.