Difference between revisions of "Gun Spread Formula"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>SnakeChomp
(Add fGunWobbleMultScope setting information)
imported>DomFada
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=== Variables ===
__NOTOC__


;fGunSpreadSkillBase = SB
Spread = PerkModifiers(IronSightsBonus * CrouchBonus * (ConditionPenalty + SkillBonus) * (WalkPenalty + RunPenalty) + ArmPenalty)
:Default 0.5


;fGunSpreadSkillMult = SM
'''PerkModifiers''' is a function that modifies the input value using any perks active on the actor that have a "Calculate Gun Spread" [[Entry Point]] and returns the result.
:Default -0.0050


;Actor skill with the given weapon = S
'''IronSightsBonus''' = fGunSpreadIronSightsBase + fGunSpreadIronSightsMult * ''IsUsingIronSights''


;fGunSpreadIronSightsBase = ISB
'''CrouchBonus''' = fGunSpreadCrouchBase + fGunSpreadCrouchMult * ''IsSneaking''
:Default 1


;fGunSpreadIronSightsMult = ISM
'''ConditionPenalty''' = fGunSpreadCondBase + fGunSpreadCondMult * ''WeaponCondition''
:Default -0.65
:This value is 0 unless aiming with iron sights (holding the right mouse button with the default control scheme)


;fGunSpreadWalkBase = WB
'''SkillBonus''' = fGunSpreadSkillBase + fGunSpreadSkillMult * ''ActorSkillValue''
:Default 1
:This value is 0 when running, but applies when stationary or walking


;fGunSpreadWalkMult = WM
'''WalkPenalty''' = fGunSpreadWalkBase * !''IsRunning'' + fGunSpreadWalkMult * ''IsWalking''
:Default 0
:!''IsRunning'' means that if ''IsRunning'' is 1, !''IsRunning'' is 0, and vice versa.
:This value is non zero only when walking


;fGunSpreadRunBase = RB
'''RunPenalty''' = (fGunSpreadRunBase + fGunSpreadRunMult) * ''IsRunning''
:Default 1
:This value is non zero only when running


;fGunSpreadRunMult = RM
'''ArmPenalty''' = fGunSpreadArmBase + fGunSpreadArmMult * ''ArmCondition''
:Default 0
:This value is non zero only when running


;fGunSpreadCrouchBase = CrB
:Default 1


;fGunSpreadCrouchMult = CrM
''IsUsingIronSights'' is 1 if the actor is aiming with iron sights and 0 otherwise, but there is no function by this name.
:Default -0.4
:This value is 0 unless the actor is crouched (sneaking)


;fGunSpreadArmBase = AB
''IsSneaking'' is the [[IsSneaking]] function.
:Default 0.5


;fGunSpreadArmMult = AM
''WeaponCondition'' is the condition of the weapon equipped by the actor.
:Default -0.5
:This value is 1.0 at 100%, 0.5 at 50% and 0.0 at 0%


;Actor arm condition = AC
''ActorSkillValue'' is the actor's skill value for the skill used by the weapon.
:1 at 100% condition, 0 when crippled
:The skill value used is specified on the [[Weapons|weapon form]]


;fGunSpreadCondBase = CB
''IsRunning'' is the [[IsRunning]] function.
:Default 0


;fGunSpreadCondMult = CM
''IsWalking'' is 1 if the actor is walking and 0 otherwise, but there is no function by this name.
:Default 0


;Any perks that affect gun spread = PerkModifiers(x) => y
''ArmCondition'' is the condition of the actor's arm.
:*When using a one handed weapon, ''ArmCondition'' is 1 with a healthy right arm and 0 with a crippled right arm.
:*When using a two handed weapon, ''ArmCondition'' is 1 with both arms healthy, 0.5 with 1 arm crippled, 0 with two arms crippled.


;The weapon's "min spread" value from the [[Weapons|weapon form]] = MinS
=== Game settings used by this formula ===


=== Formula ===
{{SettingGroupHeader}}
  Gun Spread = Max( MinS, PerkModifiers((AB + AC * AM) + (ISB + ISM) * (CrB + CrM) * (CB + C * CM + SB + S * SM) * (WB + WM + RB + RM)) )
{{SettingGroupSetting
|Name = fGunSpreadIronSightsBase
|Default = 1
|Description = Used when calculating ''IronSightsBonus''
}}
{{SettingGroupSetting
|Name = fGunSpreadIronSightsMult
|Default = -0.65
|Description = Used when calculating ''IronSightsBonus''
}}
{{SettingGroupSetting
|Name = fGunSpreadCrouchBase
|Default = 1
|Description = Used when calculating ''CrouchBonus''
}}
{{SettingGroupSetting
|Name = fGunSpreadCrouchMult
|Default = -0.4
|Description = Used when calculating ''CrouchBonus''
}}
{{SettingGroupSetting
|Name = fGunSpreadCondBase
|Default = 0
|Description = Used when calculating ''ConditionPenalty''
}}
{{SettingGroupSetting
|Name = fGunSpreadCondMult
|Default = 0
|Description = Used when calculating ''ConditionPenalty''
}}
{{SettingGroupSetting
|Name = fGunSpreadSkillBase
|Default = 0.5
|Description = Used when calculating ''SkillBonus''
}}
{{SettingGroupSetting
|Name = fGunSpreadSkillMult
|Default = -0.0050
|Description = Used when calculating ''SkillBonus''
}}
{{SettingGroupSetting
|Name = fGunSpreadWalkBase
|Default = 1
|Description = Used when calculating ''WalkPenalty''
}}
{{SettingGroupSetting
|Name = fGunSpreadWalkMult
|Default = 0
|Description = Used when calculating ''WalkPenalty''
}}
{{SettingGroupSetting
|Name = fGunSpreadRunBase
|Default = 1
|Description = Used when calculating ''RunPenalty''
}}
{{SettingGroupSetting
|Name = fGunSpreadRunMult
|Default = 0
|Description = Used when calculating ''RunPenalty''
}}
{{SettingGroupSetting
|Name = fGunSpreadArmBase
|Default = 0.5
|Description = Used when calculating ''ArmPenalty''
}}
{{SettingGroupSetting
|Name = fGunSpreadArmMult
|Default = -0.5
|Description = Used when calculating ''ArmPenalty''
}}
{{SettingGroupFooter}}


=== Formula notes ===
=== Second spread formula ===
Most weapons have a non zero min spread value. Therefore, no matter how skilled you are with the weapon and what perks you have, your weapon will always have a slight amount of spread. One notable exception to this are sniper rifles, which have 0 minimum spread.


The default value of 1 for WB is important in this formula. Without it, the (WB + WM + RB + RM) factor would be 0 when not moving, meaning you would never have any gun spread while stationary.
Use of an additional formula for the gun's own spread has been suggested, taking into account the role of Min. Spread and Spread. Until it's been validated and this page changed, see the "Discussion" page for details.


=== Minimum Spread ===
The gun spread value used by the game engine will never be less than the "Min Spread" value specified on the [[Weapons|weapon form]] for the equipped weapon. If the value given by the formula is less than the "Min Spread" value, the value from the formula will be ignored and the "Min Spread" value for the weapon will be used instead.
Most weapons have a non zero value for "Min Spread". Therefore, no matter how skilled you are with the weapon or what perks you have, your weapon will always have a slight amount of spread. One notable exception to this are sniper rifles, which have 0 minimum spread, allowing weapon spread to be eliminated with a small guns skill of 100.  The laser pistol and rifle also have 0 min spread.
=== Notes ===
This formula has been derived by systematically tweaking the settings using the console and observing the effects on the magnitude of weapon sway.
This formula has been derived by systematically tweaking the settings using the console and observing the effects on the magnitude of weapon sway.


=== Other notable settings ===
Spread is also taken into account when determining VATS accuracy, and is the primary way that weapon skill affects VATS accuracy.
;fGunWobbleMultScope
 
:Default 1
The default value of 1 for fGunSpreadWalkBase is important in this formula. Without it, the (WalkPenalty + RunPenalty) part of the equation would be 0 when not moving, negating the other spread calculations.
:This setting controls how much scoped weapons will wobble when aiming with the scope, but '''it does not modify the weapon spread.''' If you modify some game settings to give the sniper rifle considerable wobble and set this setting to 0, the cross hairs will not wobble when you use the scope, but the bullets will still fly off course. Because of this, you should avoid modifying this setting, or else you will confuse players.
 
The "spread" value on the [[Weapons|weapon form]] is ignored by the game engine. Only the "min spread" value is used.


=== Variables not used by this formula ===
=== Game settings not used by this formula ===
These are variables that should logically have an impact on this formula but do not appear to have any effect on the player character's gun spread when tweaked. Further research into these settings should be performed. Perhaps they only effect NPC gun spread?
These are variables that should logically have an impact on this formula but do not appear to have any effect on the player character's gun spread when tweaked. Further research into these settings should be performed. Perhaps they only effect NPC gun spread?


Line 81: Line 141:
*fGunSpreadNPCArmMult
*fGunSpreadNPCArmMult
*fNPCMaxGunWobbleAngle
*fNPCMaxGunWobbleAngle
=== Other notable game settings ===
;fGunWobbleMultScope
:Default value: 1.0
:This setting controls how much scoped weapons will wobble when aiming with the scope, but '''it does not modify the weapon spread.''' If you modify some game settings to give the sniper rifle considerable wobble and set this setting to 0, the cross hairs will not wobble when you use the scope, but the bullets will still fly off course because the gun is still wobbling (you just don't notice it anymore). Because of this, you should avoid modifying this setting, or else you will confuse players.

Latest revision as of 19:41, 11 November 2009


Spread = PerkModifiers(IronSightsBonus * CrouchBonus * (ConditionPenalty + SkillBonus) * (WalkPenalty + RunPenalty) + ArmPenalty)

PerkModifiers is a function that modifies the input value using any perks active on the actor that have a "Calculate Gun Spread" Entry Point and returns the result.

IronSightsBonus = fGunSpreadIronSightsBase + fGunSpreadIronSightsMult * IsUsingIronSights

CrouchBonus = fGunSpreadCrouchBase + fGunSpreadCrouchMult * IsSneaking

ConditionPenalty = fGunSpreadCondBase + fGunSpreadCondMult * WeaponCondition

SkillBonus = fGunSpreadSkillBase + fGunSpreadSkillMult * ActorSkillValue

WalkPenalty = fGunSpreadWalkBase * !IsRunning + fGunSpreadWalkMult * IsWalking

!IsRunning means that if IsRunning is 1, !IsRunning is 0, and vice versa.

RunPenalty = (fGunSpreadRunBase + fGunSpreadRunMult) * IsRunning

ArmPenalty = fGunSpreadArmBase + fGunSpreadArmMult * ArmCondition


IsUsingIronSights is 1 if the actor is aiming with iron sights and 0 otherwise, but there is no function by this name.

IsSneaking is the IsSneaking function.

WeaponCondition is the condition of the weapon equipped by the actor.

This value is 1.0 at 100%, 0.5 at 50% and 0.0 at 0%

ActorSkillValue is the actor's skill value for the skill used by the weapon.

The skill value used is specified on the weapon form

IsRunning is the IsRunning function.

IsWalking is 1 if the actor is walking and 0 otherwise, but there is no function by this name.

ArmCondition is the condition of the actor's arm.

  • When using a one handed weapon, ArmCondition is 1 with a healthy right arm and 0 with a crippled right arm.
  • When using a two handed weapon, ArmCondition is 1 with both arms healthy, 0.5 with 1 arm crippled, 0 with two arms crippled.

Game settings used by this formula[edit | edit source]

Setting Default Description
fGunSpreadIronSightsBase 1 Used when calculating IronSightsBonus
fGunSpreadIronSightsMult -0.65 Used when calculating IronSightsBonus
fGunSpreadCrouchBase 1 Used when calculating CrouchBonus
fGunSpreadCrouchMult -0.4 Used when calculating CrouchBonus
fGunSpreadCondBase 0 Used when calculating ConditionPenalty
fGunSpreadCondMult 0 Used when calculating ConditionPenalty
fGunSpreadSkillBase 0.5 Used when calculating SkillBonus
fGunSpreadSkillMult -0.0050 Used when calculating SkillBonus
fGunSpreadWalkBase 1 Used when calculating WalkPenalty
fGunSpreadWalkMult 0 Used when calculating WalkPenalty
fGunSpreadRunBase 1 Used when calculating RunPenalty
fGunSpreadRunMult 0 Used when calculating RunPenalty
fGunSpreadArmBase 0.5 Used when calculating ArmPenalty
fGunSpreadArmMult -0.5 Used when calculating ArmPenalty


Second spread formula[edit | edit source]

Use of an additional formula for the gun's own spread has been suggested, taking into account the role of Min. Spread and Spread. Until it's been validated and this page changed, see the "Discussion" page for details.

Minimum Spread[edit | edit source]

The gun spread value used by the game engine will never be less than the "Min Spread" value specified on the weapon form for the equipped weapon. If the value given by the formula is less than the "Min Spread" value, the value from the formula will be ignored and the "Min Spread" value for the weapon will be used instead.

Most weapons have a non zero value for "Min Spread". Therefore, no matter how skilled you are with the weapon or what perks you have, your weapon will always have a slight amount of spread. One notable exception to this are sniper rifles, which have 0 minimum spread, allowing weapon spread to be eliminated with a small guns skill of 100. The laser pistol and rifle also have 0 min spread.

Notes[edit | edit source]

This formula has been derived by systematically tweaking the settings using the console and observing the effects on the magnitude of weapon sway.

Spread is also taken into account when determining VATS accuracy, and is the primary way that weapon skill affects VATS accuracy.

The default value of 1 for fGunSpreadWalkBase is important in this formula. Without it, the (WalkPenalty + RunPenalty) part of the equation would be 0 when not moving, negating the other spread calculations.

The "spread" value on the weapon form is ignored by the game engine. Only the "min spread" value is used.

Game settings not used by this formula[edit | edit source]

These are variables that should logically have an impact on this formula but do not appear to have any effect on the player character's gun spread when tweaked. Further research into these settings should be performed. Perhaps they only effect NPC gun spread?

  • fGunSpreadHeadMult
  • fGunSpreadHeadBase
  • fGunSpreadNPCArmBase
  • fGunSpreadNPCArmMult
  • fNPCMaxGunWobbleAngle

Other notable game settings[edit | edit source]

fGunWobbleMultScope
Default value: 1.0
This setting controls how much scoped weapons will wobble when aiming with the scope, but it does not modify the weapon spread. If you modify some game settings to give the sniper rifle considerable wobble and set this setting to 0, the cross hairs will not wobble when you use the scope, but the bullets will still fly off course because the gun is still wobbling (you just don't notice it anymore). Because of this, you should avoid modifying this setting, or else you will confuse players.