Unity 2018 Artificial Intelligence Cookbook
Second Edition
Over 90 recipes to build and customize AI entities for your games with Unity
Jorge Palacios
BIRMINGHAM - MUMBAI
Unity 2018 Artificial Intelligence CookbookSecond Edition
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Kunal Chaudhari
Acquisition Editor: Akshay Ghadi
Content Development Editor: Flavian Vaz
Technical Editor: Sachin Sunilkumar
Copy Editor: Safis Editing
Project Coordinator: Devanshi Doshi
Proofreader: Safis Editing
Indexer: Priyanka Dhadke
Graphics: Jason Monteiro
Production Coordinator: Shraddha Falebhai
First published: March 2016
Second edition: August 2018
Production reference: 1240818
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78862-617-0
www.packtpub.com
To my parents, Betty and Elieser.
They have given me all their support for several years,
and believed in me every step of the way.
Words cannot express how grateful I am for having them in my life.
This work is proof that dreams can be achieved when you turn them into goals.
Thanks to my partner in bits and codes, Christian Chomiak.
His support and feedback is always appreciated on every adventure,
and every algorithm. Let's co-author the next book!
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton
I'll be forever grateful to Ricardo Monascal and Carlos Prez.
Their support, friendship, and guidance allowed me to become
the developer that I am today. I have seen further because of you.
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Jorge Palacios is a software and game developer with a BS in computer science and eight years of professional experience. He's been developing games for the last five years in different roles, from tool developer to lead programmer. Mainly focused on artificial intelligence and gameplay programming, he is currently working with Unity and HTML5. He's also a game-programming instructor, speaker, and game-jam organizer.
About the reviewer
Dr. Davide Aversa holds a PhD in artificial intelligence and an MSc in artificial intelligence and robotics from the University of Rome, "La Sapienza," in Italy. He has a strong interest in artificial intelligence for the development of interactive virtual agents and Procedural Content Generation (PCG). He serves as a peer reviewer in video game-related conferences, such as the IEEE conference on Computational Intelligence and Games (CIG) and he also regularly participates in game-jam contests.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
When we think about artificial intelligence (AI), a lot of topics may come to mind, from simple behaviors such as following or escaping from the player, through the classic chess-rival AI, to state-of-the-art techniques in machine learning or procedural content generation.
Talking about Unity means talking about game development democratization. Thanks to its ease of use, fast-paced technological improvements, ever-growing community of developers, and new cloud services, Unity has become one of the most important pieces of game industry software.
With all that in mind, the main goal of writing this book is to offer you, the reader, both technical insight into Unity, following best practices and conventions, and theoretical knowledge that helps you grasp AI concepts and techniques, so you can get the best of both worlds for your own personal and professional development.
This cookbook will introduce you to the tools you need to build great AI, either for creating better enemies, polishing that final boss, or even building your own customized AI engine. It aims to be your one-stop reference for developing AI techniques in Unity.
Welcome to an exciting journey that combines a variety of things that means a lot to me as a professional and human being; programming, game development, AI, and sharing knowledge with other developers. I cannot stress how humbled and happy I am to be read by you right now, and grateful to the team at Packt for this formidable opportunity. I hope this material helps you not only take your Unity and AI skills to new levels, but also deliver that feature that will engage players with your game.
Next page