Sites

Menu

The Example Project

2. Launch a local deployment

When you want to try out your game, you need to launch a deployment; the deployment runs the game’s functionality. We call the running deployment the game “simulation”, and what’s happening in it, the “SpatialOS world”.

There are two types of deployment: local and cloud.

  • A local deployment is for testing only. A local deployment runs your game simulation in your Unreal Editor.
    Your game simulation with its own instance of the SpatialOS Runtime, runs on your development machine. You can run multiple clients in a local deployment - they are useful for fast development iteration.

  • A cloud deployment runs on remote networked nodes. A node is a single machine used as server hardware.
    The cloud is where your game simulation runs when you release it, so you always deploy your released game to the cloud but you can also use a cloud deployment during development to share it with test users and run it at scale. You share your game with test users through the SpatialOS Launcher. (You’ll use the Launcher in a later step of this guide.)

Use local deployments for small-scale tests, to quickly test and iterate on changes to your project. For large-scale tests with several players, use a cloud deployment.

Step 1: Generate schema and a snapshot

Before you launch a deployment (local or cloud) you must generate schema and a snapshot to set up SpatialOS entities.

  1. In the Editor, on the GDK Toolbar, open the Schema drop-down menu and select Schema (Full Scan).
    Schema

  2. Select Snapshot to generate a snapshot.
    Toolbar

Step 2: Launch and play

This step shows you how to start one game server and two game clients in a local deployment in your Unreal Editor.
In SpatialOS, game servers are called “server-workers” and game clients are called “client-workers”.

To launch a local deployment in your Unreal Editor, set up the networking and run the game:

  1. From the Editor toolbar, open the Play drop-down menu:

    Multiplayer Options)
    Image: The Unreal Editor toolbar’s Play drop-down menu, with the relevant options hightlighted

  2. To set up the networking:
    In the Multiplayer Options section of the window:

    • enter the number of players as 2,
    • check the Run Dedicated Server setting and
    • check the Spatial Networking setting.
      (The settings might already be checked.)

      The Spatial Networking option is the networking switch; you use this to switch your game’s deployment from native Unreal networking to SpatialOS networking.

  3. Now, run the game: in the Modes section of the window, select New Editor Window (PIE).
    You are now running one game server and two game clients in a local deployment in your Unreal Editor. (If it doesn’t run, see Note below.)

What’s running?
You have started one SpatialOS server-worker instance and two SpatialOS client-worker instances locally, in your Unreal Editor. You have also started an instance of the SpatialOS Runtime locally.

What is this doing?
The server-worker instance is acting as an Unreal server. The two client-worker instances are acting as two Unreal game clients, as if two game players were playing your game.
You can switch between the two Editor windows to see and interact with each game client.

Note: If the game does not run automatically after you have selected New Editor Window (PIE), try selecting Play on the Editor toolbar. This should to start a local deployment and play the game.

Step 3: Inspect and stop play

When your game is running, you can see how it is running by looking at the Inspector on the SpatialOS Console.

  1. From the GDK toolbar, select Inspector to open it in your default web browser.


    Image: GDK toolbar’s Inspector button

    Selecting Inspector opens the Inspector in your browser:


    Image: The Inspector on the SpatialOS Console

  2. When you’re done, select Stop on the Unreal toolbar to stop the client.


    Image: Unreal toolbar’s Stop button

    This stops the running client and server-worker instances but keeps your deployment running.

Step 4: Iterate on game development

As you iterate on development of your game (by modifying classes or Blueprints, for example), you will make changes changes to replicated components - this requires incremental schema regeneration.

To do this:

  1. Select the Schema button in the GDK toolbar. (Note you do not need to do a full scan schema generation for incremental changes.)

    Stop
    Image: GDK toolbar’s Schema button

    Once you’ve regenerated schema, the GDK restarts the running deployment with the new schema.

    If you haven’t modified anything related to replication, you don’t need to regenerate schema and SpatialOS continues to use the running deployment.

  2. To test your changes, select Play on the Unreal toolbar; this starts your game’s clients and server-worker instances.

Step 5: Stop your deployment

To fully stop your local deployment, select Stop in the GDK toolbar.

Stop
Image: GDK toolbar’s Stop button

> Next: 3: Launch a cloud deployment



————
2019-07-22 Page updated with limited editorial review.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums