Post news RSS Stage 3: Azaria - Development diary 7: Quick look at the enemies Artificial Intelligence

Let's have a big overview of the current artificial intelligence created for Stage 3: Azaria's enemies!

Posted by on

Hey everyone!

This week we'll be sharing some behind the scenes' info related to the artificial intelligence used in Stage 3: Azaria. It can be somewhat technical but I'll try my best to explain in general terms so it can be understood by someone that doesn't have a programming background. Let's keep in mind that it's a work in progress and that a lot of things are going to change. Without further delay, lets begin.

Heroic Keeper

First, we have one type of warriors who joined Eolica's army to fight together. In Stage 3, these warriors are called Heroic Keepers and are trained by the Heiron Alliance. These are the kind of unit you will find as a security guard of a castle. That is because they need to work their way out until they get into higher ranks. However, they are characterized for being alert, loyal and young. This is because they are fresh out of training which means they know how to defend themselves but lack experience in battle. These units take pride in their teamwork and have a strong willpower making them take head on all kind of hardships.

While making the AI of the each enemy we have to take in consideration their characteristics so they behave in a believable manner. So taking in account the previous description, we made a troop that when assigned an objective it will push forward in that direction. When it encounters an enemy it will try to surround it with their teammates and when close enough it will attack you and strafe around to avoid getting hit.

All the work done in the AI area uses the Behavior Tree that Unreal provides. A behavior tree is a graph that depending on the state of the enemy, map, units and environment it will choose a branch and make the unit execute the actions wanted.

Our troop behavior tree looks something like this:

Work in progress of the Heroic Keeper's behavior tree

Blue nodes are decorators that decide if the branch proceeds or not. Purple nodes are the tasks that the unit will execute and green nodes are services that executes certain task while the branch is being run. If you want to know more about behavior trees, a good place to start is the Unreal Engine documentation.

It's amazing what you can do with this tool. To be able to watch on real time all the nodes and have a visual representation of all the possible behaviors allow us to focus on what is most important, which is the game, and not get too caught into low level technical details. Let's take a closer look to see how these branches work together.

In general terms, the first branch checks if the troop has a weapon equipped, if they doesn't it will look around for one and if there is no weapon around they will flee. The second branch checks if there is an enemy near, if there is then it will attack depending if it is in melee or ranged mode. In the ranged mode we may want to implement a cool spell the knight can cast or make them throw their weapon at you!

The third branch is to make them attack an objective but there is more work to be done in that regard. Finally, the fourth branch are just fallback actions.

In game it looks like this:

In the video you can see that the troops try to surround you and make their move once the find it appropriate. Also you can have a closer look into the debugging systems tools inside Unreal! These are amazing to check in real time what is going on with your code and save you a lot of time in the debugging process.

Unwavering Keeper

We can also add the Unwavering Keeper, also known as the "tank knight", into the mix. The Unwavering Keeper is a high armored soldier who is experienced, strong but also slow. They also have good reflexes, patience and an almost unbreakable guard. Their weapons of choice are the spear and shield.

Let's have a look at some artificial intelligence created for them:

It is still in progress but we hope we are able to add more interaction between units, like an Unwavering Keeper protecting fellow troops! Also, did you noticed that the model is the same? As programmers, we can use all the assets at your disposal and just with the click of a button we can have new art entirely. The most important thing is to focus on the gameplay first and everything will follow it up. Be it art, music, or animations, everything follows gameplay.


The wisps are magical creatures that inhabit the areas near the Heorogan Castle. They are created by the strong magic aura this place emits. They are usually harmless unless their territory is threatened. These creatures are known for their ability to fly, high mobility and ranged attacks that follow their target. When on low health, wisps magical energy becomes volatile and will follow their target, self destructing and doing high explosive damage!

Let's take a look at the current Wisp's behavior:

As you can see, Wisp's try to attack you using the element they correspond to and when they are about to die they decide to go right after you, real fast, and explode really fast.

Advice and final words

Artificial Intelligence is a wide topic, like everything in game development it's a never ending process and you will always find better ways to work your way around to create new and interesting behaviors. There is so much to talk about this topic, but the main thing we want you to address is that with having the right tools and the documentation at your disposal, you can create really amazing behaviors for your game. The team at Epic gives away everything for free, not only you have the Unreal Engine (which by itself is super awesome), but all the projects like Robo Recall, Unreal Tournament and many more to see how these veteran developers create artificial intelligence for their game. It is a place where you can learn the best and from the best and the same applies to all areas of game development.

That's it for this week, we hope you enjoyed reading the article and learned more about the development of our games! Don't forget you can always leave feedback in the comments below. See you next week!

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.