Difference between revisions of "User:Quetzilla/Spread Formula Test"

From GECK

(Variables Old Formatting: Trying out a slightly different style)
(reverting to original as changes have been implented in the actual page)
 
Line 3: Line 3:
  
 
First, the game calculates a preliminary value based on game settings:
 
First, the game calculates a preliminary value based on game settings:
 
+
  PreliminarySpread = (IronSightFactor * CrouchFactor * (ConditionFactor + SkillFactor) * (WalkFactor + RunFactor)) + ArmPenalty
----
+
Trying out two styles here...
+
 
+
==== Option 1====
+
  PreliminarySpread =
+
  fGunSpreadArmBase + (fGunSpreadArmMult * ''ArmCondition'') +
+
  (fGunSpreadIronSightsBase + fGunSpreadIronSightsMult) *
+
  (fGunSpreadCrouchBase + fGunSpreadCrouchMult) *
+
  (fGunSpreadCondBase + fGunSpreadCondMult * ''ConditionValue'' +
+
  fGunSpreadSkillBase + fGunSpreadSkillMult * ''SkillValue'') *
+
  (fGunSpreadWalkBase + fGunSpreadWalkMult + fGunSpreadRunBase + fGunSpreadRunMult)
+
 
+
==== Option 2 ====
+
PreliminarySpread = ArmFactor + (IronSightFactor * CrouchFactor * (ConditionFactor + SkillFactor) * (WalkFactor + RunFactor))
+
 
+
Where:
+
*''ArmFactor'' = <tt>fGunSpreadArmBase + fGunSpreadArmMult * ''ArmCondition''</tt>
+
*''IronSightsFactor'' = <tt>fGunSpreadIronSightsBase + fGunSpreadIronSightsMult</tt>
+
*''CrouchFactor'' = <tt>fGunSpreadCrouchBase + fGunSpreadCrouchMult</tt>
+
*''ConditionFactor'' = <tt>fGunSpreadCondBase + fGunSpreadCondMult * ''ConditionValue''</tt>
+
*''SkillFactor'' = <tt>fGunSpreadSkillBase + fGunSpreadSkillMult * ''SkillValue''</tt>
+
*''WalkFactor'' = <tt>fGunSpreadWalkBase + fGunSpreadWalkMult</tt>
+
*''RunFactor'' = <tt>fGunSpreadRunBase + fGunSpreadRunMult</tt>
+
 
+
 
+
----
+
 
+
  
 
Second, this value is adjusted by any perks that affect gun spread:
 
Second, this value is adjusted by any perks that affect gun spread:
Line 40: Line 13:
 
  FinalSpread = Max( ModifiedSpread, WeaponMinSpread )
 
  FinalSpread = Max( ModifiedSpread, WeaponMinSpread )
  
 
+
=== Variables ===
=== Variables New Formatting ===
+
The variables in the above formula are determined primarily by [[Settings|Game Settings]], which come in base/multiplier pairs:
I gave the definition list style a try... not sure I like it. Perhaps using a table for these would help? It would keep comments and default values aligned and consistent, maybe...
+
 
+
{| border="1"
+
|-
+
! Variable !! Value !! Notes
+
|-
+
! fGunSpreadSkillBase || 0.5
+
|-
+
! fGunSpreadSkillMult || -0.005
+
|-
+
! SkillValue || 0-100
+
| The actor's skill with the weapon's skill type
+
|-
+
! fGunSpreadIronSightsBase || 1
+
|-
+
! fGunSpreadIronSightsMult || -0.65
+
| This value is 0 unless aiming with iron sights (holding the right mouse button with the default control scheme)
+
|-
+
! fGunSpreadWalkBase || 1
+
| This value is non zero only when walking or stationary
+
|-
+
! fGunSpreadWalkMult || 0
+
| This value is non zero only when walking
+
|-
+
! fGunSpreadRunBase || 1
+
| This value is non zero only when running
+
|-
+
! fGunSpreadRunMult || 0
+
| This value is non zero only when running
+
|-
+
! fGunSpreadCrouchBase || 1
+
|-
+
! fGunSpreadCrouchMult || -0.4
+
| This value is 0 unless the actor is crouched (sneaking)
+
|-
+
! fGunSpreadArmBase || 0.5
+
|-
+
! fGunSpreadArmMult || -0.5
+
|-
+
! ArmCondition || 0 or 1
+
| 0 when crippled, 1 otherwise
+
|-
+
! fGunSpreadCondBase || 0
+
|-
+
! fGunSpreadCondMult || 0
+
|-
+
! ConditionValue || 0.0-1.0
+
| 1 with a weapon at 100% condition, 0 at 0% condition
+
|}
+
 
