Deviation, how it's made?
-
Arnoldio
- Posts: 4210
- Joined: 2008-07-22 15:04
Deviation, how it's made?
I know how deviation works and all, but what are the numbers behind this thing.
Is it value-oriented where at 5 sec - deviation factor is 5, 4 sec = 4, etc., or is there a different system?
Thanks for answers.
Is it value-oriented where at 5 sec - deviation factor is 5, 4 sec = 4, etc., or is there a different system?
Thanks for answers.

Orgies beat masturbation hands down. - Staker
-
goguapsy
- Posts: 3688
- Joined: 2009-06-06 19:12
Re: Deviation, how it's made?
AFAIK in an Assault Rifle you have 0 deviation after 5 seconds holding still. If you move for .5 seconds, you gotta wait .5 seconds to get the deviation perfect again. Jump or go prone and you restart your deviation counter (that's why some people that are not TOO close lose if they dolphin-dive instead of just crouching).
Now some guns get MORE deviation than the one you moved, such as the HAT kit (move for 1 second, your deviation will be screwed up). I think that's with the sniper as well and possibly the MG.
Wanna tip? Again, as far as I know (it was like this with the MG at least, probably with the assault rifle too): you can start shooting but your deviation will gradually settle (other words: if you see an enemy on the building, you can supress the enemy while you wait for the deviation to settle, know what I mean?
(If the person does NOT get back to cover... you better run!)
EDIT:
Now some guns get MORE deviation than the one you moved, such as the HAT kit (move for 1 second, your deviation will be screwed up). I think that's with the sniper as well and possibly the MG.
Wanna tip? Again, as far as I know (it was like this with the MG at least, probably with the assault rifle too): you can start shooting but your deviation will gradually settle (other words: if you see an enemy on the building, you can supress the enemy while you wait for the deviation to settle, know what I mean?
(If the person does NOT get back to cover... you better run!)
EDIT:
OH you mean like the codes (such as if you wanted to study/change them and stuff?) in the folders outside of PR?ChizNizzle wrote:I said i know what it does, i just need the explanation of the code, or whatever numbers define deviation.
Last edited by goguapsy on 2010-11-21 02:54, edited 1 time in total.
-
Arnoldio
- Posts: 4210
- Joined: 2008-07-22 15:04
Re: Deviation, how it's made?
I said i know what it does, i just need the explanation of the code, or whatever numbers define deviation.
Thanks anyway, maybe somebody else will find good info in your post.
Thanks anyway, maybe somebody else will find good info in your post.

Orgies beat masturbation hands down. - Staker
-
Bringerof_D
- Posts: 2142
- Joined: 2007-11-16 04:43
Re: Deviation, how it's made?
remember at longer ranges it is still advantageous to hit the dirt.
Information in the hands of a critical thinker is invaluable, information alone is simply dangerous.
-
splatters
- Posts: 529
- Joined: 2010-01-19 08:02
Re: Deviation, how it's made?
I would like to know this too, maybe some DEV can shed light on this.
-
nedlands1
- Posts: 1467
- Joined: 2006-05-28 09:50
Re: Deviation, how it's made?
Here is the deviation code from the M4 with ACOG to give you an example.
The minimum deviation (smallest diameter of a cone which contains the largest possible group of rounds) can be calculated by the following set of formulas. This is the deviation present without the deviation due to moving, jumping, turning, shooting or going prone. This can be represented by the diagram below. Point D is the point of aim, AD is the distance from the weapon to the target, BC is the diameter of the cone and
θ is the interior angle of the cone ∠BAC.

To calculate θ (in degrees) from the diagram above you can use the following formula.
For standing while looking down the sights,
θ = 2 x minDev x devModStand x devModZoom
For crouching while looking down the sights,
θ = 2 x minDev x devModCrouch x devModZoom
For prone while looking down the sights,
θ = 2 x minDev x devModLie x devModZoom
When not looking down the sights set the devModZoom to 1.
To calculate the maximum size of the group with minimum deviation (Line BC on the diagram above)you use the following formula.
BC = 2AD tan (θ/2)
for the very small angles involved,
BC ≈ AD tan θ
eg With the M4 above, standing and using the sights at a distance of 50m the maximum size of the group (with minimum deviation) is:
θ = 2 x .333 x 1.5 x 0.3
= 0.2997 degrees
BC ≈ 50 x tan 0.2997
= 0.26m
To work out the settling times you can use the following formulas.
For firing deviation the relevant code is of the form of:
ObjectTemplate.deviation.setFireDev X Y Z
where,
X is the maximum possible deviation due to firing
Y is the firing deviation added per shot
Z is the firing deviation reduced per server frame (1/30 of a second)
So the settling time for a single shot is,
t = Y/(30Z)
and the settling time for multiple shots with a weapon with a high rate of fire is (ie small time between shots for weapon to settle) is approximately,
t ≈ X/(30Z) if SY >/= X
or
t ≈ SY/(30Z) if SY < X
where S is the number of shots.
eg In the case of the M4 firing a single shot the settle time is,
t = 0.7/(30 x .023)
= 1 second
and in the case of the M4 firing a 3 round burst,
SY = 3, X = 1.4 => SY > X
=> t = 1.4/(30 x 0.023)
= 2 seconds
For movement deviation the relevant code is:
ObjectTemplate.deviation.setSpeedDev A B C D
where,
A is the maximum deviation added due to moving
B is the movement deviation added due to moving forwards or backwards per server frame (1/30 of a second)
C is the movement deviation added due to strafing per server frame (1/30 of a second)
D is the movement deviation reduced per server frame (1/30 of a second)
So the settling time for either moving forward/backward is,
t = TB/(D) if 30TB </= A
or
t = A/(30D) if 30TB > A
and the settling time for strafing is,
t = TC/D if 30TC </= A
or
t = A/(30D) if 30TC > A
where T is the time spend moving.
eg. After walking for 3 seconds the settling time for the M4 with scope is,
30TB = 30 x 3 x .02 = 1.8, A = 3 => 30TB < A
=> t = 3 x 0.02/0.02
= 3 seconds
eg. After strafing for 10 seconds the settling time for the M4 with scope is,
30TC = 30 x 10 x .02 = 6, A = 3 => 30TC > A
=> t = 3/(30 x 0.02)
= 5 seconds
For jumping and prone diving deviation the relevant code is:
ObjectTemplate.deviation.setMiscDev E F G
where,
E is the maximum misc deviation added due to jumping or going prone
F is the misc deviation added per jump or prone dive
G is the misc deviation removed per server frame (1/30 of a second)
So the settling time for going prone or jumping once is,
t = F/(30G)
(generally E=F in PR)
eg For the M4 with scope the settling time after jumping is,
t = 20/(30 x .15)
= 4.44 seconds
There is also turning deviation but I'm too lazy to write about that. You can find more about it here: MDT - ObjectTemplate - Properties - SetTurnDev.
P.S. Some interesting things to note when looking at the deviation for the M4 with scope.
Code: Select all
ObjectTemplate.createComponent SoldierDeviationComp
ObjectTemplate.deviation.minDev .333
ObjectTemplate.deviation.setFireDev 1.4 .7 .023
ObjectTemplate.deviation.setTurnDev 2 .15 .15 .05
ObjectTemplate.deviation.setSpeedDev 3 .02 .02 .02
ObjectTemplate.deviation.setMiscDev 20 20 .15
ObjectTemplate.deviation.devModStand 1.5
ObjectTemplate.deviation.devModCrouch 1.0
ObjectTemplate.deviation.devModLie 0.9
ObjectTemplate.deviation.devModZoom .3θ is the interior angle of the cone ∠BAC.

To calculate θ (in degrees) from the diagram above you can use the following formula.
For standing while looking down the sights,
θ = 2 x minDev x devModStand x devModZoom
For crouching while looking down the sights,
θ = 2 x minDev x devModCrouch x devModZoom
For prone while looking down the sights,
θ = 2 x minDev x devModLie x devModZoom
When not looking down the sights set the devModZoom to 1.
To calculate the maximum size of the group with minimum deviation (Line BC on the diagram above)you use the following formula.
BC = 2AD tan (θ/2)
for the very small angles involved,
BC ≈ AD tan θ
eg With the M4 above, standing and using the sights at a distance of 50m the maximum size of the group (with minimum deviation) is:
θ = 2 x .333 x 1.5 x 0.3
= 0.2997 degrees
BC ≈ 50 x tan 0.2997
= 0.26m
To work out the settling times you can use the following formulas.
For firing deviation the relevant code is of the form of:
ObjectTemplate.deviation.setFireDev X Y Z
where,
X is the maximum possible deviation due to firing
Y is the firing deviation added per shot
Z is the firing deviation reduced per server frame (1/30 of a second)
So the settling time for a single shot is,
t = Y/(30Z)
and the settling time for multiple shots with a weapon with a high rate of fire is (ie small time between shots for weapon to settle) is approximately,
t ≈ X/(30Z) if SY >/= X
or
t ≈ SY/(30Z) if SY < X
where S is the number of shots.
eg In the case of the M4 firing a single shot the settle time is,
t = 0.7/(30 x .023)
= 1 second
and in the case of the M4 firing a 3 round burst,
SY = 3, X = 1.4 => SY > X
=> t = 1.4/(30 x 0.023)
= 2 seconds
For movement deviation the relevant code is:
ObjectTemplate.deviation.setSpeedDev A B C D
where,
A is the maximum deviation added due to moving
B is the movement deviation added due to moving forwards or backwards per server frame (1/30 of a second)
C is the movement deviation added due to strafing per server frame (1/30 of a second)
D is the movement deviation reduced per server frame (1/30 of a second)
So the settling time for either moving forward/backward is,
t = TB/(D) if 30TB </= A
or
t = A/(30D) if 30TB > A
and the settling time for strafing is,
t = TC/D if 30TC </= A
or
t = A/(30D) if 30TC > A
where T is the time spend moving.
eg. After walking for 3 seconds the settling time for the M4 with scope is,
30TB = 30 x 3 x .02 = 1.8, A = 3 => 30TB < A
=> t = 3 x 0.02/0.02
= 3 seconds
eg. After strafing for 10 seconds the settling time for the M4 with scope is,
30TC = 30 x 10 x .02 = 6, A = 3 => 30TC > A
=> t = 3/(30 x 0.02)
= 5 seconds
For jumping and prone diving deviation the relevant code is:
ObjectTemplate.deviation.setMiscDev E F G
where,
E is the maximum misc deviation added due to jumping or going prone
F is the misc deviation added per jump or prone dive
G is the misc deviation removed per server frame (1/30 of a second)
So the settling time for going prone or jumping once is,
t = F/(30G)
(generally E=F in PR)
eg For the M4 with scope the settling time after jumping is,
t = 20/(30 x .15)
= 4.44 seconds
There is also turning deviation but I'm too lazy to write about that. You can find more about it here: MDT - ObjectTemplate - Properties - SetTurnDev.
P.S. Some interesting things to note when looking at the deviation for the M4 with scope.
- Relative sizes of the deviation added due to various actions. eg large deviation penalty due to jumping or going prone compared to the penalty after shooting (20 versus 0.7 for a single shot).
- Waiting for movement deviation to settle then moving out from behind a corner is a now a valid tactic since the time it takes to move out of cover is almost the same as the time it takes for the movement deviation to go away while bringing the weapon to bear.
- The difference in deviation between standing and crouch is large but quite small between crouching and prone.

-
illidur
- Posts: 521
- Joined: 2009-05-13 12:36
Re: Deviation, how it's made?
why is that? shouldn't it be the other way around? or is it because of the added delay between being able to prone compared to no delay for crouch/stand spam?[R-CON]nedlands1 wrote: The difference in deviation between standing and crouch is large but quite small between crouching and prone.
-
R|ksa
- Posts: 56
- Joined: 2010-02-13 13:20
Re: Deviation, how it's made?
Hmmm... Interesting stuff.
-
John-117
- Posts: 1253
- Joined: 2009-04-15 18:45
Re: Deviation, how it's made?
In other words magic
-
Arnoldio
- Posts: 4210
- Joined: 2008-07-22 15:04
Re: Deviation, how it's made?
This is what i wanted nedlands yes and thanks. I was hoping that it could be done via some kind of preset function, wich could make deviation more uneven (for the moving part), so the mroe you move, more deviation there is exponentially.
Oh well. Maybe Mosquil...
Oh well. Maybe Mosquil...

Orgies beat masturbation hands down. - Staker
-
nedlands1
- Posts: 1467
- Joined: 2006-05-28 09:50
Re: Deviation, how it's made?
I believe it is to make it more attractive (along with the prone deviation penalty) to go crouched instead of instaproning.illidur wrote:why is that? shouldn't it be the other way around? or is it because of the added delay between being able to prone compared to no delay for crouch/stand spam?
Well the deviation kinda does increase exponentially. The angle (θChizNizzle wrote:This is what i wanted nedlands yes and thanks. I was hoping that it could be done via some kind of preset function, wich could make deviation more uneven (for the moving part), so the mroe you move, more deviation there is exponentially.
Oh well. Maybe Mosquil...![]()

-
marcoscl
- Posts: 37
- Joined: 2009-09-07 09:08
-
BenHamish
- Posts: 325
- Joined: 2010-10-17 11:59
Re: Deviation, how it's made?
Exactly mate. That'll do for me.John-117 wrote:In other words magic
'Deviation, how it's made?' got my hopes up. I was crossing my fingers for a foreign language documentary on a small village in the alps where they create the Deviation for Project Reality using traditional craft methods.
Not so. I'll go back to some random sky channel showing Jesus stuff.
-
Arnoldio
- Posts: 4210
- Joined: 2008-07-22 15:04
Re: Deviation, how it's made?
True dat, but time doesnt have anything to do with it (so to speak, even though it does...) because BC is only relevant to the AD and its infinite.'[R-CON wrote:nedlands1;1493890']Well the deviation kinda does increase exponentially. The angle (θincreases linearly with movement as does the diameter (BC) more or less but the area of the base of the cone increases with the square (A=(pi x d^2)/4) which is close to exponential.
The trick would be to make the θ infinite at the start (but obviously limit it to the same BC at given AD as now), and keep the same timeframe for moving max to min deviation, so it would still prevent pronediving and other stuff, and the most accurate cone will be kept as now. The change would only be faster good groupings and somewhat better accuracy in CQB.

Orgies beat masturbation hands down. - Staker
-
splatters
- Posts: 529
- Joined: 2010-01-19 08:02
Re: Deviation, how it's made?
Thank you for the great answer nedlands1, I'll have a more profound look into this when I have the time 
-
jimbobjim
- Posts: 13
- Joined: 2009-11-03 15:39
Re: Deviation, how it's made?
Thanks for the detailed explanation! I have a couple of questions.
1: Is the actual deviation at any given moment the sum of all of the various modes of deviation or is the value of the highest mode? In other words if I am moving for 5 seconds and begin to fire, does the firing push the deviation above the movement maximum A=3 towards A+X=4.4
2: Because front/back and strafing movement deviation are calculated separately, does this mean that pressing say W and A simultaneously that movement deviation is accrued twice as fast?
1: Is the actual deviation at any given moment the sum of all of the various modes of deviation or is the value of the highest mode? In other words if I am moving for 5 seconds and begin to fire, does the firing push the deviation above the movement maximum A=3 towards A+X=4.4
2: Because front/back and strafing movement deviation are calculated separately, does this mean that pressing say W and A simultaneously that movement deviation is accrued twice as fast?
-
nedlands1
- Posts: 1467
- Joined: 2006-05-28 09:50
Re: Deviation, how it's made?
The actual deviation is the sum of all the individual deviations together. In the case you described there would also more deviation from the baseline deviation (minDev x devMod[stance] x devModZoom).jimbobjim wrote:Thanks for the detailed explanation! I have a couple of questions.
1: Is the actual deviation at any given moment the sum of all of the various modes of deviation or is the value of the highest mode? In other words if I am moving for 5 seconds and begin to fire, does the firing push the deviation above the movement maximum A=3 towards A+X=4.4
From my testing I haven't noticed any change in the deviation when moving in two directions at once. What I think happens is that you actually moving one way then the other in quick succession (with the direction changing at the server frame rate of 30 times a second). As the deviation modifier is set the same for strafing and moving forwards or backwards the average of the two is the same as for one direction.jimbobjim wrote:2: Because front/back and strafing movement deviation are calculated separately, does this mean that pressing say W and A simultaneously that movement deviation is accrued twice as fast?

-
goguapsy
- Posts: 3688
- Joined: 2009-06-06 19:12
Re: Deviation, how it's made?
Is that true about the stand-crouch-prone dive = little deviation?
-
CCCode
- Posts: 180
- Joined: 2010-01-01 21:28
Re: Deviation, how it's made?
nedlands post should be stickified in Comunity Modding
Very helpful stuff


