Enemy Design: Giving Fantasy Foes Distinct Behaviours and Weaknesses
A fantasy enemy becomes memorable when players can recognise what it wants, understand how it acts, and make informed decisions about how to respond. A creature does not need a…
Enemy artificial intelligence, often called enemy AI, is the collection of rules that allows a non-player opponent to observe a situation, select an action, and react to what happens next. It does not usually think in the same way as a human player. Instead, it processes available information through systems designed by the game developers.
When an opponent appears to make a decision, several separate tasks may be involved:
These steps are often repeated many times during play. A guard may begin with a patrol route, hear a noise, investigate its source, spot the player, pursue them, and eventually search the last known location. The sequence can feel intelligent even though it is built from clearly defined conditions and priorities.
An enemy can only respond to the information its AI system receives. Perception is therefore the foundation of believable behavior. Common inputs include visual detection, sound, proximity, damage, line of sight, and information shared by other enemies.
A visual system may check whether the player is inside a detection area, whether an obstacle blocks the view, and how long the player has been visible. This can create a gradual alert process instead of an instant change from calm to combat. For example, an opponent might notice movement, become suspicious, and only then confirm the player's presence.
Sound can add another layer. A loud action may produce a position or an approximate area rather than a perfectly accurate target. The opponent can then investigate that location. This distinction matters because a search based on incomplete information feels more credible than an enemy that always knows the player's exact position.
Many games also use memory. Rather than tracking the player continuously, an opponent may remember a last known position for a limited period. If the player leaves that area, the enemy can search, return to a patrol, or remain alert. For players, understanding whether an enemy has direct knowledge or only an old clue helps explain why hiding, breaking line of sight, or creating a distraction can work.
Developers use several models to organize decisions. These systems can be combined, and the visible behavior depends on how they are configured.
A finite state machine divides behavior into named states. A simple enemy might have states such as patrol, investigate, chase, attack, flee, and search. Rules called transitions determine when the enemy moves from one state to another.
For instance, an opponent can transition from patrol to investigate after hearing a noise, then from investigate to chase after confirming the player's presence. State machines are easy to understand and are useful for straightforward opponents. Their limitation appears when many conditions overlap. A large number of states and transitions can become difficult to maintain, especially when an enemy needs to combine several goals.
A behavior tree organizes choices in a hierarchy. A priority branch can check urgent needs first, such as responding to a major threat. If that branch cannot run, the system tests another branch, such as pursuing a target or following a route.
Behavior trees commonly use selectors, sequences, and conditions. A selector tries alternatives until one succeeds. A sequence performs several steps in order, such as move to a cover point, face the target, and fire. This structure makes complex behavior easier to inspect and modify.
A utility system gives possible actions scores based on the current situation. Attacking may become more attractive when the enemy has a clear shot. Taking cover may receive a higher score when health or ammunition is low. Retreating may become preferable when allies are gone and the player is close.
Utility-based decisions can produce flexible behavior because the best action changes with context. They may also create surprising choices if the scoring rules are poorly balanced. A small change in distance, danger, or resource level can alter the selected action.
Planning systems choose a sequence of actions to reach a goal. An opponent might need to obtain a weapon, move to a defensive position, and then confront the player. These systems can support longer-term behavior, although they require clear definitions of goals, available actions, and their effects.
A game opponent is usually designed to create a readable and enjoyable challenge, not to maximize its chance of winning in every situation. Perfect play can make a game frustrating, repetitive, or impossible to understand.
Designers may limit an enemy in several ways:
These limits also make behavior easier for players to read. If an enemy always changes direction without delay, attacks with perfect accuracy, and shares exact information with every ally, the result may feel less like a contest and more like an invisible system controlling the player.
Choosing an action is only part of the problem. The opponent must also reach the intended location. Games commonly represent walkable areas with navigation data, often called a navigation mesh or navmesh. Pathfinding algorithms then search for a route through that space.
A navigation system can account for obstacles, doors, slopes, restricted zones, and different movement costs. A large enemy may need a wider route than a small one. A flying opponent may use a completely different movement model. If the route is blocked or the target becomes unreachable, the AI needs a fallback, such as selecting another position or abandoning the action.
Pathfinding does not automatically create tactical intelligence. An opponent may find the shortest route while choosing a poor destination. Tactical systems decide where the enemy should go, while navigation determines how to get there. Useful tactical positions can include cover, high ground, a flank, a defensive doorway, or a location that protects an objective.
Players can often recognize the difference. An enemy that walks directly toward a target may be following a basic chase rule. One that moves to a visible but protected position is combining navigation with tactical evaluation.
Group behavior usually depends on shared information. Enemies may communicate a player's last known position, report damage, request assistance, reserve a route, or change formation. This information is often stored in a shared data structure sometimes called a blackboard, although the exact implementation varies.
Coordination can produce different roles:
Good group AI also needs limits. If every enemy attacks at once, the player may have no meaningful opportunity to respond. Designers can use spacing, action reservations, communication delays, or role priorities to prevent a crowd from performing the same action simultaneously.
From the player's perspective, defeating or isolating a communicator can change the group's behavior. Separating opponents, blocking their line of sight, or forcing them into narrow routes may reduce the effectiveness of their coordination. These effects depend on the particular game, so they should be tested rather than assumed.
Understanding basic AI patterns can make encounters easier to interpret without removing the challenge. Instead of asking whether an enemy is intelligent, examine the information it appears to have and the rules it follows.
This approach is useful for families and new players because it turns confusing encounters into observable patterns. It also encourages safer experimentation. Players can test one variable at a time, such as making a sound from cover, moving across an enemy's view, or removing a support unit before engaging the main group.
| Observed behavior | Likely system or rule | Useful player response |
|---|---|---|
| Enemy returns to a route after searching | Patrol state with a limited alert timer | Wait, reposition, or create a new distraction |
| Several enemies converge on one location | Shared alert information or group communication | Change position and avoid repeating the same noise |
| Enemy moves behind protection before attacking | Cover evaluation linked to combat behavior | Control the angle or relocate before the attack begins |
| Enemy stops at a doorway or obstacle | Navigation limits, collision rules, or a blocked route | Use the environment and avoid assuming the enemy can follow everywhere |
| Enemy withdraws when badly threatened | Health, morale, or survival utility score | Decide whether pursuit is safe and whether the retreat serves another goal |
These interpretations are general patterns, not guarantees. Games can deliberately use misleading behavior, scripted events, or different rules for different difficulty levels. The most reliable method is to observe how the opponent reacts to repeated, controlled situations.
Difficulty settings can alter enemy behavior in many ways. Increasing health or damage is only one option, and it does not necessarily make an encounter more interesting. Other adjustments can affect perception, decision timing, accuracy, coordination, available actions, or the amount of information shared.
A higher difficulty level might reduce reaction delay, improve aim, expand the set of usable tactics, or make enemies communicate more effectively. A lower setting might provide longer warning cues, slower decisions, less accurate attacks, or fewer simultaneous threats. These changes should remain understandable to the player. If an opponent suddenly detects hidden movement through solid obstacles, the challenge may feel arbitrary unless the game clearly establishes that rule.
Accessibility settings can also affect how players experience AI. Options related to combat speed, visual clarity, aim assistance, or alert feedback may change the practical difficulty without altering the underlying decision model. Choosing such settings is a valid way to adapt an activity to different ages, abilities, and levels of experience.
Testing enemy AI requires more than checking whether an opponent can defeat the player. Developers need to examine whether decisions are reliable, readable, and appropriate for the situation. Useful tests place enemies in controlled scenarios with different distances, obstacles, numbers of allies, and available routes.
Important questions include:
Developers may use visual debugging tools to display detection areas, navigation paths, current states, selected targets, and utility scores. These tools help identify problems that are difficult to diagnose from the final game alone. Testing should also include unusual situations, such as a player hiding in an unexpected location, removing a key enemy, or opening a route in a different order.
Usually, enemies follow rules created by the game rather than learning freely during play. A game may record player actions or adapt its priorities, but this is different from an AI system independently developing new strategies. The exact behavior depends on the design of the particular game.
Several explanations are possible. The enemy may be following your last known position, receiving information from an ally, using a wider detection rule, or responding to a scripted event. Breaking line of sight does not always erase information that the AI has already received.
Scripted behavior follows a planned sequence or event condition, such as an enemy entering an area at a specific moment. Reactive AI evaluates current information and selects an action according to its rules. Many games combine both approaches.
AI systems operate within navigation, collision, animation, perception, and priority rules. These systems can conflict or fail in unusual situations. An enemy may also be intentionally restricted to keep an encounter fair or to preserve a planned role.
Learning methods can support some game systems, but they do not automatically replace established decision structures. Designers still need to control goals, safety, readability, performance, and fairness. For many opponents, a carefully authored system remains easier to test and understand.