In-depth explanation of Spread/Accuracy

Post » Sun Aug 08, 2010 9:05 am

In-depth explanation of Spread/Accuracy

by Schlangster and Kai Hohiro

Spread is the value that determines by how much your shots can deviate from your intended target (the center of your cross hair). The higher your spread, the more inaccurate you are. For the sake of powergamers, modders and the good of mankind we’ll explain in-depth how this mechanic works.


1. Spread Calculation
2. Spread in-game
3. Testing Methods



1. Spread Calculation
A lot of you probably know the http://geck.gamesas.com/index.php/Gun_Spread_Formula from the GECK wiki. Now forget all about it, because none of the settings or formulas are used in Fallout New Vegas. (And just to point out here again, FNV is a full of data and settings that are legacies from Oblivion and FO3, so just because something exists in the data files, doesn’t mean it’s actually used anywhere).

Instead we are presented with the following new settings in FNV:

fRunningSpreadPenalty (Default: 0.2)
fStandingSpreadPenalty (Default: 0.1)
fUnaimedSpreadPenalty (Default: 0.2)
fWalkingSpreadPenalty (Default: 0.1)
fCrippledArm1HSpreadPenalty (Default: 0.2)
fCrippledArm2HSpreadPenalty (Default: 0.4)
fCrippledArms1HSpreadPenalty (Default: 0.4)
fCrippledArms2HSpreadPenalty (Default: 0.6)
fWobbleToSkillConversion (Default: 0.5)
fMinGunSpreadValue (Default: 0.01)

These settings all affect the player’s spread. Now the total spread consists of two major factors, the player’s spread (from here on referred to as PSp) and the weapon’s spread (referred to as WSp).
The PSp is very variable, being affected by the players weapon skill, movement, arms and much more. Here is an overview of all the factors that affect PSp:
  • Weapon Skill
  • Perks/Traits/Chems (even those that say modify WSp, actually modify PSp)
  • Crouching
  • Using Scope/Iron Sights
  • Standing/Walking/Running
  • Using a 1 or 2 handed weapon and having 1 or 2 arms crippled
  • Weapon’s required strength
  • Weapon’s required skill
  • Ammo (this actually surprised me)


The WSp is completely static and consists solely of the weapon’s ‘Min Spread’ value. The only thing that affects this are weapon mods, nothing else does. Many people probably have also noticed the ‘Spread’ value in weapon tabs. That value does nothing at all. It didn’t do anything in FO3 either, unless you re-enabled spread penalties based on weapon conditions. I’m not sure if it’s possible to enable that in FNV, haven’t really looked into that.
Now what the PSp does is influence your character’s hand sway. The higher the PSp the more your hand will sway around, causing your shots to go off target. The sway you experience while using a weapon’s scope is exactly the same as your hand sway. The WSp on the other hand simply influence at what angle your bullet will leave the gun barrel, it will not cause any sway of the scope or player’s hand.

Following are the calculations that are used to determinate the player’s exact spread:

UnaimedPenalty
fUnaimedSpreadPenalty * !isUsingIronSights

RunningPenalty
fRunningSpreadPenalty * isRunning * isMoving

WalkingPenalty
fWalkingSpreadPenalty * !isRunning * isMoving
(Walking and Running Penalties are exclusive to each other)

StandingPenalty
fStandingSpreadPenalty * !isSneaking

ArmConditionPenalty
if 1ArmCrippled
fCrippledArm1HSpreadPenalty * isUsing1HWeapon
fCrippledArm2HSpreadPenalty * isUsing2HWeapon
if 2ArmsCrippled
fCrippledArms1HSpreadPenalty * isUsing1HWeapon
fCrippledArms2HSpreadPenalty * isUsing2HWeapon
(ArmConditionPenalties are all exclusive to each other)

StrReqPenalty
If Weapon Required Strength > Player Strength
(Weapon Required Strength - Player Strength) * 0.025


SkillReqPenalty
If Weapon Required Skill > Player Skill
(Weapon Required Skill - Player Skill) * 0.0025


SkillBonusMultiplier
1.00 - Player Skill/100 * fWobbleToSkillConversion

PlayerSpread = Perks * Ammo * SkillBonusMult * (UnaimedPenalty + WalkingPenalty + RunningPenalty + StandingPenalty + ArmConditionPenalty + SkillReqPenalty + StrReqPenalty)
if PlayerSpread < fMinGunSpreadValue
set PlayerSpread to fMinGunSpreadValue


WeaponSpread = WeaponMinSpread - WeaponModBonus

TotalSpread = PlayerSpread + WeaponSpread

And there you have your spread value. A few noteworthy things:
  • I wrote Player everywhere, however that’s interchangable with Actor
  • Many people assumed player skill didn’t matter as long as you meet the minimum skill requirements of a weapon. That is incorrect, as soon as you have any kind of penalty, skill will matter.
  • As long as you have the weapon’s required strength and skill values, and no crippled arms, you will have the best possible accuracy while crouching, not moving and using IronSights. Perks and ammo will not improve that.
  • Trigger Discipline is only useful for Run’n'Gun players(or characters that otherwise have a lot of penalties), Fast Shot is FAR more useful for careful sniper characters that usually crouch and aren't moving.
  • Shotgun slugs are less useful then expected. The Sawed-Off for example has a WSp of 7(!) which is not reduced in any way by using slugs, so that makes it incredibly hard to hit anything with a slug over a moderate distance, since you fire only 1(2) projectile instead of 7(14). Slugs are only useful at very very close range(or with more accurate shotguns).
  • With the default values there is always a minimal amount of spread (fMinGunSpreadValue). It’s a nice touch for immersion, since it prevents the player’s weapon and scope to become completely static.




2. Spread in-game
Now the spread numbers are only arbitrary values and were fairly easy to figure out. We went one step further and calculated the actual degrees of deviation that spread causes.
These are approximations and may not be 100.00% correct, since we had little to work with here, however we did plenty of tests and these numbers fit into the calculations:

PSp was actually surprisingly straight forward:
1.00 PSp = 5.955 degrees of deviation.

WSp however not at all because it didn’t follow a straight linear progression. Ultimately the following formula fit the debug values for different weaponspreads
1.00 WSp = ((0.0125 * WeaponSpread2) + (0.125 * WeaponSpread)) * 5.955

TotalDeviationDegree = (PlayerSpread + ((0.0125 * WeaponSpread2) + (0.125 * WeaponSpread)) ) * 5.955

What’s noteworthy:
  • PSp actually causes a much bigger degree in deviation than an equal number of WSp. So 2 PSp is a much bigger penalty to the players accuracy than 2 WSp.
  • However most of the time players, especially those that use automatic weapons and shotguns, have alot higher WSp than PSp. In those cases a weapon's Min Spread will be a way bigger factor in your overall accuracy than anything else.




3. Testing Methods
The PSp again was actually fairly easy to figure out, thanks to the fact that in the default settings the scope sway follows exactly the player’s hand sway.
All we had to do was record all the extremes of the scope sway, then we could simply calculate the diameter of the sway circle with 3 xy coordinates via the following formula (where getAngle X is Y and getAngle Z is x)

A + B(-x1) + C(-y1) = -(x12 + y12)
A + B(-x2) + C(-y2) = -(x22 + y22)
A + B(-x3) + C(-y3) = -(x32 + y32)
xm = B/2, ym = C/2, and r2 = xm2 + ym2 - A


If you want to try this yourself you can simply write a script that records player.getAngle X and player.getAngle Z, while you are using a scope, have it record the 3 extreme points it will find during a 20 second duration) and input them into a circle calculator.

What initially threw us off was that no matter what gamesettings we changed, the sway wouldnt alter one bit. That was because we were using the old calculation from FO3 and eventually realized they didn’t do anything at all. We then found the new spread GMSTs, and their effect was immidiately apparent.
Calculating the PSp is fairly trivial since FNV uses a much much more straight forward calculation (that makes a lot more sense too) than what was used in FO3.
In the end all we had to do was input various test circles into a spreadsheet and the common multiplier of 5.955 for the spread values became very apparent.

Like mentioned the degrees of deviation caused by Weapon Spread were far more tricky to find out, since weapon spread doesn’t cause any kind of sway.
In this case what we did was build a test room with a shooting range. Our test methods were fairly...brute force. We created a circle in the center of the HUD that we could expand and contract manually. Then we fired thousands of rounds into a wall and contracted the circle to fit the shot impacts, then we would use the diameters of those circles in our weapon spread calculations. It became quickly apparent that the deviation wasn’t a linear progression as it was for player spread, ie 4 MinSpread didn’t have twice the deviation of 2 MinSpread.
In this case we simply had to rely on a lot of trial and error and approximations until we reached the above mentioned formula for WeaponSpread deviation.

And that concludes our explanation of Spread. Hope these findings will prove helpful to people out there.
User avatar
Nikki Morse
 
Posts: 3494
Joined: Fri Aug 25, 2006 12:08 pm

Post » Sun Aug 08, 2010 6:11 pm

I'm surprised you didn't include fWobbleToSkillConversion in the calculation. Was this simply overlooked? It's an interesting read nonetheless. Brute force FTW! (Although comparing projectile angle to player angle may have been a little easier.)
User avatar
Jennie Skeletons
 
Posts: 3452
Joined: Wed Jun 21, 2006 8:21 am

Post » Sun Aug 08, 2010 10:14 pm

I'm surprised you didn't include fWobbleToSkillConversion in the calculation. Was this simply overlooked? It's an interesting read nonetheless. Brute force FTW! (Although comparing projectile angle to player angle may have been a little easier.)

That was overlooked, added it in now, thanks.
Do you mean calling GetHeadingAngle on the projectiles?
User avatar
Darrell Fawcett
 
Posts: 3336
Joined: Tue May 22, 2007 12:16 am

Post » Sun Aug 08, 2010 8:12 am

Woo, this is a good read.
User avatar
Jessica Phoenix
 
Posts: 3420
Joined: Sat Jun 24, 2006 8:49 am

Post » Sun Aug 08, 2010 1:03 pm

Very interesting information, Kai. Good work! Too bad the amount of sway caused by being under the weapon requirements isn't moddable:/

Ammo effecting Player Spread has to be a bug. I hope they fix it in the next patch.

Looks like you could make it so player skill has a much bigger effect on weapon sway by increasing fWobbleToSkillConversion to 0.9 or so while giving a perk to multiply player spread by five. You'd wind up with the same spread/sway at 100 skill, but at 0 skill you'd have 5 times as much sway. Unfortunately, perks don't effect NPCs, so that would only impact the player:/ Perks not doing anything to NPCs is a bug, though, so hopefully they'll also fix that in the patch.
User avatar
Sarah Knight
 
Posts: 3416
Joined: Mon Jun 19, 2006 5:02 am

Post » Sun Aug 08, 2010 8:59 pm

I guess this explains why with Big Boomer and slugs I had to be right on the guys butt to get a sneak critical. The fact that I couldn't hit anything unless I was right in their face and in the G.E.C.K. they missed a setting that doesn't allow you to get your Hulls back I had to just give up on my character. I ran out of ammo so quick and just gave up on going to all the vendors trying to buy them.
User avatar
Alister Scott
 
Posts: 3441
Joined: Sun Jul 29, 2007 2:56 am

Post » Sun Aug 08, 2010 10:03 pm

Assuming the PSp formula is correct, then If a player's skill is 100, playerspread = 0 regardless of ALL other factors, so standing or crouching, moving or not should have 0 effect on accuracy when one's skill is at 100. From my time in game, this does not appear to be the case. With 100 guns, I get more sway when standing and running than while sitting still and crouching (negligible if any). Also, if a player's skill is over 100, for example through mods, then playerspread would end up being a negative, where magnitude should increase if the player is suffering from heavy penalties. This seems like it should be wrong, but right now, I don't know how I could check.
User avatar
Zualett
 
Posts: 3567
Joined: Mon Aug 20, 2007 6:36 pm

Post » Sun Aug 08, 2010 7:03 pm

If player skill is 100, then
1.00 - Player Skill/100 * fWobbleToSkillConversion = 1 - 1*0.5 = 0.5, not 0. So at 100 skill, all your current penalties are reduced by 50%.

Skill is capped between 0 and 100, so 150 => 100, -50 => 0 (though I don't think we tested negative values, but we did test values >100).
User avatar
Josh Trembly
 
Posts: 3381
Joined: Fri Nov 02, 2007 9:25 am

Post » Sun Aug 08, 2010 4:29 pm

Hey - thanks for going to all that trouble for this. Just wondering about the effect of weapon mods that decrease spread. The formula you've got there says:

WeaponSpread = WeaponMods * WeaponMinSpread


For the (vanilla) 10mm Pistol, the laser sight 'decrease spread' mod effect is 0.4000, which going by the above formula (if I'm understanding it correctly) would suggest that a 10mm Pistol with a laser sight would have 40% of the weapon spread of a 10mm Pistol without a laser sight. That sort of makes sense as a value Obsidian may have chosen. However, the Minigun's Damped Subframe 'decrease spread' mod effect is 1.0000, which would suggest that that weapon mod does nothing.

When I first checked out these weapons, I just assumed that the decrease spread values for mods were simply subtracted from the min. spread of the weapon; just because that seemed like it would make sense based on the values the 10mm Pistol and Minigun (and 10mm SMG) have:

10mm Pistol:
0.8 - 0.4 = 0.4

10mm SMG:
4.0 - 1.0 = 3.0

Minigun:
2.3 - 1.0 = 1.3


I haven't done any tests or anything. Just... wondering.


Edit: Forgot that the 10mm SMG also has a mod that decreases spread. It's 'decrease spread' mod also has an effect value of 1.0000.
User avatar
Amie Mccubbing
 
Posts: 3497
Joined: Thu Aug 31, 2006 11:33 pm

Post » Sun Aug 08, 2010 2:55 pm

You're right, I also think that the value in the weapon mod data is subtracted from the weapon min spread rather than multiplied

I doubt that it was really meant as multiplication (though I know it says * :)) more like

WeaponSpread = WeaponModsModifierFunc(weaponMinSpread)

The same goes for PlayerSpread = Perks * ... where Perks also is more than a simple factor.

A more accurate definition would more be something like..

Function for single weapon mod:
ModFunc(m, x) = x - m

The list of active modifiers (real numbers):
M = [m_1, m_2,... m_n]

WeaponSpread = ModFunc(m_n, ModFunc(m_n-1, ... ModFunc(m_1, weaponMinSpread) ... ))

Though I don't know if you even can have multiple weapon mods that modify spread at once, just didn't want to give the example for Perks since that would've been far more tedious :)

Edit:
But anyway, I have to admit that we didn't really test the role of weapon mods to great depths. The reason for this is that we didn't just do this for research, but for a mod we are working on that required us to calculate the exact spread value in a script. But as long as there are no getWeaponModXType and getWeaponModXValue, we can't really factor in weapon mod spread modifiers.
User avatar
Liii BLATES
 
Posts: 3423
Joined: Tue Aug 22, 2006 10:41 am

Post » Sun Aug 08, 2010 10:11 pm

Ugh, maths... my poor head. Well, I guess I was warned. ;)

I think I understood the important part, anyway; thanks.
User avatar
Breanna Van Dijk
 
Posts: 3384
Joined: Mon Mar 12, 2007 2:18 pm

Post » Sun Aug 08, 2010 9:04 pm

Actually yeah weaponmods are a simple addition/substraction, had a brainfart there, is fixed now.
User avatar
Kay O'Hara
 
Posts: 3366
Joined: Sun Jan 14, 2007 8:04 pm

Post » Sun Aug 08, 2010 7:24 pm

What about the drug "Steady"? I didn't see it / chems listed in the OP (forgive me if I missed it).

Based on how everything else works, I'm guessing it impacts PSp and not WSp... is that in fact the case?
User avatar
MARLON JOHNSON
 
Posts: 3377
Joined: Sun May 20, 2007 7:12 pm

Post » Sun Aug 08, 2010 4:40 pm

What about the drug "Steady"? I didn't see it / chems listed in the OP (forgive me if I missed it).

Based on how everything else works, I'm guessing it impacts PSp and not WSp... is that in fact the case?

I would think so, probably modifies the same entry point as the perks. Will take a look once I get home.
User avatar
sharon
 
Posts: 3449
Joined: Wed Nov 22, 2006 4:59 am

Post » Sun Aug 08, 2010 8:40 pm

I would think so, probably modifies the same entry point as the perks. Will take a look once I get home.

Agreed that that makes sense.


Awesome job on all of this, by the way. :)
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Sun Aug 08, 2010 2:13 pm

I would think so, probably modifies the same entry point as the perks. Will take a look once I get home.

Yes, steady adds the NVSteadyChemPerk while its active, which multiplies player spread by 0.
User avatar
Cartoon
 
Posts: 3350
Joined: Mon Jun 25, 2007 4:31 pm

Post » Sun Aug 08, 2010 9:48 pm

wow thorough testing and good explanation :) ... one can nearly feel the hours of work behind this.

Thank you, its much apprechiated!
User avatar
Sarah Bishop
 
Posts: 3387
Joined: Wed Oct 04, 2006 9:59 pm

Post » Sun Aug 08, 2010 9:34 am

Scientastic! As a long time weapons modding geek in various games, I truly appreciate this!
User avatar
CxvIII
 
Posts: 3329
Joined: Wed Sep 06, 2006 10:35 pm

Post » Sun Aug 08, 2010 6:39 pm

Wow next semester when I get intro to game-making, I'll half-way comprehend what you just explained.
User avatar
Causon-Chambers
 
Posts: 3503
Joined: Sun Oct 15, 2006 11:47 pm

Post » Sun Aug 08, 2010 3:12 pm

since UnaimedPenalty = UnaimedSpreadPenalty * isUsingIronSights, wouldnt this mean that player spread is actually greater when using ironsights than when not? looks like unaimed penalty actually goes up rather than down when using ironsights. please forgive me if i didnt understand the math. part of the reason i chose my profession was to avoid it :D
User avatar
Wayne W
 
Posts: 3482
Joined: Sun Jun 17, 2007 5:49 am

Post » Sun Aug 08, 2010 10:18 pm

since UnaimedPenalty = UnaimedSpreadPenalty * isUsingIronSights, wouldnt this mean that player spread is actually greater when using ironsights than when not? looks like unaimed penalty actually goes up rather than down when using ironsights. please forgive me if i didnt understand the math. part of the reason i chose my profession was to avoid it :D

You are right of course, good catch :)
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Sun Aug 08, 2010 10:16 am

yet, fiddling around with different, and quite high, settings for fWobbletoskill conversion, skill reqs and gunspreadskill*, i am able to get wobble out of ironsights that largely disappears upon using ironsights. i havent found a setting that actually causes much change to wobble in ironsights (without penalties)
User avatar
Mike Plumley
 
Posts: 3392
Joined: Wed Sep 05, 2007 10:45 pm

Post » Sun Aug 08, 2010 4:06 pm

since UnaimedPenalty = UnaimedSpreadPenalty * isUsingIronSights, wouldnt this mean that player spread is actually greater when using ironsights than when not? looks like unaimed penalty actually goes up rather than down when using ironsights. please forgive me if i didnt understand the math. part of the reason i chose my profession was to avoid it :D


isUsingIronSights is 0 when the player is using iron sights and 1 when they are not. (isUsingIronSights isn't the actual in-game name of whatever controls this - that's just shorthand to let you know it depends upon if the player is using iron sights or not)
User avatar
Nicole Coucopoulos
 
Posts: 3484
Joined: Fri Feb 23, 2007 4:09 am

Post » Sun Aug 08, 2010 10:18 pm

thanks Langy. i thought that could be it but i didnt want to put that thought forward and expose my ignorance even more. done enough of that as it is :P
User avatar
Jessie Rae Brouillette
 
Posts: 3469
Joined: Mon Dec 11, 2006 9:50 am

Post » Sun Aug 08, 2010 8:23 am

EDIT: I see; the order of operations on some of the OP's formulas is misleading... At least it was for me. (My bad). If one is aiming (ironsights), crouching, meets the skill/str req for the weapon, and has both arms in a non-crippled state, then because one of the multipliers is zero, all other considerations are moot -- this is also why Norbingel can't get spread to carry over into ironsights. Basically, crouched+ironsights gives you a skill of 100, unless you're under a skillreq for using the weapon. This is bothersome to me, but scriptable for the player. The engine, however, really should have included a skill (or raw) "base" in addition to penalties, to go into the same brackets as the penalties, preventing that from reaching zero and cancelling everything else (like skill) out.

I've done some testing of these settings, myself, and I don't know if the game version change is responsible, but some simply aren't as reported at all.

I was quite excited to see the wobble skill conversion in there, and so I did some testing and only ended up scratching my head: no effects at all by changing the value, even to extreme amounts, *except* that within the range of 0.0 - 1.0, the expected 6-degree shift did occur from skill ranges 0 - 100 (negatively).

But here's my frustration, and I've found this to be the case with several other values in gamesetting calculations that matter to me: when the GMST is negative, the *exact* expected result occurs. For example, at a setting of -5, the spread *increases* by about 30 degrees from a guns skill of 0 to a guns skill of 100. Of course, this is exactly what we don't want; we want the reverse. And the reverse does not happen, as I said: at a setting of 5.0 (positive), there is a very minor shift (about 6 degrees) from a guns skill of 0 - 100. In previous (FO3) calculations, this would have pointed to another variable, like a base or mult...

The UnaimedSpreadPenalty also does nothing. Setting it to 100, for example, give me no noticeable change in spread.

Ditto for several other settings. This applies both to GECK changes and ingame console-based NVSE setnumericgamesetting changes.

On the other hand, fnonattackgunwobblemult, which isn't included in your calculations, does exactly as your calculation would predict, including large numbers.
User avatar
Lisha Boo
 
Posts: 3378
Joined: Fri Aug 18, 2006 2:56 pm

Next

Return to Fallout: New Vegas

cron