wedhost.blogg.se

Half life 1 weapons
Half life 1 weapons




half life 1 weapons

#if defined( CLIENT_WEAPONS ) // HACK: This variable is saved/restored in CBaseMonster as a time variable, but we're using it // as just a counter. We can see this easily by expanding arcsin x and arctan x to two terms in their respective Maclaurin series: In general, the actual angle of deviation ∠ B A D is always slightly smaller than the intended angle ∠ B A C. Using the MP5 as an example, the actual angle of deviation is 2 arctan 0.05234 ≈ 5.992 ∘ which is smaller than intended. Specifically, (13.2) makes the maximum deviation to be the the line A D with angle ∠ B A D < ∠ B A C. Even if we consider just the horizontal and the vertical angles of deviation, the actual angle differs from the intended angle because the method of obtaining the values defined in the SDK is incorrect given how those values are then used in (13.2). Firstly, as explained in Distribution, the bullets spread in a square rather than a circle, so the angle of deviation from the centre is not constant. However, if we look more closely at (13.2), we see that the actual maximum angle of deviation is not exactly 6 degrees, for two reasons. A is the bullet source of the line trace (denoted as a), A C ′ B = A C has unit length represents the aiming direction, A B D is a right-angle triangle, C C ′ = B D, and B C is an arc with a centre at A. The different meaning of “bullet spread” used inconsistently in the SDK. Mathematically, these are computed as such:įig. At the start of an iteration, it computes the deviation multipliers m x and m y in the horizontal and vertical directions respectively. Let i be the loop counter such that i = 1 in the first iteration, i = 2 in the second iteration, and so on. The loop is the meat of the bullet spread physics.

half life 1 weapons

The effect of these is that the damage will usually be accumulated and then actually inflicted, rather than inflicted for each bullet. Once it exits the loop, it does an apply operation. It then enters a loop that spreads and adds or accumulates the damage that will be inflicted due to each of the n B bullets. At a higher level, the function begins by doing a clear on the currently accumulated damage and sets the accumulated damage type to DMG_BULLET | DMG_NEVERGIB. This function uses the multidamage mechanism described in Damage system. Of concern to us are the spread vector Ω ∈ R 3, the source of line trace a, the aiming direction d, the range ℓ of the weapon, the bullet type, and the shared RNG “seed” σ. This function also accepts several other obvious arguments. In all other weapons that have bullet spreads, 1 is always passed in, because those weapons fire one bullet at a given time. For example, the shotgun (see Shotgun) in primary mode would pass 6 for this argument. One of the arguments to this function is the number of bullets n B. The spread of the bullets when fired by the player is computed in CBaseEntity::FireBulletsPlayer. In particular, if in a TAS the player loads from a savestate and fires a weapon with bullet spread in some fixed n-th frame, then the spread of the bullets will not change if the savestate is loaded again and the same actions are repeated. However, bullets fired by the player rely only on the shared RNG, which we have concluded in Shared RNG that it is wholly predictable and non-random. The deviation appears to be random and unpredictable to a casual player. The amount of deviation depends on the weapon. The bullets of some weapons in Half-Life have a spread that cause them to deviate from the target slightly.






Half life 1 weapons