What is the AI Controller?

The AIController is responsible for managing the enemies in the level and their behaviours.

ai-controller

In the All Enemies array, you can add or remove enemies, and change their settings:

Enemy Name: This is mostly for debug purposes. You can set a name for the enemy and see information about what it is doing in the log. More on that later. This has no effect in-game.

Movement_Routes: This is where you specify the possible routes the enemy can take through the level. A route is a set of teleport points in a specific order. If you specify more than one route, the enemy will pick randomly from them whenever it returns to its start position. See the next section for more information of configuring routes.

Movement: This controls how the enemy traverses it’s routes. If set to “Teleport in Sequence”, the enemy will try to follow the route from start to finish in order (it may still skip some points on the path, or move backwards depending on how the route is configured). If set to “Teleport Anywhere”, the enemy will randomly pick points on the route, choosing attack positions more frequently based on the difficulty level.

Trigger: This controls when the enemy will attempt to move. If set to “Not Viewed” the enemy will try to teleport after a certain amount of time not being seen. If you view the enemy at any point during this time, the counter will be reset. If set to “Viewed” the enemy will move when you have looked at it for a certain amount of time. It will still try to wait until you look away or change cameras before it moves.

Movement/Viewed/Not Viewed Delay: These are where you specify the times that the enemy will need to wait before moving, depending on its trigger. The Movement Delay is a general timer that guarantees the enemy moves after it has expired. This should usually be set much higher than the other timers, and is to prevent the player from “locking down” the enemies by focusing on them for a long time. If the Movement Delay timer expires and the player is still looking at the enemy, a “power surge” effect will trigger that temporarily blanks out the cameras long enough for the enemy to move without being seen.

Attack Animator: This should point to an Animator component that controls the attack animations for this enemy.

Sound Effects: This is where you set the sounds that should be played when the enemy teleports nearby (within 5 teleport points of the end of their route), when the enemy is seen in the doorway of the office, and when the enemy attacks.

Verbose Logging: Check this box if you need to debug the behavior of this enemy. While the game is running in the editor, you will see in the console various messages every time the enemy chooses new teleport points, begins its attack process, or changes its timers. Use this information to more easily determine what the character is doing and when.


We’ve broken down the individual pages in the AI Controller settings category for each part.
Browse this link for more game AI settings from the AI Controller documentation.