Book Image

Unity AI Game Programming - Second Edition

By : Raymundo Barrera, Aung Sithu Kyaw, Clifford Peters, Thet Naing Swe
Book Image

Unity AI Game Programming - Second Edition

By: Raymundo Barrera, Aung Sithu Kyaw, Clifford Peters, Thet Naing Swe

Overview of this book

<p>Unity 5 provides game and app developers with a variety of tools to implement artificial intelligence. Leveraging these tools via Unity’s API or built-in features allows limitless possibilities when it comes to creating your game’s worlds and characters. Whether you are developing traditional, serious, educational, or any other kind of game, understanding how to apply artificial intelligence can take the fun-factor to the next level!</p> <p>This book helps you break down artificial intelligence into simple concepts to give the reader a fundamental understanding of the topic to build upon. Using a variety of examples, the book then takes those concepts and walks you through actual implementations designed to highlight key concepts, and features related to game AI in Unity 5. Along the way, several tips and tricks are included to make the development of your own AI easier and more efficient.</p> <p>Starting from covering the basic essential concepts to form a base for the later chapters in the book, you will learn to distinguish the state machine pattern along with implementing your own. This will be followed by learning how to implement a basic sensory system for your AI agent and coupling it with a finite state machine (FSM). Next you will be taught how to use Unity’s built-in NavMesh feature and implement your own A* pathfinding system. Then you will learn how to implement simple flocks and crowd’s dynamics, the key AI concepts. Then moving on you will learn how a behavior tree works and its implementation. Next you will learn adding layer of realism by combining fuzzy logic concepts with state machines. Lastly, you learn applying all the concepts in the book by combining them in a simple tank game.</p>
Table of Contents (15 chapters)
Unity AI Game Programming Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Leveling up your game with AI


AI in games dates back all the way to the earliest games, even as far back as Namco's arcade hit Pac-Man. The AI was rudimentary at best, but even in Pac-Man, each of the enemies, Blinky, Pinky, Inky, and Clyde had unique behaviors that challenged the player in different ways. Learning those behaviors and reacting to them added a huge amount of depth to the game that keeps players coming back, even after over 30 years since its release.

It's the job of a good game designer to make the game challenging enough to be engaging, but not so difficult that a player can never win. To this end, AI is a fantastic tool that can help abstract the patterns that entities in games follow to make them seem more organic, alive, and real. Much like an animator through each frame or an artist through his brush, a designer or programmer can breathe life into their creations by a clever use of the AI techniques covered in this book.

The role of AI in games is to make it fun by providing challenging entities to compete with and interesting non-player characters (NPCs) that behave realistically inside the game world. The objective here is not to replicate the whole thought process of humans or animals, but merely to sell the illusion of life and make NPCs seem intelligent by reacting to the changing situations inside the game world in a way that makes sense to the player.

Technology allows us to design and create intricate patterns and behaviors, but we're not yet at the point where AI in games even begins to resemble true human behavior. While smaller, more powerful chips, buckets of memory, and even distributed computing have given programmers a much higher computational ceiling to dedicate to AI, at the end of the day, resources are still shared between other operations such as graphic rendering, physics simulation, audio processing, animation, and others, all in real time. All these systems have to play nice with each other to achieve a steady frame rate throughout the game. Like all the other disciplines in game development, optimizing AI calculations remains a huge challenge for the AI developers.