Deviation, how it's made?

General discussion of the Project Reality: BF2 modification.
Locked
Arnoldio
Posts: 4210
Joined: 2008-07-22 15:04

Deviation, how it's made?

Post by Arnoldio »

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.
Image


Orgies beat masturbation hands down. - Staker
goguapsy
Posts: 3688
Joined: 2009-06-06 19:12

Re: Deviation, how it's made?

Post by goguapsy »

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:
ChizNizzle wrote:I said i know what it does, i just need the explanation of the code, or whatever numbers define deviation.
OH you mean like the codes (such as if you wanted to study/change them and stuff?) in the folders outside of PR?
Last edited by goguapsy on 2010-11-21 02:54, edited 1 time in total.
Guys, when a new player comes, just answer his question and go on your merry way, instead of going berserk! It's THAT simple! :D

Image[/CENTER]
Arnoldio
Posts: 4210
Joined: 2008-07-22 15:04

Re: Deviation, how it's made?

Post by Arnoldio »

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. :D
Image


Orgies beat masturbation hands down. - Staker
Bringerof_D
Posts: 2142
Joined: 2007-11-16 04:43

Re: Deviation, how it's made?

Post by Bringerof_D »

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?

Post by splatters »

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?

Post by nedlands1 »

Here is the deviation code from the M4 with ACOG to give you an example.

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
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.

Image

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.

  1. 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).
  2. 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.
  3. The difference in deviation between standing and crouch is large but quite small between crouching and prone.
Image
illidur
Posts: 521
Joined: 2009-05-13 12:36

Re: Deviation, how it's made?

Post by illidur »

[R-CON]nedlands1 wrote: The difference in deviation between standing and crouch is large but quite small between crouching and prone.
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|ksa
Posts: 56
Joined: 2010-02-13 13:20

Re: Deviation, how it's made?

Post by R|ksa »

Hmmm... Interesting stuff.
John-117
Posts: 1253
Joined: 2009-04-15 18:45

Re: Deviation, how it's made?

Post by John-117 »

In other words magic
Proud Member of [COLOR="Blue"][PR-HK][/COLOR]

thanks rampo93
Arnoldio
Posts: 4210
Joined: 2008-07-22 15:04

Re: Deviation, how it's made?

Post by Arnoldio »

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... :D
Image


Orgies beat masturbation hands down. - Staker
nedlands1
Posts: 1467
Joined: 2006-05-28 09:50

Re: Deviation, how it's made?

Post by nedlands1 »

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?
I believe it is to make it more attractive (along with the prone deviation penalty) to go crouched instead of instaproning.
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... :D
Well the deviation kinda does increase exponentially. The angle (&#952 ;) 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.
Image
marcoscl
Posts: 37
Joined: 2009-09-07 09:08

Re: Deviation, how it's made?

Post by marcoscl »

I feel like in my math class.......
The only easy day was yesterday


BenHamish
Posts: 325
Joined: 2010-10-17 11:59

Re: Deviation, how it's made?

Post by BenHamish »

John-117 wrote:In other words magic
Exactly mate. That'll do for me.


'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?

Post by Arnoldio »

'[R-CON wrote:nedlands1;1493890']Well the deviation kinda does increase exponentially. The angle (&#952 ;) 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.
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.

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.
Image


Orgies beat masturbation hands down. - Staker
splatters
Posts: 529
Joined: 2010-01-19 08:02

Re: Deviation, how it's made?

Post by splatters »

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?

Post by jimbobjim »

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?
nedlands1
Posts: 1467
Joined: 2006-05-28 09:50

Re: Deviation, how it's made?

Post by nedlands1 »

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
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: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?
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.
Image
goguapsy
Posts: 3688
Joined: 2009-06-06 19:12

Re: Deviation, how it's made?

Post by goguapsy »

Is that true about the stand-crouch-prone dive = little deviation?
Guys, when a new player comes, just answer his question and go on your merry way, instead of going berserk! It's THAT simple! :D

Image[/CENTER]
CCCode
Posts: 180
Joined: 2010-01-01 21:28

Re: Deviation, how it's made?

Post by CCCode »

nedlands post should be stickified in Comunity Modding :D Very helpful stuff
Image
Locked

Return to “PR:BF2 General Discussion”