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:
- Importing assets from the Unity Asset Store (UAS)
- Creating the world that the player and NPC will cohabitate
- Generating a navigation mesh using NavMesh
- Animating the NPC using Unity's Mecanim system...