In today's entry into the Learning Unreal series, I learned how to set up some basic artificial intelligence systems using the AI tools within Unreal. As always, if you want to follow along with the same tutorial that I'm using, you can find it here.
There are a handful of AI systems within Unreal that are needed to get an automated system like the battle above to work.
First, an AI Controller needs to be created and attached to the Muffin Blueprint. The Controller is necessary so that an AI system can possess the Muffin when it's created.
Second, you need a Behavior Tree that contains the actual logic of the AI. There are four major components within a Behavior Tree in Unreal:
Tasks - Makes the AI Controller do something
Composites - Control the flow of logic
Services - Check and update data
Decorators - Perform logic checks and abort executing sub-trees
The Muffin's Behavior Tree utilizes all of the above to create its two main sub-trees: One for when the Muffin randomly roams around, and another for when it sees and attacks another Muffin.
Third, a Blackboard is necessary solely to hold variables that act as the AI's memory. The Blackboard is what Services and Decorators check against when performing their checks. The Muffin's Blackboard contains keys for its current target location and for the enemy Muffin it's currently attacking, if applicable.
Finally, you need to add AI Perception to the Actor so that it's able to actually sense the world around it. The Muffin only has its sense of sight enabled, allowing it to see anything within a 90 degree vision cone in front of it.
I am now one step closer to creating the Terminator.
Comments