+
=== Variables Old Formatting ===
+
The variables in the above formula are determined primarily by [[Settings|Game Settings]].
+
  
 
'''SkillFactor''' = fGunSpreadSkillBase + (fGunSpreadSkillMult * ''SkillValue'')
 
'''SkillFactor''' = fGunSpreadSkillBase + (fGunSpreadSkillMult * ''SkillValue'')
* fGunSpreadSkillBase = '''0.5'''
+
* Base Default: '''0.5'''
* fGunSpreadSkillMult = '''-0.005'''
+
* Mult Default: '''-0.005'''
* ''SkillValue'' is the actor's skill value in the weapon's corresponding skill type.
+
* SkillValue is the actor's skill value in the weapon's corresponding skill type.
  
  
 
'''ConditionFactor''' = fGunSpreadCondBase + (fGunSpreadCondMult * ''ConditionValue'')
 
'''ConditionFactor''' = fGunSpreadCondBase + (fGunSpreadCondMult * ''ConditionValue'')
* fGunSpreadCondBase = '''0.0'''
+
* Base Default: '''0.0'''
* fGunSpreadCondMult = '''0.0'''
+
* Mult Default: '''0.0'''
* ''ConditionValue'' is the current weapon's condition level as a value between 1.0 and 0.0.
+
* Condition Value is the current weapon's condition level.
 
* The default values mean condition has no effect on gun spread unless these values are altered by mods or the user
 
* The default values mean condition has no effect on gun spread unless these values are altered by mods or the user
  
  
 
'''IronSightsFactor''' = fGunSpreadIronSightsBase + (fGunSpreadIronSightsMult * ''IsUsingIronSights'')
 
'''IronSightsFactor''' = fGunSpreadIronSightsBase + (fGunSpreadIronSightsMult * ''IsUsingIronSights'')
* fGunSpreadIronSightsBase = '''0.1'''
+
* Base Default: '''0.1'''
* fGunSpreadIronSightsMult = '''-0.65'''
+
* Mult Default: '''-0.65'''
  
  
 
'''CrouchFactor''' = fGunSpreadCrouchBase + (fGunSpreadCrouchMult * ''IsActorCrouching'')
 
'''CrouchFactor''' = fGunSpreadCrouchBase + (fGunSpreadCrouchMult * ''IsActorCrouching'')
* fGunSpreadCrouchBase = '''1.0'''
+
* Base Default: '''1.0'''
* fGunSpreadCrouchMult = '''-0.4'''
+
* Mult Default: '''-0.4'''
  
  
 
'''WalkFactor''' = fGunSpreadWalkBase + (fGunSpreadWalkMult * ''IsActorWalking'')
 
'''WalkFactor''' = fGunSpreadWalkBase + (fGunSpreadWalkMult * ''IsActorWalking'')
* fGunSpreadWalkBase = '''1.0'''
+
* Base Default: '''1.0'''
* fGunSpreadWalkMult = '''0.0'''
+
* Mult Default: '''0.0'''
  
  
 
'''RunFactor''' = fGunSpreadRunBase + (fGunSpreadRunMult * ''IsActorRunning'')
 
'''RunFactor''' = fGunSpreadRunBase + (fGunSpreadRunMult * ''IsActorRunning'')
* fGunSpreadRunBase = '''1.0'''
+
* Base Default: '''1.0'''
* fGunSpreadRunMult = '''0.0'''
+
* Mult Default: '''0.0'''
  
  
'''ArmFactor''' = fGunSpreadArmBase + (fGunSpreadArmMult * ''ArmCondition'')
+
'''CrippledArmPenalty''' = fGunSpreadArmBase + (fGunSpreadArmMult * ''ArmCondition'')
* fGunSpreadArmBase = '''0.5'''
+
* Base Default: '''0.5'''
* fGunSpreadArmMult = '''-0.5'''
+
* Mult Default: '''-0.5'''
 
