Monsters may target players without ever seeing or hearing them


When a monster's current target dies, it always returns to its dormant state. (This is most often seen when a player dies and all monsters instantly stop moving.) However, during normal play, this behavior is almost always overridden. For example, when a monster is hurt by another monster, changes its target to that monster, and kills it, although the monster technically returns to its dormant state, it will almost always instantly wake up and retarget the player.

However, in rare situations, a monster can wake up and target the player even if it has never seen or heard the player. A hypothetical example would be a level with a room with closed doors, where the player has previously fired a weapon inside the room and the sound did not "leak" out to any other part of the level. If a dormant monster is woken by being hurt by another monster, pursues its target into that room, and kills its target, it will instantly reawaken and target the player, despite never having seen or heard the player.

The reason for this behavior has to do with how Doom handles sound propagation. Data structures for sectors in Doom have a member named soundtarget. This member is set in P_RecursiveSound, which is called by a player's gunfire noise flooding all areas not behind doors or sound-blocking lines. Once set, the sector's soundtarget is never returned to null. Thereafter, if there are any dormant monsters in the sector, during the call to their A_Look state, they will check if the sector they are in has a soundtarget set, and if so, wake up immediately. The result of this algorithm is that even if a monster has never seen or heard the player, if they return to their idle state in a sector where a gunshot has previously been heard, no matter how long ago, they will instantly wake up and set the player as their target.

This subtle behavior can be considered a side effect of the "ambush" flag that monsters may have, where they will stand still even if they have heard the player, and only wake up when the player enters their 360-degree field of view. This special state of full spatial alertness is not stored within the monster's data object directly. Instead, if a monster has an ambush flag, and the sector the monster is in has a soundtarget set, then the monster is assumed to have heard the player and is lying in wait. This results in the side effect that normal monsters returning to idle in one of those sectors instantly "hears" the permanent soundtarget sector property as well.