Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Terra-jin

Nukage rhythm

Recommended Posts

I don't know if this was known already, but I noticed something that may be useful for skilled players.

If you're running, the weapon you're holding swings at exactly the same rhythm as nukage does damage. The moment the weapon is at it's highest is the moment when the damage is dealt.

By keeping this in mind, it's possible to minimize sector damage if you time it right.

Share this post


Link to post

If this is correct, then it will be very useful for making reality demos. Thanks for the info! I'll check it out and see what I can come up with when I get the time. :-)

Share this post


Link to post

Cool, you have sharp eyes :) Actually we can prove this from the source. p_spec.c does poisonous floor damage, as follows

if (!(leveltime&0x1f))
  P_DamageMobj (player->mo, NULL, NULL, 10);
that is, damage is applied if the level time (in tics) ANDed with 31 gives you zero (that is, it's a multiple of 32; so you are damaged once every 32/35ths of a second)

p_pspr.c deals with the position of the gun.
// bob the weapon based on movement speed
{
  int angle = (128*leveltime) & FINEMASK;
  psp->sx = FRACUNIT + FixedMul(player->bob, finecosine[angle]);
  angle &= FINEANGLES/2-1;
  psp->sy = WEAPONTOP + FixedMul(player->bob, finesine[angle]);
}
Line 3 translates the level time into an angle. Now at the moment of damage, leveltime is a multiple of 32, so (128*leveltime) is a multiple of 4096. FINEMASK is defined in tables.h as 8191, so at the moment of damage, angle will be either 0 or 4096 (okay I haven't explained this very well, go look up bitmasks or just trust me!) In Doom's internal trigonometry lookup tables, these values correspond to angles of 0 and π radians respectively.

Line 4 sets the displacement of the weapon from its central rest location based on the cosine of angle. But the cosine function is at its maximum absolute value at 0 and π. Therefore the moment of damage will be when the gun is at its maximum displacement from the centre. This is the observed behaviour.

Share this post


Link to post

This is a pretty interesting find. I just tried it and I'm amazed I never noticed it before, and what's more I don't know how it took almost 12 years for this to be discovered. :P

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×