How to use the command 'spatial' (with examples)

How to use the command 'spatial' (with examples)

The ‘spatial’ command is a set of commands for managing and developing SpatialOS projects. SpatialOS is a platform that allows developers to build large, persistent, and highly interactive virtual worlds. The ‘spatial’ command provides various functionalities for building, deploying, and managing workers in SpatialOS projects.

Use case 1: Run this when you use a project for the first time

Code:

spatial worker build

Motivation: When starting a new project on SpatialOS, you need to build the workers for the project. This command is used for compiling all the necessary code and dependencies to create the workers.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • worker build: Specifies the ‘worker build’ command to build the workers for the project.

Example output:

Building workers...
Workers built successfully.

Use case 2: Build workers for local deployment on Unity on macOS

Code:

spatial worker build --target=development --target=Osx

Motivation: This use case is helpful when you are developing a SpatialOS project on Unity and want to build the workers specifically for local deployment on macOS.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • worker build: Specifies the ‘worker build’ command to build the workers for the project.
  • --target=development: Specifies the target environment as development.
  • --target=Osx: Specifies the target platform as macOS.

Example output:

Building workers...
Workers successfully built for local deployment on macOS.

Use case 3: Build workers for local deployment on Unreal on Windows

Code:

spatial worker build --target=local --target=Windows

Motivation: This use case is useful when you are working on a SpatialOS project on Unreal engine and want to build the workers specifically for local deployment on Windows.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • worker build: Specifies the ‘worker build’ command to build the workers for the project.
  • --target=local: Specifies the target environment as local.
  • --target=Windows: Specifies the target platform as Windows.

Example output:

Building workers...
Workers successfully built for local deployment on Windows.

Use case 4: Deploy locally

Code:

spatial local launch launch_config --snapshot=snapshot_file

Motivation: This use case allows you to deploy your SpatialOS project locally for testing and debugging purposes.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • local launch: Specifies the ’local launch’ command to deploy the project locally.
  • launch_config: The configuration file for launching the project.
  • --snapshot=snapshot_file: Specifies the snapshot file to be used during the deployment.

Example output:

Deploying locally...
Project successfully deployed locally.

Use case 5: Launch a local worker to connect to your local deployment

Code:

spatial local worker launch worker_type launch_config

Motivation: This use case is useful when you want to launch a specific worker locally to connect to your local deployment for testing and debugging purposes.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • local worker launch: Specifies the ’local worker launch’ command to launch a worker locally.
  • worker_type: Specifies the type of worker to be launched.
  • launch_config: The configuration file for launching the worker.

Example output:

Launching local worker...
Worker successfully launched and connected to the local deployment.

Use case 6: Upload an assembly to use for cloud deployments

Code:

spatial cloud upload assembly_name

Motivation: This use case allows you to upload the assembly of your SpatialOS project to the cloud platform for deployment.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • cloud upload: Specifies the ‘cloud upload’ command to upload the assembly.
  • assembly_name: Specifies the name of the assembly to be uploaded.

Example output:

Uploading assembly...
Assembly successfully uploaded to the cloud platform.

Use case 7: Launch a cloud deployment

Code:

spatial cloud launch assembly_name launch_config deployment_name

Motivation: When you want to launch a cloud deployment of your SpatialOS project, this use case allows you to specify the assembly, launch configuration, and deployment name.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • cloud launch: Specifies the ‘cloud launch’ command to launch a cloud deployment.
  • assembly_name: Specifies the name of the assembly to be used for the deployment.
  • launch_config: The configuration file for launching the project.
  • deployment_name: Specifies the name of the deployment.

Example output:

Launching cloud deployment...
Cloud deployment successfully launched with the specified assembly, configuration, and name.

Use case 8: Clean worker directories

Code:

spatial worker clean

Motivation: This use case allows you to clean the directories of the workers in your SpatialOS project.

Explanation:

  • spatial: The main command to invoke the SpatialOS command-line interface.
  • worker clean: Specifies the ‘worker clean’ command to clean the worker directories.

Example output:

Cleaning worker directories...
Worker directories successfully cleaned.

Conclusion: The ‘spatial’ command provides a variety of functionality for managing and developing SpatialOS projects. By using these different use cases, you can easily build, deploy, and manage your workers locally and in the cloud.

Related Posts

How to use the command nslookup (with examples)

How to use the command nslookup (with examples)

The nslookup command is used to query one or more name servers for various types of domain records.

Read More
How to use the command 'cargo pkgid' (with examples)

How to use the command 'cargo pkgid' (with examples)

The cargo pkgid command is a command provided by the Cargo package manager for Rust.

Read More
How to use the Perl command (with examples)

How to use the Perl command (with examples)

Perl is a programming language that is commonly used for text processing and automation tasks.

Read More