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 the free for play online games, but none of those have been directly, or entirely, developed by DICE.
- 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.
Unlike damage, hitpoints are actually determined on a case-by-case basis. Under most circumstances, every vehicle has its own
objects configuration file, which lists hitpoints at spawn, maximum hitpoints, et cetera. Kits have a "common" file which has a similar objects file, which also lists hitpoints. With a few exceptions, for instance the Battlefield Vietnam Heavy Assault, all infantry have 30 hitpoints. Vehicles vary based upon the type, although the material they are made of determines the damage multipliers which other materials can be applied to when used against one another. For instance, all rocket launchers have a 20 times multiplier against most aircraft materials (material 60).
Almost everything in a Refractor 2 game is based upon a set of object and material templates, which are defined within other file directories. Everything from what the characters wear to what weapons they use to the vehicles that are spawned at the set spawnpoints are determined by a set of object templates in every file. In addition, most object templates are made up of other, less substantial templates. For instance, weapon object templates are usually made up of several, much less substantial parts: a trigger template, a magazine template, a stock template, a chamber template, and a barrel template. The least substantial objects are usually defined as a
SimpleObject, meaning that there is nothing else making up the object.
Meshes are usually either under the
skinnedMesh file extension. Meshes are the visual representation of weapons, vehicles, characters, et cetera. All meshes seem to have been made with 3ds Max or a modified version thereof, as that is one of the only programs which accept the different mesh filetypes.
There are also collision meshes -- these are what actually determine when a visual mesh is contacting another mesh, or when an object with a visual mesh has been hit, and also determines at what angle projectiles hit the mesh.