One of the most important things in action games are the characters you are fighting against… the enemies!
The enemies are one of the pillars in these kind of games. Without an interesting enemy to defeat, the gameplay experience would be as boring as without good mechanics.
Even so, a game without polished mechanics can be great with good enemies and a nice level design. One of the most populars examples on this topic is the enemies in F.E.A.R

F.E.A.R. is a game from 2005, if someone plays it with the today’s standards they can notice the controls are “weird” and the shooting feeling does not feel precise. But even with those conditions, the encounters feel immersive and, as consequence, entertaining. This happens because of two reasons:
- AI Design
- Level Design
AI Design
The enemy AI in F.E.A.R. looks very intelligent, but actually, it was implemented by using a very simple node graph.

There were three different states:
- Goto: Determines the place the actor will be positioned in.
- UseSmartObject: Determines the action the actor will do. This can be, for example, to use their equipped gun, close a door, etc.
- Animate: Executes the animation required to pursue the action. Once the animation is over, the character selects one of the two nodes described before.
Which action is selected depends on some variables like the player distance or the current health, no much more.
So, why does this AI works that well? Now is when the following point becomes important.
Level Design
The levels are designed around the encounters (Encounter Design) and all the possible situations were studied and prepared to make the enemies look intelligent.
The way the AI feels is, actually, more dependent on the design than on the intelligence of the character.

AI in Combat Design & Tools
Obviously so simple AIs are not applicable on every game. In other games it’s important to define a more complex behavior for the character, but both, designers and programmers, have the tools to manage it.
Behavior trees are the most common tool to implement AIs in games. Indeed, Unreal Engine has its own behavior tree graph view which is very useful to create AIs in a visual way.

It is so powerful that I even programmed my own behavior tree system for Unity to simplify the development of my projects.
Behavior trees are a very powerful tool and it’s commonly used in the industry, so it’s ideal to know how do they work.
Behavior Trees
A behavior tree is, in the base, a looped event graph divided in actions and conditions. In this kind of graph, we have 5 kind of nodes (there can be more, such as services, etc. but I will be focused in the most important ones).
- Root
- Task
- Sequence
- Selector
- Decorator
Root is the most basic node. It basically indicates the beginning of the tree.
A task is an action the character will do. Attack, Take Cover, Advance, Aim, Jump, etc. All these actions would be individual tasks the character can do.

A sequence is a concatenation of nodes. Followed by the sequence, there will be located downside a group of nodes following a horizontal order. The one on the left will be the first node executed, the one on the right the last one.

A selector is a node that indicates a condition. Downside the selector, there will be a group of nodes where just one of these will be executed depeding on the condition result.
To indicate with node has a specific condition, we use decorators. Two different decorators can be something like “Current Distance from Target > 5m” and “Current Distance from target <= 5m”. If the character is closer to the target than 5m, then the tree will continue through the corresponding nodes in the tree.

Once the tree path is completed, it is automatically restarted, starting again from the root node.
These tools were developed to make the developers life easier. What I have explained in this post is the basis, but I encourage you to do more research to become an expert and design more interesting AIs for your games!
Have a nice day! 🤗