The Refractor Engine, is a game engine designed by Stockholm-based studio Refraction Games, first developed for the computer game Codename Eagle, which was released in November 1999.
Since then, Refraction Games has been bought by Digital Illusions CE and the Refractor 2 engine developed for the Battlefield game series on PC. For 2008's Battlefield: Bad Company, DICE stopped using the engine, switching to the Frostbite Engine instead. The engine is still used in games not completely developed by DICE.
Battlefield Games that use Refractor 2
- Battlefield 1942 (2002)
- Battlefield Vietnam (2004)
- Battlefield 2 (2005)
- Battlefield 2142 (2006)
- Battlefield Heroes (2009)
- Battlefield Play4Free (2011)
- Battlefield Online
Refractor 2-era Battlefield games have a material-based damage system rather than a direct, weapon-based damage system. This means that damage is determined by the type of material a weapon spawns in its barrel rather than the weapon itself. This can make deciphering the intended damage of a weapon rather cryptic, as there are several factors in determining final damage.
MaterialManager.materialDamage line within the
materialManagerDefine configuration file determines how much basic damage a material does. The weapon of interest has an
objects configuration file in its primary directory. This file usually has a
ObjectTemplate.projectileTemplate line which determines what kind of projectile it fires. Sometimes it's specific, and sometimes what is written is vague. For example, the M14's is
The objects/handweapons/common file directory has a configuration file named
projectile. This sets down which projectile type refers to which material type. In
SniperProjectile's case, it is material 218. Going back to the
MaterialManagerDefine file, one can search for said material by searching for, in this case, 218. It can be seen that material 218 is placed under the "rifle" heading, and has a
materialDamage value of 5.
One issue with Battlefield Vietnam is the unaltered usage of Battlefield 1942 damage system files. This means that many of the weapons used in Battlefield Vietnam are either simply renamed Battlefield 1942 files or non-renamed files determining the modified damage. However, if one were to look in each damage system file, the material line is usually unique, so, for example, only one has material 218. In this case, it is under the file "sniper".
With that knowledge, it is possible to determine the modified damage based upon what the user is firing upon. There are three infantry groups. Those are materials 40, 41 and 42. For material 40, the damage multiplier is 10 (for the M14, 5*10 = 50, so it would be an instant kill). Material 41 has a multiplier of 3 (15 damage with M14), and material 42 a multiplier of 2 (10 damage with M14).
The two other modifiers are damage dropoff over distance and the angle at which the projectile hits its target.
The angle damage is determined by $ Cos(angle) $. So, zero degrees means the multiplier remains at 1, while a degree value of 30 changes it to 0.866. The modified damage is applied to this.
In the early games, most weapons do not have damage dropoff, mostly just sub-machine guns and pistols. There are some lines in the objects file of a weapon which state that the damage dropoff begins at a certain distance (for instance 20 meters) and ends at another (for instance 60 meters) The multiplier for the minimum damage possible is also there, but is only applied when the distance to target is its maximum, and usually the multiplier is 1 anyway, so there is no change.