Monsters fleeing

The in Doom causes attacking enemies to change direction and feint when the direct route to their target is obstructed. This normally adds to the realism and difficulty of combat (the cyberdemon on, for instance, could otherwise be killed through a sniper hole), but not always.

A demon attacking the player inside a passage 64 units wide can be turned back by damaging (pushing) it into a wall. This behaviour can be observed in Doom's and is a way to escape at the start of, most notably when using the fast monsters setting or playing on Nightmare skill level.

Any mobile monster at all, having repeatedly crashed into a wall or other monsters in its attempts to reach the player, eventually turns around and runs away from the player, sometimes reaching the opposite wall of the room before deciding to re-engage.

This effect occurs because the monster movement code is written to strongly discourage making a 180-degree turn, and a moving monster will prefer to move in literally any other direction rather than make a 180-degree turn. Therefore, a monster in a narrow corridor along an cardinal or ordinal direction will only have two possible directions to move in - either towards or away from the player - and once the monster is moving in one of these directions it will refuse to turn around until there is no other option.

The teleportation trap in Doom II's exploits the fleeing behavior as a feature, by putting the room's only exit behind the monsters.

Though not related to pursuit AI, but to engine physics, when a cacodemon or pain elemental takes damage, it often drifts backward a considerable distance before regaining its "bearings" (see also Lost soul charging backwards).

Examples

 * [[Media:MonsterFlee.WAD|MonsterFlee.WAD]] (file info) illustrates an extreme instance of this phenomenon; without it, 100% kills would be almost unattainable. As long as the player does not move too far north or south before awakening the demon, he will run eastward (away from the player) as soon as he is aroused. (Note that the demon in the first room is actually three demons at the same location, one for each difficulty class, but it is not necessary for the effect to work.)
 * [[Media:cacowimp.lmp|Cacowimp.lmp]] (file info) demonstrates that a cacodemon can backpedal halfway across the room when damaged.