Chapter 9. Gameplay

Gameplay comes in many different guises, and can mean many different things. This chapter provides recipes and solutions to some of the features that, as game developers, we find ourselves having to build over and over again. These are the basic building blocks of many games.


This chapter is far from containing all the gameplay solutions you’ll need! Articles posted by game developers on Gamasutra are a great resource for more of this sort of thing. In your game development career, you’ll find yourself implementing many of the recipes in this chapter time and time again, game after game.

9.1 Managing Quests


You want to manage a quest structure, where the player needs to complete certain objectives to finish a quest.

As part of your quest structure, you want some objectives to be optional, and some objectives to not be presented to the player until they’re achieved. If an objective is failed and it isn’t optional, then the entire quest is failed.


Before we can manage a quest structure, we need a quest.

First, let’s define a simple quest: we’ll position the camera in front of some colored blocks, and say that the player has to click them to complete the quest. However, one of the blocks is forbidden, and clicking it will fail the quest (Figure 9-1).

ugdc 0901
Figure 9-1. With one of the blocks forbidden, clicking it will fail the quest

First, ...

Get Unity Game Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.