Page 1 of 1

[Question] about deviation

Posted: 2008-08-25 03:22
by Charity Case
So, I've been snooping around in the .tweak files trying to figure out how the deviation system works. And while I've figured out some of it, I still have a lot of questions. For instance, here's the deviation settings for the M16A4 w/ACOG:
rem ---BeginComp:SoldierDeviationComp ---
rem 556 Optical Sight Standard Accuracy Assault Rifle
ObjectTemplate.createComponent SoldierDeviationComp
ObjectTemplate.deviation.minDev 0.1
ObjectTemplate.deviation.setFireDev 0.1 0.05 0.005
ObjectTemplate.deviation.setTurnDev 0.1 0.05 0.05 0.005
ObjectTemplate.deviation.setSpeedDev 2 2 2 0.05
ObjectTemplate.deviation.setMiscDev 2 2 0.05
ObjectTemplate.deviation.devModStand 1.5
ObjectTemplate.deviation.devModCrouch 1.2
ObjectTemplate.deviation.devModLie 1.0
ObjectTemplate.deviation.devModZoom 1
rem ---EndComp ---
And here are my questions:
.minDev: Is this the absolute lowest deviation the weapon can have, the "starting" deviation which all other modifiers are applied to, or both (or something else)?
.setFireDev: I know these deviation modifiers are triggered :mrgreen: by firing, but what are the three different values for, stance?
.setTurnDev: Again, what are the different values for (I know these modifiers apply to turning/looking)?
.setSpeedDev: These modifiers deal with movement, but which kind of movement do they apply to? I'm guessing they are for crawling, crouch-walking, walking, and strafing.
.setMiscDev: I read that these modifiers apply to jumping or something. Any ideas?

I'm also wondering if anyone knows the formula used to calculate deviation and, specifically, how to determine how long one has to stand still/aim straight to achieve minimum deviation.

Thanks for reading.

Re: Questions about deviation

Posted: 2008-08-25 03:57
by nedlands1

Re: Questions about deviation

Posted: 2008-08-25 04:07
by Charity Case
Thanks nedlands, this is just what I needed :smile: .

Re: Questions about deviation

Posted: 2008-08-25 11:41
by Truism
If I'm not much mistaken,

ObjectTemplate.deviation.setTurnDev 0.1 0.05 0.05 0.005

The intermediate two variables are based on the client side frame rate, and so having a highly variable frame rate will drastically change the amount a similar movement will cause inaccuracy.

Am I wrong?

Re: Questions about deviation

Posted: 2008-08-25 17:05
by Outlawz7
Truism wrote:If I'm not much mistaken,

ObjectTemplate.deviation.setTurnDev 0.1 0.05 0.05 0.005

The intermediate two variables are based on the client side frame rate, and so having a highly variable frame rate will drastically change the amount a similar movement will cause inaccuracy.

Am I wrong?
In other words, the higher the FPS rate, the better the accuracy?

Re: Questions about deviation

Posted: 2008-08-25 17:08
by bosco_
No, deviation depends on the server frame rate

Re: Questions about deviation

Posted: 2008-08-25 18:14
by Wolfe
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 :D efaultAnimationComp ---
ObjectTemplate.createComponent DefaultAnimationComp
ObjectTemplate.animation.useShiftAnimation 1
ObjectTemplate.animation.shiftDelay .1
rem ---EndComp ---

rem ---BeginComp :D 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.

Re: Questions about deviation

Posted: 2008-08-26 01:21
by General Dragosh
HOLY PC, i think i just saw my whole life pass by after seeing that Wolfe O.O

Re: Questions about deviation

Posted: 2008-08-26 15:41
by Beafy
General Dragosh wrote:HOLY PC, i think i just saw my whole life pass by after seeing that Wolfe O.O
i second that, also i think the ACOG needs to be made smaller, i think it is in 0.8 :D

Re: Questions about deviation

Posted: 2008-08-26 15:58
by Charity Case
Thanks for the explanation Wolfe. I think this thread is ready to be locked.

Re: Questions about deviation

Posted: 2008-08-26 16:29
by Waaah_Wah
Nah just leave it open if someone elce wants to ask about any of this.

Re: Questions about deviation

Posted: 2008-08-26 16:53
by fuzzhead
moving to community modding forums