* Arm Condition is 0 when the actor's arm is crippled, and 1 at all other times.
 
* Arm Condition is 0 when the actor's arm is crippled, and 1 at all other times.
  
  
'''HeadFactor''' = fGunSpreadHeadBase + (fGunSpreadHeadMult * ''HeadCondition'')
+
'''CrippledHeadPenalty''' = fGunSpreadHeadBase + (fGunSpreadHeadMult * ''HeadCondition'')
* fGunSpreadHeadBase = '''1.0'''
+
* Base Default: '''1.0'''
* fGunSpreadHeadMult = '''-1.0'''
+
* Mult Default: '''-1.0'''
 
* Head Condition is 0 when the actor's head is crippled, and 1 at all other times.
 
* Head Condition is 0 when the actor's head is crippled, and 1 at all other times.
* These settings seem to have no effect on the player's weapon spread, they may only be used for NPCs, or not used at all.
+
* Thought to be either unused, or only used for NPCs.

Latest revision as of 18:31, 28 December 2008

Formula

The following formula has been derived by testing changes to the game settings via the console and may not be completely accurate. The variables in the formula are explained in the Variables section below.

First, the game calculates a preliminary value based on game settings:

PreliminarySpread = (IronSightFactor * CrouchFactor * (ConditionFactor + SkillFactor) * (WalkFactor + RunFactor)) + ArmPenalty

Second, this value is adjusted by any perks that affect gun spread:

ModifiedSpread = PerkModifiers( PreliminarySpread )

PerkModifiers() represents a complex function, as any number of perks can affect the calculated value in complex ways, which are determined by the priority of the Perk Effects (see Perk Entry). Note that none of the Perks in the base game directly affect gun spread, but Perks added by mods can.

Finally, this value is compaed to the Min Spread value of the equipped Weapon Object, and the higher value is used:

FinalSpread = Max( ModifiedSpread, WeaponMinSpread )

Variables

The variables in the above formula are determined primarily by Game Settings, which come in base/multiplier pairs:

SkillFactor = fGunSpreadSkillBase + (fGunSpreadSkillMult * SkillValue)

  • Base Default: 0.5
  • Mult Default: -0.005
  • SkillValue is the actor's skill value in the weapon's corresponding skill type.


ConditionFactor = fGunSpreadCondBase + (fGunSpreadCondMult * ConditionValue)

  • Base Default: 0.0
  • Mult Default: 0.0
  • Condition Value is the current weapon's condition level.
  • The default values mean condition has no effect on gun spread unless these values are altered by mods or the user


IronSightsFactor = fGunSpreadIronSightsBase + (fGunSpreadIronSightsMult * IsUsingIronSights)

  • Base Default: 0.1
  • Mult Default: -0.65


CrouchFactor = fGunSpreadCrouchBase + (fGunSpreadCrouchMult * IsActorCrouching)

  • Base Default: 1.0
  • Mult Default: -0.4


WalkFactor = fGunSpreadWalkBase + (fGunSpreadWalkMult * IsActorWalking)

  • Base Default: 1.0
  • Mult Default: 0.0


RunFactor = fGunSpreadRunBase + (fGunSpreadRunMult * IsActorRunning)

  • Base Default: 1.0
  • Mult Default: 0.0


CrippledArmPenalty = fGunSpreadArmBase + (fGunSpreadArmMult * ArmCondition)

  • Base Default: 0.5
  • Mult Default: -0.5
  • Arm Condition is 0 when the actor's arm is crippled, and 1 at all other times.


CrippledHeadPenalty = fGunSpreadHeadBase + (fGunSpreadHeadMult * HeadCondition)

  • Base Default: 1.0
  • Mult Default: -1.0
  • Head Condition is 0 when the actor's head is crippled, and 1 at all other times.
  • Thought to be either unused, or only used for NPCs.
Personal tools