Common Enemy AI Patterns
Why Patterns Matter More Than Raw Intelligence
The best enemy AI in games is not the smartest. It is the most readable. Players need to understand what an enemy is doing and why so they can form strategies, adapt, and feel a sense of mastery when they succeed. Enemy AI patterns provide that readability by giving each enemy type a clear behavioral identity that the player can learn through observation.
A flanker that always circles left is technically less intelligent than one that randomly picks a side, but the consistent flanker teaches the player to watch their left, which creates a learnable challenge. When the player anticipates the flank and counters it, they feel smart. When a random flanker succeeds, the player just feels unlucky. Good enemy AI serves the player's experience of skill progression, not the developer's desire to show off algorithmic sophistication.
This is why enemy AI patterns have remained stable across decades of game development. The specific implementations evolve as engines and techniques improve, but the underlying archetypes persist because they solve the fundamental design problem of creating distinct, readable combat challenges that combine into varied encounters.
The Patroller
The patroller walks a predefined route and responds to stimuli along the way. It is the most common enemy pattern in games, appearing in platformers, stealth games, action RPGs, and shooters. The patrol route itself is the gameplay content, the player observes the pattern, identifies windows of opportunity, and times their actions accordingly.
A well-designed patroller has three behavior layers. The base layer is the patrol route, a sequence of waypoints with optional pauses and look-around animations at each stop. The detection layer monitors for player presence through vision cones, hearing radii, and peripheral awareness triggers. The response layer handles what happens when something is detected, typically a progression from suspicious (investigate the disturbance) to alert (actively search the area) to hostile (engage the player directly).
The best patrollers have readable rhythms. The player watches a patrol cycle, identifies the gap, and times their move. Adding variability to patrol routes through randomized pause durations, occasional route changes, or varying walk speeds keeps the player from memorizing exact timings while still preserving the overall rhythm. The Metal Gear Solid series excels at this balance, its guards follow consistent routes with just enough random variation to prevent rote memorization.
Implementation tip: connect patrollers to a shared awareness system so that one patroller detecting the player can alert nearby patrollers. This creates escalation dynamics where being spotted by one enemy changes the behavior of an entire zone rather than just triggering a single isolated response.
The Flanker
The flanker attempts to approach the player from the side or rear while other enemies engage from the front. This pattern exists to punish players who focus on a single direction and reward players who maintain spatial awareness. Flankers are what transform a linear shooting gallery into a tactical encounter where positioning and coverage matter.
Effective flanking AI requires three capabilities. First, awareness of teammate positions so the flanker moves to an angle that differs from where other enemies are engaging. Second, pathfinding that favors lateral displacement relative to the player rather than the shortest direct path. Third, timing awareness so the flanker engages after reaching a flanking position rather than attacking during the approach when the player might spot and intercept it.
The Halo series is the benchmark for flanking AI. Elite enemies actively evaluate the combat space, identify positions with cover that offer a lateral or rear angle on the player, navigate to those positions using terrain-aware pathfinding, and then engage aggressively. The key insight from Halo's AI design is that flankers should coordinate with frontline enemies. The Grunts keep the player's attention forward while the Elites circle to the sides. Without the frontline pressure, flanking loses most of its impact because the player can simply track the lone flanker.
A common implementation approach uses influence maps. The AI system maintains a grid representing the combat space, with cells weighted by factors like distance from the player, angle relative to the player's facing direction, availability of cover, and distance from allied enemies. The flanker selects the cell with the highest flanking score and navigates there. Updating the influence map every few seconds rather than every frame provides good results while keeping computational cost manageable.
The Rusher
The rusher closes distance aggressively, prioritizing speed and proximity over self-preservation. Rushers create urgency and panic, forcing the player to deal with an immediate close-range threat before they can calmly pick off enemies at range. In any encounter with mixed enemy types, the rushers are what prevent the player from settling into a comfortable routine.
Rusher AI is deceptively simple, usually just a seek behavior aimed at the player with high movement speed and aggressive attack activation at close range. The design complexity lies entirely in the player experience surrounding the rush. A rusher needs clear telegraph signals so the player has a fair chance to react: an audio cue (screaming, charging sound), a visual cue (glowing, winding up an attack), and a brief preparation window before the rush begins. Without telegraphing, rushers feel cheap rather than challenging.
Rusher variants add tactical depth. A standard rusher moves directly at the player. A leaping rusher jumps over cover, neutralizing the player's defensive positioning. An exploding rusher deals area damage on death, punishing players who wait too long to eliminate it. A shielded rusher absorbs frontal damage during its approach, requiring the player to hit it from the side or wait for a vulnerability window after its attack. Each variant changes the counter-strategy the player needs to employ.
Spawn timing is critical for rushers. They should appear when the player is engaged with other threats, forcing a priority decision. Too many rushers at once overwhelms the player unfairly. Too few eliminates the pressure they are meant to create. One or two rushers mixed into a group of ranged enemies is the sweet spot for most action games.
The Turret
The turret occupies a fixed position and attacks anything within its field of fire. Turrets create zone-control challenges where the player must identify and exploit gaps in coverage, time movements between attack volleys, or find angles that allow engagement without exposure. The AI logic for a turret is usually minimal (detect target, aim, fire, reload), but the level design around turrets is what creates the gameplay.
Static turrets are environmental puzzles as much as enemies. The player reads the firing arc, identifies cover positions, and plans a route through the danger zone. Rotating turrets add timing challenges because the safe window changes as the turret sweeps. Tracking turrets that follow the player require different tactics, either suppressing them with return fire or using speed and unpredictable movement to avoid their aim.
Mobile turret enemies (like heavies who plant and fire from a chosen position) combine turret and patroller patterns. They move to a strategic position, deploy, suppress an area, then eventually reposition. The player must recognize the deployment phase, exploit the setup window, or wait for the reposition phase when the enemy is vulnerable.
The Supporter
Supporters buff allies, heal them, provide shields, or debuff the player rather than dealing direct damage. They add tactical depth by forcing prioritization decisions: should the player eliminate the immediate threat or neutralize the supporter that makes every other enemy more dangerous?
The medic is the most common supporter variant. It moves between wounded allies, restores their health, and typically avoids direct combat. Good medic AI stays near clusters of allies but behind cover, emerging only to heal. A medic that can resurrect fallen enemies raises the stakes significantly because the player must eliminate the medic or waste effort re-killing enemies.
Buffer supporters enhance nearby allies with increased damage, speed, armor, or accuracy. The buff should be visually obvious (a glow effect, an aura, changed animations) so the player can see which enemies are buffed and trace the effect back to the supporter. Commander enemies in strategy and action games serve this role, their mere presence makes surrounding troops fight harder.
Debuffer supporters target the player directly with effects like slowing, vision obscuration, weapon jamming, or healing reduction. These create vulnerability windows that other enemies exploit. The combination of a debuffer and a rusher is particularly effective because the slow effect makes the rush much harder to counter.
Supporters should be designed as priority targets. Give them distinct visual silhouettes, make their effects visible and annoying, and position them where eliminating them requires the player to push past other enemies. The player should always feel rewarded for identifying and eliminating a supporter.
The Ambusher
The ambusher waits hidden until the player enters a trigger zone, then attacks from an unexpected position. Ambushers create tension and surprise, punishing players who move carelessly through environments without checking corners, ceilings, or blind spots. After encountering an ambush, players move more cautiously through subsequent areas, which changes the pacing and mood of the experience.
Effective ambush AI needs a hiding system that places the enemy in concealed positions with good attack angles on predicted player paths. The trigger should account for the player's facing direction so the ambush fires when the player is not looking at the hiding spot. The initial attack should be devastating enough to feel threatening but telegraphed enough (a brief sound cue or movement animation) to give alert players a chance to react.
After the initial ambush, the enemy typically transitions to another pattern. A melee ambusher might become a rusher. A ranged ambusher might become a flanker, using its elevated or concealed position as a sniper nest. The ambush is the opener, not the entire behavior set.
Combining Patterns in Encounter Design
Individual patterns are building blocks. The real craft of enemy AI design is combining them into encounters that create complementary pressures. A strong encounter forces the player to manage multiple problems simultaneously, where the solution to one problem conflicts with the solution to another.
Example: two turrets covering a corridor, one flanker moving through a side passage, and one rusher triggered when the player reaches the midpoint. The turrets force the player into cover. The flanker threatens their cover position. The rusher forces them out of cover entirely. The player must balance immediate survival (the rusher), positional awareness (the flanker), and route planning (the turrets) all at once. No single strategy works for all threats, which forces creative problem-solving and produces memorable combat moments.
Encounter pacing matters as much as composition. Front-loading all threats produces a spike of difficulty followed by easy cleanup. Staggering threats over time maintains tension throughout the encounter. Escalation, where each wave introduces a new pattern that counters the strategy the player developed against the previous wave, creates a ratcheting intensity that builds toward a climactic finish.
Enemy AI patterns work because they are readable, learnable, and combinable. Each pattern creates one specific pressure, and combining multiple patterns forces the player to juggle competing priorities, which is the foundation of engaging combat design.