Using the CLI in China
This page covers building using the SpatialOS CLI.
To use the CLI in China, you need to add
--environment=cn-production to all commands, or run a one-off command to set the environment for your computer (see Using the CLI in China).
Only follow the in-China instructions if you are located in China and deploying your game to server nodes hosted in China. You can only deploy to server nodes hosted in China if you're located in China. For more information, contact your account manager or get in touch.
You don't need to build the whole of a SpatialOS project at the same time. What you build depends
on what changes you've made to it:
Don't forget to keep your schema backwards-compatible.
- Generate code from the schema:
- Fix any code references that are broken by the schema changes.
spatial worker build <worker type>for any relevant workers.
You can then use your IDE to modify your code that uses the generated code.
If you change the schema, you'll need to migrate your initial snapshot to the new schema, or generate a new one.
When you've made a change to the code of your worker, run
spatial worker build <worker type>. This runs the 'build' task for the worker, which normally puts the resulting assets within
build/assembly. See build configuration for details.
You must update your initial snapshot (or generate a new one) if you make any changes that affect what's in the snapshot. This includes (but isn't limited to):
- adding or removing entities in the initial state (by changing the code which adds them)
- changing the number of entities in the initial state (by changing the code which adds them)
- changing the template (used to spawn an entity) of any entity that's in the initial snapshot, including
- adding components to the entity
- removing components from the entity
To clean the whole project, run
spatial worker clean. This also removes the
build directory at the root of your project.
You can use
spatial worker build to build workers offline, so you can iterate on local projects without an internet connection. For more information, see Using the SpatialOS CLI offline for local projects.
Updated about a year ago