Chapter 8: Creating Artificial Intelligence

In this chapter, we'll start looking at specific gameplay elements rather than game genres. This project, unlike the previous three, will not be a game with a clear win and lose condition but will be a functional prototype that highlights a range of important coding techniques and ideas prevalent in the game development.

In the complete project, we'll have a Non-Player Character (NPC) that will patrol the level searching for the player using Unity's pathfinding tools, and when it finds the player, it will chase the player down until it is within range and mercilessly attack the player. Its behavior will be controlled using a Finite State Machine (FSM).

In this chapter, we'll cover the following:

Get Unity 2020 By Example - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.