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


  • Content count

  • Joined

  • Last visited

1 Follower

About ZeroKnight

  • Rank
    New Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ZeroKnight

    Weapon Kickback

    Decided to dig around and see how GZDoom does things in this regard, and it seems my hunch was on track; both damage and GZDoom's kickback attribute influence how much an enemy is knocked back. As you mentioned, Doom weapons have a default kickback of 100; this seems to be defined in ZScript as part of the DoomWeapon class (wiki, source). Among its other modifications and restructuring of P_DamageMobj, GZDoom actually handles kickback in ZScript as well, in the Actor class's ApplyKickback method (wiki, source). The relevant lines seem to be: thrust = mod == 'MDK' ? 10 : 32; if (Mass > 0) { thrust = clamp((damage * 0.125 * kickback) / Mass, 0., thrust); } Breaking this down, it sets thrust to an initial value of 10 if the attack has the "MDK" modifier, which I'm guessing is from the mdk debug command, or 32 otherwise. Next, if the enemy has mass, it calculates a thrust based on the attack damage, the weapon's kickback (which could be modified by mods, mind you), the victim's mass, and some coefficient of 0.125 that I'm guessing normalizes the result to something expected for thrust values. This result is clamped to always be between 0 and either 10 or 32 depending on that initial value. Now, I haven't looked much farther than this, so I don't know how different GZDoom's thrust and speed values are, and if how they're calculated differs from vanilla Doom, but based on that calculation you could try setting the weapon kickback to 1 (not 0, as that won't move the target at all) and see if that feels closer to vanilla.
  2. ZeroKnight

    Weapon Kickback

    Skimming the Doom source, I found this line in P_DamageMobj() in p_inter.c (comments mine): // FRACUNITS is defined as 1<<16, which is just 2^16 or 65536 // A right-shift 3 is the same as dividing by 2^3, which ends up being 8192 thrust = damage*(FRACUNIT>>3)*100/target->info->mass; Mass for most things is 100 with some notable exceptions for Cyberdemons and Masterminds who have a mass of 1000, as well as Keens and Romero's head who have a mass of 10,000,000 making them practically immobile. You can find all of them in info.c or in decino's video on monster stats. So at least in vanilla Doom, knockback is dependent on how much damage you do and is not fixed. I've never looked at GZDooms internals, so I don't know how it differs, but since you mention that you found a fixed knockback attribute, then I don't know if you can totally reproduce vanilla Doom's knockback behavior in GZDoom. Taking a shot in the dark, perhaps it still uses this thrust calculation to some degree, and that there may be some magic value you could set weapon knockback to achieve vanilla behavior? I think I'll have to take a look at GZDoom, or perhaps someone more experienced with it can chime in.