Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Unity Artificial Intelligence Programming - Fifth Edition

You're reading from  Unity Artificial Intelligence Programming - Fifth Edition

Product type Book
Published in Mar 2022
Publisher Packt
ISBN-13 9781803238531
Pages 308 pages
Edition 5th Edition
Languages
Author (1):
Dr. Davide Aversa Dr. Davide Aversa
Profile icon Dr. Davide Aversa

Table of Contents (17) Chapters

Preface Part 1:Basic AI
Chapter 1: Introduction to AI Chapter 2: Finite State Machines Chapter 3: Randomness and Probability Chapter 4: Implementing Sensors Part 2:Movement and Navigation
Chapter 5: Flocking Chapter 6: Path Following and Steering Behaviors Chapter 7: A* Pathfinding Chapter 8: Navigation Mesh Part 3:Advanced AI
Chapter 9: Behavior Trees Chapter 10: Procedural Content Generation Chapter 11: Machine Learning in Unity Chapter 12: Putting It All Together Other Books You May Enjoy

Revisiting the A* algorithm

Let's review the A* algorithm before we proceed to implement it in the next section. The foundation of any pathfinding algorithm is a representation of the world. Pathfinding algorithms cannot search over the noisy structure of polygons in the game map; instead, we need to provide them with a simplified version of the world. Using this simplified structure, we can identify the locations that an agent can traverse, as well as the inaccessible ones.

There are many ways of doing this; however, for this example, we use one of the most straightforward solutions: a 2D grid. Therefore, we implement the GridManager class to convert the "real" map into a 2D tile representation. The GridManager class keeps a list of Node objects representing a single tile in the 2D grid. First, of course, we need to implement the Node class too: this class stores node information such as its position, whether it's a traversable node or an obstacle, the cost...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}