Wander Behavior with Apex Path and Apex Utility AI

Introduction

This document is a part of a series of tutorial documents for getting started with the Apex Utility AI using Apex Path.

The purpose of this document is to provide a description to the classes used in the scene “AI_Demo_8”, as well as a tutorial on how to create a Apex Utility AI has a wander behaviour.

Creating a Wander Action

We start by making a Wander Action class. We use the Apex Utility AI IRequireTermination interface. This forces us to implement the Terminate method, which will be called once the AI changes the action being executed. This method is useful for causing the Unit to stop wandering, instead of having one Action for starting and another one for stopping. To make it easier to see whether the Unit is supposed to wander or not, we change its color as well: Green for when it is supposed to wander and red when it is not. The action class with both of its relevant methods can be seen in the code snippet below.

The screenshot below shows the unit wandering with Apex Path visualization on.