Enemy AI

Enemy AI

The first time I heard of a game designer working on enemy AI, I thought, pfft, how hard could it be? Throw some enemies in, make them go places, and have them shoot things. However, in reality, the process is turning out to be much more complex than I’d originally anticipated.

It turns out that enemies are pretty dumb. Essentially, they’re pieces of furniture in a game that can move around and do stuff. Only, they don’t inherently know how to do anything. Without a brain, they need every action, every behavior, every simulated choice to be explicitly programmed into them.

Want an enemy to move around? Well, where should they start? Where exactly should they go? How fast should they move? What if they run into something or someone along the way? Should they continue running in the same loop, or should some action cause them to change their movement? The more questions that are asked and answered about an enemy, the more seemingly sophisticated he’ll be.

Here are some of the enemy AI components I’ve been fiddling around with in my latest level:


This involves placing specific path nodes to tell each enemy exactly where to go, when to go there, how quickly to get there, in what order to move to the path nodes, and how long to continue in this pattern. Basically, path nodes serve as enemy bait, meaning each enemy needs several path nodes to keep them busy and make them appear like they have half a brain.

Firing patterns

Each enemy needs a weapon and specific directions on how to use it. And since they’re bots, they have perfect aim all the time, so if I tell an enemy to shoot at the player, he will hit the player spot on with every bullet. Thus, each enemy has to appear to have somewhat poor aim, at least some of the time. Otherwise, the player doesn’t stand a chance.

Behavior changes

In real life, if you fire a gun in the street, people will react. Similarly, enemies in a game should also react to gunfire and the actions of the player and other enemies. If the enemy takes a certain amount of damage, shouldn’t he be “smart” enough to take cover? If the player approaches an enemy, shouldn’t he know to run away? Simple enough to think about, not so simple to implement effectively.

After hours and hours spent programming and balancing the behaviors and stats of my enemies, I now fully appreciate the complexities of enemy AI. I’m trying to give an inanimate object enough sensibilities and skills to make it seem human, and that is no simple task.