AI

Artificial intelligence, like physics and animation, is also its own field of study. We can use PCG to enhance certain aspects of AI. In Chapter 7, Adaptive Difficulty, we used PCG to rewrite a section of our AI. This isn't always the most practical approach though.

AI for games can be easily visualized as a state machine or a graph of connected behaviors. Some actions in the AI graph might lead to others or some situations might cause an AI to enact a certain behavior. In the following diagram, we see rectangles represented as states and arrows representing states transitioning into other states. This network of states can be as complex or simple as we like.

AI state machine

An example of a complex AI state machine is Bethesda's Radiant AI. This ...

Get Procedural Content Generation for Unity Game Development 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.