Posted: 2008-05-11 23:27
Primary Objectives:
BF2 does not have weapon sway. Realistic infantry combat cannot exist without it, so the only known way to create it is to simulate it through weapon deviation. This decreases the weapon accuracy but increases the realistic deviation when that weapon is in the hands of a soldier. So by "Realistic Deviation", I am referring to deviation when the weapon is in the hands of a soldier, not when it is locked down with clamps and firing down range in perfect lab conditions.
Coding Outline:
The following information is being provided as a technical reference for myself as well as a reference for anyone who is interested in understanding deviation coding. I will be adding more to this section as time allows.
Per-shot delay*:
Located in the weapon.tweak file. Regulates how often pressing the "fire" or "zoom" key will be registered in a given amount of time. For example, a value of 10 will only allow the weapon to be fired/zoomed once every ~10 seconds. A value of 0.08 will only allow the weapon to fire 5-6 bullets per second. Firing a weapon as quickly as you can click a button is unrealistic. Using this code adds a valuable element of realism by limiting rapid single-shot to human-like abilities.
rem ---BeginComp
efaultAnimationComp ---
ObjectTemplate.createComponent DefaultAnimationComp
ObjectTemplate.animation.useShiftAnimation 1
ObjectTemplate.animation.shiftDelay 0.08
Fire-Delay-From-Prone:
Located in the soldier/common/common.con file. Prevents a weapon from being fired when switching to the crouch/stand position from the prone position. Helps to prevent jack-in-the-box shooting from prone.
rem *** number of seconds the player must wait to fire weapon after being prone...
Vars.Set fire-delay-from-prone 1.2
Ironsight Zoom Factor:
Located in the weapon.tweak file. This removes 99% of the zoom effect; a vast improvement over the current 0.9 value.
ObjectTemplate.zoom.addZoomFactor 1.099
Zoom Delay:
Located in the weapon.tweak file. This is the delay (in seconds) before a weapon will switch to and from the final zoom view after the zoom key is pressed. During this delay, the weapon cannot be fired.
ObjectTemplate.zoom.zoomDelay 0.7
Zoom Field-of-View Delay:
Located in the weapon.tweak file. This prevents the background from slowly zooming in during the zoom delay so that once the zoom animation completes, the view instantly switches to the zoom mode (instead of slowly zooming in during the animation). This code should only be used for scopes where the scope view has black screen edges. This code should NOT be used for open scope weapons such as iron sights or reflex sights such as the spec ops weapon.
ObjectTemplate.zoom.changeFovDelay 0.7
Mouse Turning Rate:
Located in the weapon.tweak file. This regulates how quickly you can turn while zoomed in. Values range from 1.0 (no restriction) to 0.0 (no turning). This code is not used for scoped weapons and more useful for ironsights with a value of .8. The lower the number, the slowing the turning rate. Useful for preventing a soldier from doing rapid 180 degree turns.
ObjectTemplate.zoom.mouseSpeedMod 0.4
Deviation Calculation:
Documentation regarding how BF2 calculates deviation is rare, outdated, and often incorrect. For example, the BF2 wiki page states that deviation is calculated as [(Mindev * Stance) + (Fire + Speed + Turn) * Zoom] but have found this to be inconsistent with ingame results. If this were true, a (0 base dev), (2 stance), and (5 additional shot) should result: 0 * 2 + 5 = 5, but it does not. The in-game result is 10, not 5. This and other testing leads me to believe the deviation calculation is as follows (if anyone can confirm or correct this, please do):
[(Mindev + Fire,Speed,Turn) * Stance * Zoom]
Known Issues:
Development Status:
The following represents the latest deviation models:
Rifleman
- Reduce/Eliminate prone spam.
- Reduce/Eliminate run'n gun.
- Promote realistic CQB weapons and tactics.
- Maintain weapon accuracy.
BF2 does not have weapon sway. Realistic infantry combat cannot exist without it, so the only known way to create it is to simulate it through weapon deviation. This decreases the weapon accuracy but increases the realistic deviation when that weapon is in the hands of a soldier. So by "Realistic Deviation", I am referring to deviation when the weapon is in the hands of a soldier, not when it is locked down with clamps and firing down range in perfect lab conditions.
Coding Outline:
- High deviation when non-zoomed (firing from the hip).
- Low deviation when zoomed.
- Increase zoom-in delays and zoom-in animation times.
- Slightly increase v.75 max deviations (fire, turn, move).
- Slightly increase v.75 recovery times (fire, turn, move).
- Slightly reduce G3 recoil (Recoil is too easily negated with mouse movements, especially those who can adjust dpi on the fly. Reducing the recoil effect minimally affects deviation while simultaneously narrowing the gap between those who have a dpi mouse and those who don't.
- Decrease turn rate for open sight weapons (iron sights, LAT, grenadier, etc.)
- Add single-shot max fire rate to single-shot rifles.
- Sniper: Decrease tracking deviation, increase move recovery time.
- LAT: Slightly increase min and max deviation.
- Grenadier: Slightly increase min and max deviation.
- Support: Increase move recovery time.
- Remove "auto return" recoil effect from assault rifles.
The following information is being provided as a technical reference for myself as well as a reference for anyone who is interested in understanding deviation coding. I will be adding more to this section as time allows.
Per-shot delay*:
Located in the weapon.tweak file. Regulates how often pressing the "fire" or "zoom" key will be registered in a given amount of time. For example, a value of 10 will only allow the weapon to be fired/zoomed once every ~10 seconds. A value of 0.08 will only allow the weapon to fire 5-6 bullets per second. Firing a weapon as quickly as you can click a button is unrealistic. Using this code adds a valuable element of realism by limiting rapid single-shot to human-like abilities.
rem ---BeginComp
ObjectTemplate.createComponent DefaultAnimationComp
ObjectTemplate.animation.useShiftAnimation 1
ObjectTemplate.animation.shiftDelay 0.08
Fire-Delay-From-Prone:
Located in the soldier/common/common.con file. Prevents a weapon from being fired when switching to the crouch/stand position from the prone position. Helps to prevent jack-in-the-box shooting from prone.
rem *** number of seconds the player must wait to fire weapon after being prone...
Vars.Set fire-delay-from-prone 1.2
Ironsight Zoom Factor:
Located in the weapon.tweak file. This removes 99% of the zoom effect; a vast improvement over the current 0.9 value.
ObjectTemplate.zoom.addZoomFactor 1.099
Zoom Delay:
Located in the weapon.tweak file. This is the delay (in seconds) before a weapon will switch to and from the final zoom view after the zoom key is pressed. During this delay, the weapon cannot be fired.
ObjectTemplate.zoom.zoomDelay 0.7
Zoom Field-of-View Delay:
Located in the weapon.tweak file. This prevents the background from slowly zooming in during the zoom delay so that once the zoom animation completes, the view instantly switches to the zoom mode (instead of slowly zooming in during the animation). This code should only be used for scopes where the scope view has black screen edges. This code should NOT be used for open scope weapons such as iron sights or reflex sights such as the spec ops weapon.
ObjectTemplate.zoom.changeFovDelay 0.7
Mouse Turning Rate:
Located in the weapon.tweak file. This regulates how quickly you can turn while zoomed in. Values range from 1.0 (no restriction) to 0.0 (no turning). This code is not used for scoped weapons and more useful for ironsights with a value of .8. The lower the number, the slowing the turning rate. Useful for preventing a soldier from doing rapid 180 degree turns.
ObjectTemplate.zoom.mouseSpeedMod 0.4
Deviation Calculation:
Documentation regarding how BF2 calculates deviation is rare, outdated, and often incorrect. For example, the BF2 wiki page states that deviation is calculated as [(Mindev * Stance) + (Fire + Speed + Turn) * Zoom] but have found this to be inconsistent with ingame results. If this were true, a (0 base dev), (2 stance), and (5 additional shot) should result: 0 * 2 + 5 = 5, but it does not. The in-game result is 10, not 5. This and other testing leads me to believe the deviation calculation is as follows (if anyone can confirm or correct this, please do):
[(Mindev + Fire,Speed,Turn) * Stance * Zoom]
Known Issues:
Development Status:
The following represents the latest deviation models:
Rifleman
rem ---BeginComp:SoldierBasedRecoilComp ---
rem 556 Standard Recoil Assault Rifle
ObjectTemplate.createComponent SoldierBasedRecoilComp
ObjectTemplate.recoil.hasRecoilForce 1
ObjectTemplate.recoil.recoilForceUp CRD_UNIFORM/1.2/1.3/0
ObjectTemplate.recoil.recoilForceLeftRight CRD_UNIFORM/-0.1/-0.3/0
ObjectTemplate.recoil.zoomModifier 0.4
ObjectTemplate.recoil.goBackOnRecoil 0
rem ---EndComp ---
rem ---BeginComp:SoldierDeviationComp ---
rem 556 Optical Sight Standard Accuracy Assault Rifle
ObjectTemplate.createComponent SoldierDeviationComp
ObjectTemplate.deviation.minDev .333
ObjectTemplate.deviation.setFireDev 1.5 1.5 .038
ObjectTemplate.deviation.setTurnDev 3 .225 .225 .075
ObjectTemplate.deviation.setSpeedDev 1.5 .1 .1 .015
ObjectTemplate.deviation.setMiscDev 5 5 .05
ObjectTemplate.deviation.devModStand 1.6
ObjectTemplate.deviation.devModCrouch 1.5
ObjectTemplate.deviation.devModLie 1.3
ObjectTemplate.deviation.devModZoom .3
rem ---EndComp ---