Get SpatialOS

Sites

Menu
You are viewing the docs for 11.0, an old version of SpatialOS. 12.0 is the newest →

Setting up a C++ worker

Obtaining the SDK

Once you’ve got a project set up (examples at the SpatialOS GitHub repository), obtain the SDK through worker packages, our package management framework.

You can obtain the relevant worker package as follows:

  1. Add the following configuration within <root>/workers/<your_worker>/spatialos_worker_packages.json to download the header files and libraries to link against:

      {
        "targets": [
          {
            "path": "worker_sdk",
            "type": "worker_sdk",
            "packages": [
              {
                "name": "<package>"
              }
            ]
          }
        ]
      }
    

    The supported options for <package> are currently:

    • cpp-static-x86-msvc_md-win32 - Windows 32-bit compiled using MSVC (with /MD runtime).
    • cpp-static-x86_64-msvc_md-win32 - Windows 64-bit compiled using MSVC (with /MD runtime).
    • cpp-static-x86_64-msvc_mdd-win32 - Windows 64-bit compiled using MSVC (with /MDd runtime).
    • cpp-static-x86_64-msvc_mt-win32 - Windows 64-bit compiled using MSVC (with /MT runtime).
    • cpp-static-x86_64-msvc_mtd-win32 - Windows 64-bit compiled using MSVC (with /MTd runtime).
    • cpp-static-x86_64-clang_libcpp-macos - macOS 64-bit compiled using Xcode 8.
    • cpp-static-x86_64-gcc_libstdcpp-linux - Linux 64-bit compiled using GCC 5.4.0 with the libstdc++ standard library.

    Multiple packages can be specified at once as multiple entries in the targets array with different paths if desired. For example, when using Debug and Release configurations on Windows, we can download both the /MD and /MDd builds of the worker SDK, and point the MSVC project to the correct lib directories for each configuration. The spatialos_worker_packages.json will look similar to:

      {
        "targets": [
          {
            "path": "worker_sdk/windows/debug",
            "type": "worker_sdk",
            "packages": [
              {
                "name": "cpp-static-x86_64-msvc_mdd-win32"
              }
            ]
          },
          {
            "path": "worker_sdk/windows/release",
            "type": "worker_sdk",
            "packages": [
              {
                "name": "cpp-static-x86_64-msvc_md-win32"
              }
            ]
          }
        ]
      }
    
  2. In a terminal, cd to the directory containing your spatialos_worker_packages.json and run spatial worker package unpack.

    This will unpack the worker SDK (type) for the specified language and platform into the specified sub-directory (path). The downloaded worker package will be compatible with the SpatialOS SDK version used for your application (specified in <root>/spatialos.json under sdk_version).

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums