Welcome, reader, to the beginning of our journey in Artificial Intelligence, or AI for short. Have you ever wondered about how those hard-working peons in Warcraft explore complicated maps? Or, how those perky ghosts in Pac-Man can get you wherever you are? Or perhaps how your opponents in Final Fantasy optimize their attacks to slaughter your team?
A screenshot from Final Fantasy XV [Square Enix, 2016] during a battle.
In this chapter, we will explore the prerequisites to becoming an AI game developer and how AI is used in the game development pipeline. Then, we will take a look at the history of AI in general and in video games, and learn how the conjunctive effort of many brilliant minds built AI as we know it today. Afterwards, we will discuss the AI Framework underneath the Unreal Engine, since this book will focus on Unreal.
Finally, we will plan our journey and get a general overview of the topics that the different chapters in this book deal with.
... I'd like to reply to some questions that some of you might already have.
Does this book take into account Blueprint or C++?
This book will explain both, so don't worry.
If you don't know C++, you can follow along with the Blueprint part of this book, and if you so wish, you can try the C++ one.
If, on the other hand, you are a programmer that prefers C++, then don't worry! This book will explain how to deal with AI in Unreal using C++.
There are so many books around about AI, why should I choose this one?
Different books explain different aspects of AI, and often they are not mutually exclusive, but rather they complement each other.
However, the major point of interest of this book is that it is a good compromise between the theory of the different AI systems that are present in Unreal and practical applications, since the whole book is full of concrete examples.
Does this book provide a test project/materials to work on?
Absolutely, yes. You will be able to download the content for this book from the following link: http://hog.red/AIBook2019ProjectFiles (the link is case-sensitive).
I am already using the Unreal Engine for Artificial Intelligence, is this book good for me?
This all depends on your level of knowledge. In fact, in the first part of this book, we will talk mainly about the AI framework that's built into the Unreal Engine and how to use it. This is probably the part you are more familiar with if you have had some experience with Unreal for AI. However, this book will dive deep in these topics, that even an expert could find some useful tips. The second part, instead, will discuss some debugging methods for Game AI and will also explain how to extend them (mainly with C++). Feel free to have a look at the outline, and decide if this book suits you.
I am already using another game engine, is this book still good for me?
Well, as much as I'd like to say that this is a general book about AI, it isn't—at least not completely. Although the main focus will still be toward the main concepts of AI, we will look at implementing them in Unreal. However, this book will heavily rely on the built-in AI framework in Unreal. Thus, I encourage you to read more generalized books about AI to get a better understanding. On the other hand, you can always try. Maybe, by understanding some concepts here, other books will be easier to read and you will be able to transfer this knowledge into the game engine of your choice.
I'm a student/teacher, is this book suitable for teaching in class?
Absolutely, yes. I know how important it is to find good resources when teaching a class, and I'm writing this book with this intention in mind. As a result, regardless of whether you are a student or a teacher, you will find a section at the end of each chapter with some exercises that you can improve your skills this (or propose them to your students, if you are a teacher). Also, you can find some more integrative material here: http://hog.red/AIBook2019LearningMaterial (the link is case-sensitive).
Is this book going to cover everything, everything, and everything about AI in Unreal and all its systems?
Well, despite my best efforts to describe each of the systems in great detail, covering everything is an impossible task, due also to the complexity of such big engine. However, I'm confident to say that this book covers most of the aspects related to each AI system within the Unreal Engine, including how to extend the built-in systems and how to efficiently perform debugging. Thus, I can certainly say that this book is very comprehensive.
Since this book is targeted at people who are getting started with AI in game development, I will not assume any prior/background knowledge in AI. However, please take the following into account:
- Blueprint users: You should be familiar with Blueprint programming, and know how a Blueprint graph works in general.
- C++ users: You should be familiar with programming, especially with the C family languages (such as C, C#, C++, or even Java), and in particular with C++, since it's the language that Unreal Engine uses. Being familiar with the Unreal Engine C++ API is a great bonus, although not strictly required. So, even if you are not a master, don't worry—follow along and you will learn.
Also, it would be great if you had some knowledge about vector math and physical kinematic principles – at least the ones commonly used in video games. Either way, in case you are rusty on those, don't worry too much, since it is not required for this book; however, it is nice to have if you're looking for a job as an AI Developer.
Before you continue reading, let's install the software we need. In particular, we will need Unreal Engine and Visual Studio.
Let's talk about Unreal Engine. After all, this is a book about how to develop game AI within this wonderful game engine.
Unreal Engine is a game engine that was developed by Epic Games. It was first released in 1998, and nowadays it is one of the most used (open) game engines (alongside Unity) due to its powerful features. The following screenshot shows the main interface of Unreal Engine:
Screenshot of the main interface of Unreal Engine
We need to have the latest version of Unreal Engine installed. You can find it by visiting https://www.unrealengine.com/en-US/what-is-unreal-engine-4 . Unless you took Unreal Engine from the source c...