Sites

Menu

1.2 - Project walkthrough

The Blank Project is a barebones SpatialOS project containing the minimal functionality required to begin development with the GDK. It includes:

  • A basic Unity project.
  • Local and cloud launch configurations.
  • A default snapshot containing only a single PlayerCreator entity.
  • Client-worker and server-worker configurations.
  • Worker build configuration.
  • Unity Scenes to use in development.

Clone the project

Before exploring the contents of the Blank Project, we recommend you first download the source code. There are two ways you can do this: either get the source code as one zip file download or clone the repository using Git.

We recommend using Git, as Git’s version control makes it easier for you to get updates in the future.

Configurations

At the root of the project you’ll find two launch configurations: one for local deployments and one for cloud deployments.


    gdk-for-unity-blank-project/
        ├── snapshots/
        ├── workers/
        ├── cloud_launch.json
        ├── default_launch.json
        ├── spatialos.json

These configurations are used to determine what template your deployment uses, the world size, the load balancing policies, and some worker-specific configuration parameters.

The snapshots directory contains a default snapshot defining the initial state of your game world.


    gdk-for-unity-blank-project/
        ├── snapshots/
                ├── default.snapshot
        ...

You can find the root of the Unity project in workers/unity/.


    gdk-for-unity-blank-project/
        ...
        ├── workers/
            ├── unity/
                ├── Assets/
                ├── Packages/
                ├── ProjectSettings/
                ├── spatialos.UnityClient.worker.json
                ├── spatialos.UnityGameLogic.worker.json
        ...

Here, you will find the client-worker and server-worker configurations. They are used to configure how a worker should be launched and specify particular Runtime settings for the given worker type.

Under Assets/Config/ of the Unity Project, there is a BuildConfiguration asset.


    Assets/
        ├── Config/
            ├── BuildConfiguration.asset
            ...

This asset defines for each worker type the target platforms to build and which Scenes to include. By default the GDK builds both Windows and MacOS UnityClients for cloud deployments, but only build a single platform (Windows or MacOS depending on your machine) for local deployments. This is because you will only ever run a client for local deployments on your machine, but may want to distribute your game to both Windows and MacOS users when running a cloud deployment.

See below to learn more about:

Opening the project

Open the Unity Project found at workers/unity/. The first time you open the project, Unity will retrieve all the packages defined in the manifest.json and cache them on your machine. After resolving the packages, you’ll see a popup that says Generating code.

Scenes

You may have noticed that there are a set of Scenes present at Assets/Scenes/.

The ClientScene contains a ClientWorker prefab to represent a client-worker and similarly the GameLogicScene contains a GameLogicWorker prefab to represent a server-side worker. By playing either of these Scenes, these prefabs will try to connect their respective client-worker or server-worker to your SpatialOS deployment.


    ClientScene
        ├── ClientWorker

    DevelopmentScene
        ├── ClientWorker
        ├── GameLogicWorker

    GameLogicScene
        ├── GameLogicWorker

The GDK also allows you to run more than one worker in your Unity Editor. The DevelopmentScene contains both ClientWorker and GameLogicWorker prefabs, which in turn runs both a client-worker and a server-worker side-by-side in your Editor. By running both workers you don’t need to build out workers with every new change. This greatly speeds up local iteration times, as you’ll discover later on in this tutorial.

Packages and assembly definitions

Within your Unity Project there is a Packages/manifest.json file, which defines all the package dependencies of your project. The Blank Project includes dependencies to all Feature Modules, to make it easier to adopt and include them in your user code.


    unity/
        ├── Assets/
            ├── BlankProject.asmdef
            ...
        ├── Packages/
            ├── manifest.json
        ...

There is also a BlankProject assembly definition in your project’s Assets folder. Although the project manifest.json defines dependencies to all GDK Feature Modules, only the Core and Player Lifecycle modules are referenced in the assembly definition. This is because the Blank Project has minimal game code, and only makes use of the Player Lifecycle module. You can read more about assembly definitions here.

Next: What the Blank Project does

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums