Health packs - FPS tutorial

Before starting this tutorial, make sure you have followed the Get started guide which sets up the FPS Starter Project. This tutorial follows on from that guide.

What does the tutorial cover?

You will add health pack pick-ups to the game. These health pack pick-ups are subject to the following design constraints:

  1. The pick-ups have static positions in the game world and are present in the world at start-up time.
  2. A pick-up grants health to a single player which walks over them.
  3. After the health pack is consumed, it is no longer visible to clients and no longer grants health.
  4. After a period of time, the health pack is "respawned" and is available to be picked up again.
  5. Critical interactions like: collision detection between the player and the health pack and granting the health is done on the game logic worker. That is to say, we do not trust the client.
  6. (Optional) Players which have full health cannot pick up the health packs.

To implement this feature you will:

  • Add a new SpatialOS component to hold the state of the health packs.
  • Define a new SpatialOS entity template called HealthPickup.
  • Add HealthPickup entities to the snapshot so they are loaded in the SpatialOS world at startup.
  • Write game logic such that the health packs grant health to players.
  • Write game logic to "respawn" health packs after they have been consumed.

Open the FPS Starter Project in your Unity Editor

  1. Launch your Unity Editor.
  2. It should automatically detect the project but if it doesn't, select Open and then select gdk-for-unity-fps-starter-project/workers/unity.

Updated 11 months ago



Health packs - FPS tutorial


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.