Difference between revisions of "Lost soul colliding with items"

From DoomWiki.org

[checked revision][unchecked revision]
(Undo revision 81766 by Unmaker (talk))
(possible technical explanation)
Line 1: Line 1:
If a [[lost soul]] collides with any item while charging forward, the monster will stop and start moving normally again as if nothing had happened. It is due to the fact that items are exempt from most collision checks. A noticeable effect is on [[E2M8: Tower of Babel]] in [[Doom]], where the player can hide behind the alcoves of items and effectively protect himself from the flaming skulls in the level.
+
If a [[lost soul]] collides with any item while charging forward, the monster will stop and start moving normally again as if nothing had happened.  
 +
 
 +
The reasoning behind this behavior does not seem very obvious. In the [[Doom source code]], <tt>PIT_CheckThing</tt> is the generic function which handles collisions between [[thing]]s - such as [[projectile]] hits and [[item]]s being picked up. Here, projectiles ([[mobj]]s which have the <tt>MF_MISSILE</tt> bitflag onto them) are checked if they actually hit something solid and/or shootable, taking the Z coordinate into account (the function returns <tt>true</tt> if the collision does not take place):<ref>Doom source code, p_map.c</ref>
 +
 
 +
  // missiles can hit other things
 +
  if (tmthing->flags & MF_MISSILE)
 +
      {
 +
        // see if it went over / under
 +
        if (tmthing->z > thing->z + thing->height)
 +
            return true; // overhead
 +
        if (tmthing->z+tmthing->height < thing->z)
 +
            return true; // underneath
 +
 
 +
For reasons unknown, the lost soul's collision code (while dashing, it has the <tt>MF_SKULLFLY</tt> bitflag set, albeit the difference is not significant) does not do any of above checks, simply zeroing out the monster's momentum, along with a call to <tt>P_DamageMobj</tt>. Furthermore, it does not check what kind of thing it hits (flags <tt>MF_SOLID</tt>, <tt>MF_SPECIAL</tt>, <tt>MF_SHOOTABLE</tt>, which again are handled proper for missiles).
 +
 
 +
The result of such flawed logic is, that the lost soul's charge will be interrupted by ''any type'' of thing - a monster, a powerup, or a decoration - situated on ''any height'' along the lost soul's trajectory.  
 +
 
 +
A notable example can be seen on [[E2M8: Tower of Babel]] in [[Doom]]: as long as the player stays behind the items in alcoves, he is effectively unreachable for the flaming skulls in the level.
  
 
== External Links ==  
 
== External Links ==  
 
[http://forum.zdoom.org/potato.php?t=5310&postdays=0&postorder=asc&start=0 Bug report thread at the ZDoom forums]
 
[http://forum.zdoom.org/potato.php?t=5310&postdays=0&postorder=asc&start=0 Bug report thread at the ZDoom forums]
 +
 +
== References ==
 +
<references/>
  
 
[[Category:Errors and bugs]]
 
[[Category:Errors and bugs]]
 
[[Category:Monsters]]
 
[[Category:Monsters]]
 
[[Category:Doom engine]]
 
[[Category:Doom engine]]

Revision as of 13:05, 10 September 2012

If a lost soul collides with any item while charging forward, the monster will stop and start moving normally again as if nothing had happened.

The reasoning behind this behavior does not seem very obvious. In the Doom source code, PIT_CheckThing is the generic function which handles collisions between things - such as projectile hits and items being picked up. Here, projectiles (mobjs which have the MF_MISSILE bitflag onto them) are checked if they actually hit something solid and/or shootable, taking the Z coordinate into account (the function returns true if the collision does not take place):[1]

  // missiles can hit other things
  if (tmthing->flags & MF_MISSILE)
     {
        // see if it went over / under
        if (tmthing->z > thing->z + thing->height)
           return true;		// overhead
        if (tmthing->z+tmthing->height < thing->z)
           return true;		// underneath

For reasons unknown, the lost soul's collision code (while dashing, it has the MF_SKULLFLY bitflag set, albeit the difference is not significant) does not do any of above checks, simply zeroing out the monster's momentum, along with a call to P_DamageMobj. Furthermore, it does not check what kind of thing it hits (flags MF_SOLID, MF_SPECIAL, MF_SHOOTABLE, which again are handled proper for missiles).

The result of such flawed logic is, that the lost soul's charge will be interrupted by any type of thing - a monster, a powerup, or a decoration - situated on any height along the lost soul's trajectory.

A notable example can be seen on E2M8: Tower of Babel in Doom: as long as the player stays behind the items in alcoves, he is effectively unreachable for the flaming skulls in the level.

External Links

Bug report thread at the ZDoom forums

References

  1. Doom source code, p_map.c