I wrote a detailed explanation of deviation in the Rcon forums. Here it is:
There is very little documentation on how deviation is calculated and many online sources have been found to be outdated or incorrect. As such, the following is being provided as an open source of information for anyone interested in handheld weapon deviation. I believe the information up to date and accurate. If there are any discrepancies, please let me know.
Deviation Calculation:
Important: the mindev value is not the minimum deviation of the weapon even though it is named as such. The mindev is actually a multiplier of the stance and mod zoom and all three of numbers, multiplied together, is the actual minimum deviation of the weapon.
Minimum Deviation = minDev * Stance * ModZoom(if zoomed)
Max Fire Deviation = minDev + FireDev * Stance * ModZoom(if zoomed)
Max Turn Deviation = minDev + TurnDev * Stance * ModZoom(if zoomed)
Max Speed Deviation = minDev + SpeedDev * Stance * ModZoom(if zoomed)
If you are firing and moving, add the results of max fire with the results of max speed.
[minDev + FireDev * Stance * ModZoom(if zoomed)] + [minDev + SpeedDev * Stance * ModZoom(if zoomed)]
Recoil is added after all other calculations are complete. For example, if a player is simultaneously firing, turning, and walking, the calculation is:
(minDev + FireDev * ModStand + ModZoom) + (minDev + TurnDev * ModStand * ModZoom) (minDev + SpeedDev * ModStand * ModZoom) + recoilForceUp + recoilForceLeftRight * zoomModifier
Calculation spreadsheet:
This is a spreadsheet I used to auto-calculate values.
http://www.filefactory.com/file/5b0d31/ ... iation_ods]
Explanation of Values:
Below are the major components of weapon deviation as they look in the .tweak files, followed by an explanation of what each code does and what the the numbers represent.
rem ---BeginComp:SoldierBasedRecoilComp ---
rem 556 Standard Recoil Assault Rifle
ObjectTemplate.createComponent SoldierBasedRecoilComp
ObjectTemplate.recoil.hasRecoilForce 1
ObjectTemplate.recoil.recoilForceUp CRD_UNIFORM/1.6/1.8/0
ObjectTemplate.recoil.recoilForceLeftRight CRD_UNIFORM/-0.1/-0.3/0
ObjectTemplate.recoil.zoomModifier 0.6
ObjectTemplate.recoil.goBackOnRecoil 1
rem ---EndComp ---
rem ---BeginComp:SoldierDeviationComp ---
rem 556 Optical Sight Standard Accuracy Assault Rifle
ObjectTemplate.createComponent SoldierDeviationComp
ObjectTemplate.deviation.minDev .25
ObjectTemplate.deviation.setFireDev 1.5 1.5 .05
ObjectTemplate.deviation.setTurnDev 3 .225 .225 .075
ObjectTemplate.deviation.setSpeedDev 1.5 1.5 1.5 .02
ObjectTemplate.deviation.setMiscDev 5 5 .05
ObjectTemplate.deviation.devModStand 1.3
ObjectTemplate.deviation.devModCrouch 1.2
ObjectTemplate.deviation.devModLie 1
ObjectTemplate.deviation.devModZoom .4
rem ---EndComp ---
rem ---BeginComp
efaultAnimationComp ---
ObjectTemplate.createComponent DefaultAnimationComp
ObjectTemplate.animation.useShiftAnimation 1
ObjectTemplate.animation.shiftDelay .1
rem ---EndComp ---
rem ---BeginComp
efaultZoomComp ---
ObjectTemplate.createComponent DefaultZoomComp
ObjectTemplate.zoom.zoomDelay 1
ObjectTemplate.zoom.changeFovDelay 1
ObjectTemplate.zoom.zoomLod 1
ObjectTemplate.zoom.addZoomFactor 0
ObjectTemplate.zoom.addZoomFactor 0.25
ObjectTemplate.zoom.disableMuzzleWhenZoomed 1
rem ---EndComp ---
ObjectTemplate.deviation.minDev .25
Although titled "mindev", this is not the minimum deviation of the weapon. This number is multiplied by the stance then multiplied by the zoom (if zoomed) to determine the actual minimum deviation a weapon has when not moving, turning or firing.
ObjectTemplate.deviation.setFireDev 1.5 1.5 .05
Deviation while firing. The first number is the maximum deviation regardless of how many shots are fired. The second number is added deviation per shot after the first shot. The third number is reduced deviation per each server frame (server = 30fps).
ObjectTemplate.deviation.setTurnDev 3 .225 .225 .075
Deviation when turning your mouse. The first number is the maximum deviation possible. The second number is added deviation per degree of horizontal turn. The third number is added deviation per degree of vertical turn. The fourth number is reduced deviation per server frame (server = 30fps).
ObjectTemplate.deviation.setSpeedDev 1.5 1.5 1.5 .02
Deviation when moving (walking). The first number is the maximum deviation possible. The second number is added deviation per forward movement. The third number is added deviation per strafe movement. The fourth number is reduced deviation per server frame (server = 30fps).
ObjectTemplate.deviation.setMiscDev 5 5 .05
Deviation while jumping. The first number is maximum deviation possible. The second number is added deviation per jump. The third number is deviation reduction per server frame. (server = 30fps).
ObjectTemplate.deviation.devModStand 1.3
Deviation when standing. This is a multiplier of the mindev.
ObjectTemplate.deviation.devModCrouch 1.2
Deviation while crouching. This is a multiplier of the mindev.
ObjectTemplate.deviation.devModLie 1
Deviation while laying prone. This is a multiplier of the mindev.
ObjectTemplate.deviation.devModZoom .4
Deviation multiplier when zoomed.
ObjectTemplate.recoil.recoilForceUp CRD_UNIFORM/1.6/1.8/0
Determines how much up/down movement the weapon will have after each shot. The first two numbers represent the range of movement; positive numbers are up movement, and negative numbers are down movement. The third number is an exponential/bell curve graph selector, and unless you know what you're doing, leave this number as 0 which causes recoil to return a random value between the first and second number. A more detailed of these variables can be found here:
MDT - CRD Argument Type.
Note*: If a second bullet is fired before the first bullet's recoil movement can be completed, the recoil calculation will begin again, starting with the second bullet, third bullet, etc.
ObjectTemplate.recoil.recoilForceLeftRight CRD_UNIFORM/-0.1/-0.3/0
Determines how much left movement the weapon will have after each shot. The first two numbers represent the range of movement and unlike the up/down values, positive numbers are always left movement and negative numbers are always right movement as long as the third number remains 0. The third number is an exponential/bell curve graph selector. For more info, see
MDT - CRD Argument Type.
ObjectTemplate.recoil.zoomModifier 0.6
How much recoil is reduced when zoomed. This number is multiplied by the ForceUP and LeftRight modifiers.
ObjectTemplate.recoil.goBackOnRecoil 1
Determines whether or not the weapon will return to its original position after recoil movement is complete; a basic true/false value.
ObjectTemplate.animation.useShiftAnimation 1
Determines whether or not the weapon uses shift animations; a true/false value.
ObjectTemplate.animation.shiftDelay .1
Determines how often each mouse click will result in the weapon being fired. A value of .1 will only allow the weapon to be fired about 4-5 times per second, preventing rifles/pistol triggers from being fired rapidly. This does not affect the weapon's full auto/three-shot rate of fire.
ObjectTemplate.zoom.zoomDelay 1
Delay in seconds the weapon will switch to the next zoom level after the zoom key is pressed.
ObjectTemplate.zoom.changeFovDelay 1
Delay in seconds the field of view will wait before switching to the zoom field of view. This value should match the zoomDelay. If there is no FovDelay, and upon the zoom key being pressed, your field of view will rush towards you, creating a vertigo effect.
ObjectTemplate.zoom.addZoomFactor 0
First zoom level, used when not zoomed.
ObjectTemplate.zoom.addZoomFactor 0.25
Second zoom level, used when the zoom key is pressed for the first time. Multiple zoom levels can be added by adding additional zoom factors. Lower numbers equal a better zoom (i.e. .25 = 4x zoom).
Tracking:
Weapon tracking (the ability to follow your target across the battlefield with minimal/no loss of accuracy) is tricky. In general, the TurnDev value should be no more than a factor of 3 to 4 times the reduction rate. For example:
ObjectTemplate.deviation.setTurnDev 3 .225 .225 .075 (where .225 is 3x greater than .075). A factor of 3 will easily allow you to track a fast moving target at 50 meters, where as a factor of 4 will make it slightly more difficult. A factor of 10 will make it impossible to hit the target until the target stops.