Begin with a promise the player can learn

If a guard reacts to a visual cue, the game should show what the guard noticed and give the player a chance to respond. A hostile glance, a change in movement, and a short delay before pursuit often communicate more than a warning icon. Design the transition as a gameplay beat: observation, interpretation, then action.

Keep the rules consistent when the player experiments. If a person can break line of sight around one corner, a similar corner should usually have the same effect. Deliberate exceptions need their own cues.

Separate perception from decisions

An NPC does not need to know the player position all the time. Record what it sensed, where it sensed it, when it last had confirmation, and how confident it is. A last-known location can remain interesting after the current target location becomes unknown.

In Unreal, perception can supply stimuli, a Blackboard can hold decision facts, and a Behavior Tree can choose among patrol, investigate, pursue, search, or regroup. Use a priority order that can be reviewed alongside animation and navigation. The same architecture can be implemented with a state machine when the behavior set is small.

Make transitions calm under noisy inputs

At the edge of cover, a guard may receive alternating visibility updates. Require consistent evidence before escalating. Give the current action a minimum commitment window and use a separate timeout for losing confidence. This avoids the visible jerk of sprinting, stopping, and sprinting again on successive updates.

Keep local cooldowns in the decision layer rather than blending away repeated choices in animation. Otherwise the NPC can look calm while still flooding navigation or network messages.

Test the failure cases

Prepare five quick scenarios: static visual detection, a false alert through a wall, line of sight lost while moving, a blocked search destination, and two guards reacting to one event. Log the stimulus, state transition, and elapsed time. Play the same scenario twice, once with a controller and once using a scripted input, then look for unexpected choices.

A useful game AI test checks whether the player had a readable opportunity to react. Being exactly correct on every stimulus is not a good substitute for fair, consistent play.

Further reading