
Library : a_civilian's Article on NS & HL Engine Mechanics back
Original Link: http://www.unknownworlds.com/forums/ind … opic=97790
a_civilian wrote:
Delays between attacks (inverse of rate of fire) at 100 fps, in seconds:
Code:
Light Machinegun: .060 Shotgun: .66 Heavy Machinegun: .060 Grenade Launcher: .61 Pistol (cap): .10 Mines: .50 Knife: .33 Skulk Bite: .40 Parasite: .25 Leap: .50 Spit: .40 Heal Spray: .80 Bile Bomb: .75 Web: .25 Lerk Bite: .32 Spores: 1.00 Umbra: .50 Swipe: .48 Metabolize: 1.45 Acid Rocket: .50 Gore: .45 Devour: 1.00 Stomp: .75Should be accurate to within ±1 to the last significant digit (±0.001 seconds for LMG and HMG, ±0.01 seconds for all else). Also, note that there is no delay before the first attack.
Reload times, in seconds:Code:
LMG: 3.00 Pistol: 3.00, 3.10 (magazine not empty, magazine empty) Shotgun: 1.10+.47n HMG: 6.30 GL: 2.20+1.10nShould be accurate to within ±0.01 seconds.
Both were measured using the wait command and the fact that at 100 fps (constant), each such command waits 0.01 seconds.
a_civilian wrote:
Weapon draw times, in seconds:
Code:
LMG: .40 Shotgun: .90 HMG: .60 GL: .30 Pistol: .35 Knife: .25 Welder: .55 Mines: .30 Grenade: .30 Skulk Bite: .10 Parasite: .10 Leap: ~0 (<.02) Xenocide: .10 Spit: .10 Healspray: .10 Bilebomb: .10 Web: 1.00 Lerk Bite: .20 Spores: .60 Umbra: .10 Primal Scream: .60 Swipe: .10 Blink: .10 Metabolize: .10 Acid Rocket: .10 Gore: .50 Devour: .60 Stomp: .60 Charge: .60Accurate to within ±0.01 seconds.
a_civilian wrote:
Fall damage:
Fall damage is taken past 580 units/second, and is modeled by:
damage = 0.225v - 130
(vertical component of the velocity; downward is taken to be positive)
a_civilian wrote:
Leap speed:
Leap adds 500 units of speed in the direction you're aiming.
If you're on the ground, it also jumps, adding vertical speed.
a_civilian wrote:
Marine bunnyhopping:
A marine can bunnyhop on landing if the vertical component of his velocity is less than his base speed.
Hence the height difference h needed to bunnyhop at base speed v, jump speed* s, and sv_gravity g is given by:
h = (s^2 - v^2)/(2g)
And conversely, the base speed v needed to bunnyhop on a height difference h with jump speed* s and sv_gravity g is given by:
v = sqrt(s^2 - 2gh)
*see entry on jump speed below
a_civilian wrote:
Dependence of movement speed on framerate:
For the purposes of movement, the unit time varies with framerate. This causes variation in movement speed that does not show up on cl_showspeed, and is the reason for drastically lengthened jump durations at certain very high framerates.
Here is a plot of the factor by which the unit time is lengthened, against framerate. Notable troughs are labeled (major troughs in red, minor troughs in orange); these are desirable framerates as they maximize speed (lower time multiplier is better).
(Major troughs, in text form, occur at framerates 20, 25, 27, 37, 40, 50, 62, 71, 83, 100, 111, 125, 142, 166; minor troughs at 30-33, 43, 45, 47, 52, 55, 58, 66, 76, 90)
a_civilian wrote:
Dependence of attack rate on framerate:
The dependence of attack rate on framerate appears defined by the statement that there must be a constant integer number of frames between attacks at any framerate. The measured numbers of frames between attacks for each framerate value are shown below for selected weapons:
Code:
LMG and HMG: framerate frames/attack 20 1 21-38 2 39-58 3 59-76 4 77-90 5 91-111 6 112-125 7 126-142 8 143-166 9 167-? 10 pistol (cap): framerate frames/attack 20-29 2 30-40 3 41-47 4 48-58 5 59-66 6 67-76 7 77-83 8 84-100 9 101 10 102-111 11 112-125 12 126-142 14 143-166 16 167-? 19 shotgun: framerate frames/attack 20-21 14 22 15 23-24 16 25 17 26-27 18 ... (I interpolate insignificant attack rate variation) 91-95 65 96-100 66 101 69 102-111 73 111-125 82 126-142 93 143-150 108 151-166 109 167-? 127 bitegun: framerate frames/attack 20 8 21-22 9 23-25 10 26-27 11 28-29 12 30-32 13 ... (as previously) 63-66 27 67-71 29 72-76 31 77-83 34 84-90 37 91-99 40 100 41 101-102 44 103-111 45 112-125 50 126-142 57 143-166 67Obviously, the attack rate is maximized by setting the framerate to the highest value that preserves any given number of frames per attack (that is, the highest value in one of the given ranges).
The attack rate (in attacks/second) can be determined by dividing the framerate by the number of frames per attack.
(the CAL forums formatted this last one nicely sad-fix.gif )
a_civilian wrote:
Addition, 3/1/07: Blink
----------------
Each attack of blink adds 225 units of speed. At 100 fps, blink fires every 0.06 seconds (6 frames). (This is in 3.2.)
Thus it takes 0.19 seconds* to reach maximum non-celerity horizontal speed (aiming between 0 and 36 degrees from the horizon) and 0.25 seconds to reach maximum celerity horizontal speed (aiming between 0 and 32 degrees from the horizon).
* remember that the first attack fires instantly - that is, in one frame.
Blinking while standing on the ground also automatically jumps for an additional 268 units of speed upward.
----------------
a_civilian wrote:
Addition 2, 3/1/07: Jetpack
----------------
Jetpack vertical acceleration is modeled at 100 fps by a = 7.16s - 324 (in units/second^2), where s is the base run speed. (Note: This does not include the effect of gravity; to account for that, subtract 800.)
The dependence of this on framerate, as any "continuous" acceleration, is as the inverse of the time multiplier with respect to speed or the inverse square of the time multiplier with respect to distance.
If a directional command is held while using the jetpack, 12 units of speed are added to the horizontal velocity per frame, regardless of the framerate.
The jetpack's vertical and horizontal thrusts are independent.
----------------
a_civilian wrote:
Addition, 3/9/07: Friction
----------------
At speeds above 100 units/second, the acceleration due to friction is -sv_friction*v (in units/second^2), where v is the horizontal velocity.
At nonzero speeds below 100 units/second, the acceleration due to friction is a constant 100*sv_friction units/second^2 opposite the direction of motion.
----------------
a_civilian wrote:
Addition 2, 3/9/07: Surface acceleration
----------------
The ground acceleration of every class is (base run speed)/(0.1 seconds). (Note this does not include the effects of friction.)
----------------
a_civilian wrote:
Addition, 5/21/07: Jump speed
----------------
Jump speed for every class is 268 units/second. However, HL seems to apply changes in velocity before changes in position, so one frame's worth of gravity is subtracted from the speed before you even leave the ground.
Therefore the correct formula for jump speed v is
v = 268 - sv_gravity/framerate