C++ worker tutorial
This tutorial branches out of the Pirates tutorial to show you an alternative way of architecting a SpatialOS game.
What you’ll do
You’ll implement the behaviour of pirate ships. They’ll move randomly just like in Lesson 3 of Pirates. You’ll also add a shooting behaviour to pirate ships similar to how player ships shoot in Lesson 4 of Pirates. This will let you compare the Unity SDK and workflow with its C++ counterpart.
At the end, there are suggestions for more complex behaviours you could tackle on your own to reinforce what you’ve learnt.
What you’ll learn
Through adding features to the game you’ll learn:
- how to add a C++ managed worker to an existing SpatialOS project
- how to use the C++ SDK alongside a game running in a game engine
- features of SpatialOS and its C++ SDK
Why is this useful
Sometimes you might want to take parts of the game logic out of the core game process. Some of the reasons for doing this are outlined in Designing workers.
Understanding how to use the C++ SDK through simple examples is the first step on the way to building more complex logic workers. For example, if you want to integrate a game engine with SpatialOS, the concepts covered in this tutorial will lay the foundation.
Before you start
If you haven’t already completed the Unity-only version of the Pirates tutorial, you are strongly encouraged to do so. By doing this, you will find it much easier to follow this tutorial. You will start with the completed Lesson 2 of Pirates and add features to the game.
You will need:
CMake which is used for building the C++ worker in this tutorial.
A C++ compiler of your choice which supports C++11.
Git - this is optional, but you might need to download some files manually if you don’t have it.
Begin the tutorial by starting the first lesson.