Tommy Tran has recently published a guide to dealing with AI in Unreal.
In UE4 you generate AI by managing behavior trees — a system used to determine the behavior of a character. The thing is that you can set up all kinds of scenarios with the help of this system.
The new guide will show you how to:
Here is a small piece of the tutorial:
In this tutorial, you will create an AI that will wander around. When an enemy muffin comes into the AI’s range of vision, the AI will move to the enemy and attack it.
To create an AI character, you need three things:
Since you already have the body, all you need is a soul and brain. First, you will create a controller which will be the soul.
A controller is a non-physical actor that can possess a Pawn. Possession allows the controller to—you guessed it—control the Pawn. But what does ‘control’ mean in this context?
For a player, this means pressing a button and having the Pawn do something. The controller receives inputs from the player and then it can send the inputs to the Pawn. The controller could also handle the inputs instead and then tell the Pawn to perform an action.
In the case of AI, the Pawn can receive information from the controller or brain (depending on how you program it).
To control the muffins using AI, you need to create a special type of controller known as an AI controller.
You can find the full guide here.