Chapter 9. What Have We Learned?

In this chapter, we will briefly glance at some of the chapters. This chapter is important because we will discover the caveats of what we've done. Lastly, we will talk about other examples of what we could achieve with these combined lessons.

In each chapter, the goal was to start with an objective. Then, we approached the objective with a practical demonstration of the knowledge. We talked about what AI means to game AI. We then demonstrated the basics of creating game AI within Unreal Engine 4. What we didn't cover are the issues we may run into. What were the weaknesses and benefits of the techniques we demonstrated? In this chapter, we will answer these questions.

Creating basic AI

There are other forms of AI available. In this book, we created the basic AI. In the hierarchy of the components, there is a controller. The controller then decides which Behavior Tree to run. Then, tasks are chosen based on the sequence of decisions in the tree.

In the controller, we could have an array of different Behavior Trees suited for different tasks. Then, once we approach the task, the tree contains the subtask which aids in coming to a solution. Introducing this level of abstraction requires understanding of which state is necessary to enter.

We demonstrated how to create an AI basic enough to run indefinitely. Using math, we were able to help the AI avoid contacting walls. Presumably, this is all you need for some scenarios. If you need your units to all run independently of each other and avoid the walls as necessary, this script will be perfect for you. However, if you need more control over your units, you can't achieve it with this technique alone.

The alternative is using a control widget, such as a Spline, to control exactly where the AI is going. If you grab the direction to the position on the spline, the AI can be told to move there instead of toward the hero, as we demonstrated in Chapter 2, Creating Basic AI.

Here are the pros and cons of using controls to designate where the AI should go.

The pros and cons of using controls

The following is a pro:

  • Moving the AI to the exact location

The following are the cons:

  • You must create paths by hand
  • The paths are limited to control

You can quickly spot the advantages of either use. In a controlled situation, you would use waypoints. These would direct the AI exactly where to move in 3D space. This is perfect to route the AI places in the level you want it to be. So, if it was a Secret Security unit in the game, it would patrol the areas you designate. Then, you can eliminate the player on contact.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset