GitHub Improbable Blank SpatialOS Setup

In order to begin transitioning WunderKammer into something scalable, new, clean, and dissertation expectation ready it requires a different setup. From here on out as I re-build this tool from the ground up I will be incorporating data-oriented design concepts following entity component system (ECS) language and harnessing a back-end support system by Improbable services. If you’re not familiar with Improbable, I highly encourage you to read up on their SpatialOS environment. I am not planning on getting into ECS concepts and/or data-oriented design in this post, this is more or less on how I am setting up my local testing and version control environment.

The Setup

At this moment in time I am utilizing home equipment to get this up and running and decided to mimic how a lab setup will be at work. I am utilizing two machines. A Windows 10 PC for Unity and a Ubuntu 20.041 LTS machine to host the build. Traditionally this is done via the same machine you’re building the deployment on and/or hooking it to the SpatialOS cloud service. At the moment for local deployments Improbable only allows “one machine” to host the world. When it comes to the ‘workers’, a local deployment does support multiple workers; if you deploy to the cloud you can utilize multiple machines to host the world environment. This means that for the time-being a local deployment model for the world is rather restricted to that one’s machines resources. In almost all cases the setup I am doing is overkill for the average user/developer and I suggest you just stick with the information Improbable provides.

Windows 10 Machine

Currently my Windows 10 machine is running the latest 2020 version of Unity (2020.1.14f1) and I am following the documentation from SpatialOS on the Blank Project Setup and using the documentation information for a Unity environment.

I am not making any changes to the Unity setup other than confirming all of the normal Unity Update information as the Unity version Improbable uses on the Blank project hosted on GitHub is 2020.1.2. Upon opening the project for the first time I just go through the normal documentation to ‘Build all the workers’, this successfully completes in about 3 minutes and I’m now going to attempt to deploy this locally.

Local Deployment and Version Control Setup

In order to deploy locally I am following the local deployment documentation provided by Improbable and setting the Blank Project project in Unity 2020.1.14f1 on my Windows 10 Machine. To easily share the repository between my machines I am using GitHub and made some modifications to the GIT LFS attributes and updated the *.gitattributes:

*.meta text eol=lf
*.prefab text eol=lf
*.asset text eol=lf
*.asmdef text eol=lf
*.sh text eol=lf
*.a filter=lfs diff=lfs merge=lfs -text

I then went ahead removed one line from the Unity /workers/unity/.gitignore: remove /build. Traditionally you wouldn’t want to do this, but I’m planning on building via the Windows machine and then running on the Linux machine and this seemed logical but will increase the amount of misc. files that are updated which can be problematic if you’re working with multiple people. In this context for the moment it’s just me! Here is the current Unity project specific *.gitignore:

# Unity generated files
/UIElementsSchema
/[Ll]ibrary/
/[Tt]emp/
/Logs/
/UserSettings/
/ProjectSettings/UnityConnectSettings.asset
/*.csproj
/*.sln

# Build artifacts - commented out!
#/build/

# SpatialOS Generated Files
/Assets/Generated/Source.meta
/Assets/Generated/Source/**/*.*
/Assets/Generated/Editor.meta
/Assets/Generated/Editor/**/*.*

# OLD Plugins folder
/Assets/Plugins/Improbable/
/Assets/Plugins/Improbable.meta

# Jetbrains
/Assets/Plugins/Editor/Jetbrains
/Assets/Plugins/Editor/Jetbrains.meta

/Packages/packages-lock.json

From here I am able to successfully build on the Windows PC and see the updates across version control on the linux machine – when I run both builds across Improbable SpatialOS CLI I get the same error:

error: schema path does not exist.

This is expected because when you first load up the blank project template this is literally the true definition of blank aka missing the schema reference. Following their documentation I whipped up a schema reference in Unity’s editor and rebuilt all workers.

Tried the CLI command again:

spatial local launch --runtime_version 14.5.4

error: No Input files well it might help to have a schema file? Going to just generate a folder under the schema folder called root/schema/wkbasic and drop in a random schema file I found from the FPS project and modify a few things to match my folder structure.

package wkbasic;

type Vector3Int {
    int32 x = 1;
    int32 y = 2;
    int32 z = 3;
}

I saved and pushed my changes up to see if I can CLI this on the Linux machine.
While attempting to do this I was ssh’ing into this machine from the Windows machine and had some time-out problems with Improbable trying to login via the Linux machine, looks like I failed to have some SpatialOS/Improbable user login settings on the Linux machine so I had to go direct to my machine and pull up a terminal there.

Windows Powershell SSH into my Linux Machine response after trying to launch locally.

I ended up with the same error on both Linux and my Windows machine after improbable successfully authenticated services.

Windows Powershell SpatialOS CLI error response after launching locally on Windows machine

Further reading suggests that my original problem might have nothing to do with the schema properties but instead looks like I am trying to start spatialOS without the correct CLI information. At this moment in time I believe I am missing CLI commands to specify Unity launch directions. If I use Unity’s Editor and start a local deployment via Unity I get no issues and everything runs as it should. I do believe at this moment in time I am missing some various commands that tells SpatialOS this is a local ‘Unity GDK deployment’. I am going to pause here and talk with our Improbable contacts to confirm. Will post an update as I get more information from them. Just to clarify: my settings above work if I launch from the Unity Editor, the project works fine – again confirming that I am a noob on the CLI commands!