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