Free Sample
+ Collection

Unity 4.x Game AI Programming

Aung Sithu Kyaw, Clifford Peters, Thet Naing Swe

Use your basic knowledge of Unity3D to add effective artificial intelligence to your games. This tutorial will take you through all the essentials, from flocking to pathfinding, from navigation graphs to behavior trees.
RRP $26.99
RRP $44.99
Print + eBook

Want this title & more?

$21.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849693400
Paperback232 pages

About This Book

  • A practical guide with step-by-step instructions and example projects to learn Unity3D scripting
  • Learn pathfinding using A* algorithms as well as Unity3D pro features and navigation graphs
  • Implement finite state machines (FSMs), path following, and steering algorithms

Who This Book Is For

Are you are a programmer with basic knowledge of Unity3D who would like to add AI features to your game? Are you looking for a reference on implementing AI in Unity3D with simple to follow instructions, and lots of sample code and projects? Then this book is for you. You should have some background in C# language as this book will use C# for scripting. However if you know any other language you should be able to follow this book fairly easily.

Table of Contents

Chapter 1: Introduction to AI
Artificial Intelligence (AI)
AI in games
AI techniques
Chapter 2: Finite State Machines
The player's tank
The bullet class
Setting up waypoints
The abstract FSM class
The enemy tank AI
Using an FSM framework
Chapter 3: Random and Probability
Definition of probability
Character personalities
FSM with probability
Dynamic AI
Demo slot machine
Chapter 4: Implementing Sensors
Basic sensory systems
Scene setup
Player tank and aspect
AI character
Chapter 5: Flocking
Flocking from Unity's Island Demo
Alternative implementation
Chapter 6: Path Following and Steering Behaviors
Following a path
Avoiding obstacles
Chapter 7: A* Pathfinding
A* algorithm revisit
Scene setup
Chapter 8: Navigation Mesh
Setting up the map
Scene with slope
Off Mesh Links
Chapter 9: Behavior Trees
Behave plugin
Interfacing with the script
Behave debugger
Exploring Behave results
Priority selector
The Robots versus Aliens project
Chapter 10: Putting It All Together
Scene setup

What You Will Learn

  • Building finite state machines (FSMs)
  • Implementing a sensory system
  • Applying flocking behavior for a crowd
  • Executing your own A* pathfinding algorithm in Unity3D
  • Applying random and probability techniques in a betting game
  • Using the Unity3D pro feature, navigation graphs, for path finding
  • Learning about behavior trees and the Behave plugin
  • Implementing a racing game AI through the final chapter project

In Detail

This book fills the gap between artificial intelligence (AI) books designed to learn underlying AI algorithms and general Unity3D books written to cover basic scene setup and scripting in Unity3D. Game AI Scripting in Unity3D covers implementing AI techniques such as flocking, pathfinding, path following, and behavior trees in Unity3D with example projects.

Game AI Scripting in Unity3D will show you how to apply AI techniques to your Unity3D projects using C# as the scripting language. Unlike other AI books and Unity3D books, this book tries to focus more on the application of AI techniques in the Unity3D engine, with sample projects that demonstrate finite state machines (FSMs), pathfinding, steering, navigation graphs, and behavior trees techniques.

This book shows how to implement various AI techniques in Unity3D by implementing the algorithm from scratch using C#, applying Unity3D built-in features, or using available scripts and plugins from the Unity Asset Store. For example, we’ll be implementing our own A* algorithm to do pathfinding but will also explore the Unity3D navigation graphs feature. Then we’ll use the Behave plugin to construct behavior trees for intelligent AI character behaviors.

Game AI Scripting in Unity3d  covers other AI techniques such as flocking behavior, building a sensory system for taking inputs from the environment and other AI agents, and so on. In the final chapter this book will show you how to build a racing game AI project using Unity3D and applying the techniques described in earlier chapters.


Read More

Recommended for You

Learning Unity 2D Game Development by Example
$ 26.99
Unity 4.x Game Development by Example: Beginner's Guide
$ 26.99
Mastering Unity 4 Scripting [Video]
$ 34.00
Getting Started with Unity 4 Scripting [Video]
$ 34.00