Difference between revisions of "Sleeping shotgun guy in MAP02 (Doom II)"

From DoomWiki.org

[unchecked revision][checked revision]
m (Technical: Clearly it's past my bedtime)
 
(15 intermediate revisions by 7 users not shown)
Line 1: Line 1:
In MAP02 of Doom II, after opening the pillar to the left of the starting point and past the doors requiring the [[items#Other|blue key]] (Co-ordinates: 946,903,-16), there is a [[sergeant|shotgun guy]] next to a [[barrel]]. However, he is partially stuck in a wall so if he spots the player, he does nothing about it.
+
In [[MAP02: Underhalls (Doom II)|MAP02]] of [[Doom II]], after going through the first door, the player must get past a [[shotgun guy]] in order to press the switch that opens the next part of the level. However, this shotgun guy ignores the player and does not "wake up" as monsters usually do when spotting a player.
  
As this is the first [[barrel]] a player encounters in Doom II, it is possible that the [[sergeant|shotgun guy]] is intentionally stuck in order to give a novice player the opportunity to purposely shoot the barrel and thereby gib the enemy.
+
Usually, the bug is not noticed, as the player must confront two [[zombiemen]] in the same room before reaching the shotgunner.  The action of killing them usually wakes up the shotgun guy (that is still sensitive to sound).
  
{{stub}}
+
The same error can occur in reverse; one example is in [[E1M5: Phobos Lab (Doom)|E1M5]] of [[Knee-Deep in the Dead]]. If the player moves slowly up the left side of the first staircase, he may awaken the [[imp]] in the far northeast corner of the room directly ahead, even though there is a solid wall between the two locations.
 +
 
 +
== Technical ==
 +
 
 +
The behavior occurs due to a bug in Doom's line of sight code. The code which causes it is located in [[Doom source code files|p_sight.c]], in the function P_DivlineSide.
 +
 
 +
    if (!node->dy)
 +
    {
 +
        '''if (x==node->y)'''
 +
            return 2;
 +
 +
        if (y <= node->y)
 +
            return node->dx < 0;
 +
 +
        return node->dx > 0;
 +
    }
 +
 
 +
By comparing the wrong coordinates, this code causes the engine to think that any coordinate lies on a BSP [[Doom rendering engine#Node building|node]] partition line, when the partition line is horizontal and the thing's x is the same as the y coordinate of the node line's origin, which is always a vertex. This can cause the sidedness decision to be incorrect, either indicating that the enemy is on the same side of the node line as the player or a different side than the player, when the opposite is actually true.
 +
 
 +
In the MAP02 case, the shotgun guy is at (1200,1232) and one of the vertices behind it is at (1232,1200).  In the E1M5 case, the imp is at (672,1264) and one of the linedefs south of it has a vertex at (400,672).
 +
 
 +
== Demo files ==
 +
 
 +
* [[Media:D202blnd.lmp|The sleeping shotgun guy]] ([[:Image:D202blnd.lmp|file info]]) in [[MAP02: Underhalls]]
 +
 
 +
== See also ==
 +
* [[MAP22: The Catacombs (Doom II)#Bugs|Blind chaingunners in Doom II MAP22]]
 +
 
 +
== External links ==
 +
 
 +
* [http://games.moria.org.uk/doom/research/MAP02-sleepwalker The Sleepingwalking Sergeant of MAP02], a technical explanation by [[Colin "cph" Phipps]].
  
 
[[Category:Errors and bugs]]
 
[[Category:Errors and bugs]]
 +
[[Category:Doom engine]]
 +
[[Category:Monsters]]

Latest revision as of 00:24, 2 January 2015

In MAP02 of Doom II, after going through the first door, the player must get past a shotgun guy in order to press the switch that opens the next part of the level. However, this shotgun guy ignores the player and does not "wake up" as monsters usually do when spotting a player.

Usually, the bug is not noticed, as the player must confront two zombiemen in the same room before reaching the shotgunner. The action of killing them usually wakes up the shotgun guy (that is still sensitive to sound).

The same error can occur in reverse; one example is in E1M5 of Knee-Deep in the Dead. If the player moves slowly up the left side of the first staircase, he may awaken the imp in the far northeast corner of the room directly ahead, even though there is a solid wall between the two locations.

Technical[edit]

The behavior occurs due to a bug in Doom's line of sight code. The code which causes it is located in p_sight.c, in the function P_DivlineSide.

   if (!node->dy)
   {
       if (x==node->y)
           return 2;

       if (y <= node->y)
           return node->dx < 0;

       return node->dx > 0;
   }

By comparing the wrong coordinates, this code causes the engine to think that any coordinate lies on a BSP node partition line, when the partition line is horizontal and the thing's x is the same as the y coordinate of the node line's origin, which is always a vertex. This can cause the sidedness decision to be incorrect, either indicating that the enemy is on the same side of the node line as the player or a different side than the player, when the opposite is actually true.

In the MAP02 case, the shotgun guy is at (1200,1232) and one of the vertices behind it is at (1232,1200). In the E1M5 case, the imp is at (672,1264) and one of the linedefs south of it has a vertex at (400,672).

Demo files[edit]

See also[edit]

External links[edit]