HOW TO EDIT THE BATTLEFIELD: 1942 DAMAGE SYSTEM

October 21, 2003

Introduction

A shot rings out, a soldier crumples to the ground; you respawn. How did that bullet get there and manage to kill you? This tutorial is all about Battlefield 1942's damage system. It discusses the mechanisms of how objects damage each other and shows how to precisely compute the effect of a weapon on a defender. Data presented is as of the v1.45 patch.

The battlefield's a dangerous place. There are three broad classes of objects that can take damage: soldiers, vehicles/emplacements, and facilities (e.g. the various objectives in Secret Weapons, such as generators, fuel silos, etc). Other static objects cannot take damage, but can cause damage directly (through collision) and indirectly (through ricochets). The main types of damage are:

• Projectile damage: bullets, knives, shells, ricochets, etc. directly hitting the defender.
• Splash damage: mines, exppacks, bombs, artillery and ship shells, flak, etc. exploding in the defender's vicinity.
• Collision damage: caused by the defender colliding with some object.
• Critical damage: a nearly dead vehicle will continue to self-destruct until it blows up.
• Abandonment damage: when a vehicle is driven away from its spawn point and left unattended.
• Upside-down damage: a land vehicle that is upside down soon blows up.
• Water/drowning damage: most vehicles and water do not mix, nor do soldiers and water after a while.
• Desertion damage: soldier death due to being outside the map's legal bounds.

We'll deal with each of these in turn, in excruciating detail.

## Projectile Damage

First thing that happens is that a soldier fires some weapon. Most weapons have a single projectile; one exception is the shotgun, which shoots five shots at once in a pentagonal pattern. Deviation can affect the initial direction of the shots. Each projectile then goes outward on a path at a particular speed, going straight or affected by gravity. To determine damage, the one key piece of information needed about the projectile is its "attack material". Each projectile has a material associated with it. Most soldier projectile materials are found in the single file objects\handweapons\Common\Weapons.con. For example, here is the BAR's entry:

  ObjectTemplate.material 222


If a material for the projectile is not in here, then it is found in the object's corresponding Objects.con file (one oddity that should be noted: the Sg44 has a Material in its own Weapons.con, namely 216, but this .con file should not exist and is not used).

For grenades, mines, exppacks, the material is found in the corresponding Objects.con file. These materials tend to be set so that hitting someone with the grenade itself, for instance, does no damage; see Splash Damage for how explosives work).

The attack material for vehicle and emplaced weapons is normally found in its corresponding Weapons.con file. For example, the Defgun's projectile attack material of 252 is found in objects\Vehicles\Land\Defgun\Weapons.con. Some vehicle weapons (specifically, torpedoes and bombs) are found instead in the objects\Vehicles\Common\Weapons.con file.

30 times each second the server computes the current and future location of each projectile and object in the scene. Each projectile then has a line segment connecting its two locations for the given time slice. This is compared against all objects and scenery.

For each nearby object, the projectile is tested against a bounding box around the entire mesh. If this line segment does not intersect this box, then the object cannot be hit. Graphically an object can be extremely detailed, having many polygons. This level of detail is not normally necessary for collision detection. For efficiency, every object in the game has, in addition to its graphical polygon mesh, two collision meshes. The first mesh used for collision testing is the low quality collision mesh. This is a mesh with very few polygons that fully encloses the detailed model of the object. If the projectile hits the bounding box but misses this mesh, then no further testing is needed and only a few polygons are checked.

Say the low quality mesh is hit. Now the projectile's segment (which is actually a mathematical ray, since it has a direction to it) is tested against the second collision mesh, called the medium quality collision mesh. This mesh usually has more polygons in it, forming a tighter fit with how the object actually appears, but with unimportant detail polygons (e.g. vents, antennae, etc) stripped off. A common shortcut is to design just the medium quality collision mesh and also use this for the low quality mesh, saving modeling time at the expense of possibly slower interactive performance. In any case, if the projectile hits this medium mesh, the object is hit.

A few things can happen once the closest intersection location is found. The shot could be a projectile and explode at this point, or the shot might cause other effects elements to appear. An example is a tank shell hitting a concrete structure (see the image in the Collision Damage section), which causes chunks of concrete to break off and act as projectiles in turn. However, what we are concerned with here is whether the projectile damages the object.

To determine this we need to find the material of the defender. Each object and soldier has one or more materials associated with its collision mesh, with each polygon in the mesh having a single material. You can view and modify these materials in 3DS MAX by using the MDT plug-in tools designed for this game. Here are some example collision meshes for the M10 and Tiger:

To examine collision meshes, you first use the MDT plug-in to import the object file, e.g. standardMesh\Tiger_Hull_M1.sm, asking for only the collision meshes. Both the medium and low quality meshes are imported (and note that many mesh files do not have collision meshes; you must seek these out). You can then go into Modify mode in MAX, select a mesh (and hide or delete the other), open up the "editable mesh" by clicking on '+', and choose "polygon" or "face" within this list. You can then examine the material ID under the surface properties section of the menu. (Note: with Rexman's earlier MAX tools, the material numbers in 3DS MAX appear one higher than what are used in the game. For example, the airplane engine material will be seen as "61" in MAX, which is equivalent to "60" in the game's files. This mismatch does not occur with the MDT tools.)

There are a few main classes of defensive materials: 40-42 for soldiers, 43-47 for unarmored or lightly armored vehicles and buildings, 50-54 for tanks, 55-59 for ships and subs, 60-62 for planes, and 66 is the wooden decks of carriers and battleships. Within a class, a higher number is generally better armor (or at least a less vital component). For example, a Sherman's rear armor is material 50, a Tiger's front armor is material 54.

Once the defensive material is found, we can start computing the damage. Here's the full equation for how much damage a projectile takes:

Hitpoints = MaterialDamage * DamageMod * AngleFalloff * DistanceMod

Let's examine each term in turn.

MaterialDamage: This value is found in the game\bf1942\Game\materialManagerdefine.con file. In this file are the basic attack value of almost every material in the game. There are also physics characteristics such as friction, elasticity, and resistance for the map terrain types, materials 0-15. As an example, here is the BAR assault gun's entry:

 rem *********** Assault Rifles **************
MaterialManager.Material 222
MaterialManager.MaterialAttGroup 222
MaterialManager.MaterialDefGroup 222
MaterialManager.MaterialDamage 9


The material damage value is 9 for the BAR, which is a very rough strength estimate for weapons in the same class. However, the DamageMod has a drastic effect on this value. The material damage values could all have been set to equal 1 throughout and the effect of each weapon could be tuned entirely through the DamageMod values. However, the material damage term does have the useful feature of being an overall "volume knob". If a weapon is felt to be too weak overall, you can turn up its overall effect by increasing the MaterialDamage value instead of having to modify each and every DamageMod value.

Note that I said "almost every material" is listed in the materialManagerdefine.con file. For new weapons, such as the shotgun, this material manager data is found in the corresponding damage system weapon file, e.g. bf1942\Game\damage_system\Shotgun.con, in the first few lines of the file.

DamageMod: Each weapon has a corresponding damage file, in the directory bf1942\Game\damage_system. This file occasionally contains the raw MaterialDamage value, as mentioned above, but the bulk of the file is how this weapon specifically affects various defensive materials. Each defensive material that the weapon can damage is given an entry in this file. For example, here is the BAR's entry for firing at a soldier's head:

 ***** BAR - DIRECT DAMAGE *****
* Infantry target

MaterialManager.AttGroup 222
MaterialManager.DefGroup 40
MaterialManager.DamageMod 2.5
MaterialManager.SetEffectTemplate e_blood01


The AttGroup is the attacking material, the DefGroup the defending material. SetEffectTemplate is the effect that occurs when the weapon hits the defender (in this case, blood, though this effect is turned off by default for game rating purposes). If there is no entry for a defensive material, the weapon does not affect it. That said, all weapons have their effects against soldiers (materials 40-42) defined, even if the DamageMod is 0.

There is an alternate way that DamageMod is defined, called SetCell, that a very few weapons (the bombs and the Wespe) happen to use to define damage:

 MaterialManager.attGroup 201
MaterialManager.setCell 40 20
MaterialManager.setCell 41 20
MaterialManager.setCell 42 20


The first number in SetCell is the DefGroup, the second is the DamageMod.

AngleFalloff: The damage a vehicle or soldier takes is modified by the angle that the shot hit. This has a logic to it: a glancing shot has to travel through more armor, or may wing a soldier instead of hitting some vital organ. If a shot hits dead-on, its angle to the defender's surface is 0 degrees; glancing off, it is near 90 degrees. So, AngleFalloff is computed simply as cosine(angle). At 0 degrees the cosine is 1.0, at 30 it's 0.866, at 45 degrees it's 0.707, at 60 it's 0.5, and at 90 degrees it is 0.0 - which makes sense, since you can't really hit a surface coming in at 90 degrees.

DistanceMod: A number of hand weapons, namely the medics' submachineguns, the Breda and Bren, the shotgun, and the pistols, have their damage drop off with range. For all other weapons this term is always 1.0, i.e. the range does not affect the result. The important factors here are in the objects\handweapons\Common\Weapons.con file. Here is a typical entry, for the shotgun:

  ObjectTemplate.minDamage 0.5
ObjectTemplate.distToStartLoseDamage 40
ObjectTemplate.distToMinDamage 80


The distToStartLoseDamage specifies the distance (in meters) at which the damage of the projectile will start to decrease. The minDamage value is the lowest ratio possible for damage. The distToMinDamage is the distance beyond which the projectile does its minimum amount of damage. In other words, if a shotgun pellet hits at closer than 40 meters, the DistanceMod is 1.0, beyond 80 meters the DistanceMod is 0.5, between these two the DistanceMod drops linearly from 1.0 to 0.5. Submachineguns start to lose damage at 50 meters and drop to 0.5 at 100 meters. The pistols start to drop at 20 meters and drop to 0.5 at 40 meters. When the distance is between distToStartLoseDamage and distToMinDamage, the equation is this:

DistanceMod = minDamage + (1-minDamage) * (distToMinDamage - distance) / (distToMinDamage - distToStartLoseDamage)

So for a shotgun pellet hitting at, say, 50 meters, the value would be:

DistanceMod = 0.5 + (1-0.5) * (80 - 50) / (80 - 40) = 0.875

Hitpoints: Once you multiply these four values together you get how many hitpoints of damage the object takes. Each object has a number of hitpoints, defined in its Objects.con file as:

  ObjectTemplate.hitpoints 100
ObjectTemplate.maxhitpoints 100


The hitpoints entry is how many hitpoints this type of object has when it is first appears, and maxhitpoints is the maximum number of hitpoints the object can reach with repair. These numbers are normally identical in a battle, but it is certainly possible to have objects begin or spawn in a damaged state. Note, however, that you are defining a class of objects, so all objects of that type will have the same initial damaged state. There is no way to single out certain vehicles in a class as starting damaged, short of defining the object twice.

Hitpoint values range from 10 for a Wasserfall rocket to 600 for a carrier to 1000 for the factory in the Battle of Britain. Soldiers take 30 hitpoints, and this entry is found in the objects\Soldiers\Common\CommonSoldierData.inc file. A full list of objects' hitpoint values can be found at the bottom of the Damage Page.

As an example of damage computation, let's continue with a bullet from the BAR hitting the head. As we found above, the MaterialDamage value is 9 for the BAR. The DamageMod value for hitting the head is 2.5. Say the bullet hits at an angle of 20 degrees away from a dead-on shot. AngleFalloff is then cosine(20 degrees), or 0.940. There is no modification due to distance, so DistanceMod is 1.0. Putting it all together:

Hitpoints = MaterialDamage * DamageMod * AngleFalloff * DistanceMod
Hitpoints
= 9 * 2.5 * 0.940 * 1.0 = 21.15

So the soldier takes 21.15 hitpoints of damage. He starts with 30 hitpoints, so if he was at full health, he's still alive but badly injured.

Splash Damage

Splash damage is what comes from explosions. An explosion affects objects whose center is inside the blast radius. This radius, measured in meters, is found in the Weapons.con file for the weapon, e.g. the Sturmtiger's setting is:

  ObjectTemplate.radius 20


If any terrain or object blocks the line segment between the explosion and the soldier's center, the soldier receives no damage from the explosion. Objects and terrain do not block splash damage attacks against vehicles and objectives.

Material2 gives the attack material for splash damage for a weapon. This property is found in the weapon's Weapons.con file. For handweapons, this property is in the common\Weapons.con file (for the bazooka shell) or in the weapon's Objects.con file. For example, the explosive pack's Radius and Material2 are defined in objects\handweapons\exppack\objects.con:

  ObjectTemplate.radius 12
ObjectTemplate.material2 204


The defense material of the target is easier to find than for direct damage, as in this case it is not derived from the collision mesh. The defense material is simply whatever value is set in the object's Objects.con file. For example, here is the setting for the Wespe:

  ObjectTemplate.material 45


The defensive material of a vehicle is often set to be about the thinnest armor in its vehicle class. Setting it this low is not a requirement, it is just the way it was done in BF 1942. For example, the Wespe's collision mesh uses materials 46 and 47, but its splash damage material is 45.

If the object is inside the explosion's radius and the damage is not blocked, the splash damage equation is used:

Hitpoints = MaterialDamage * DamageMod * RadiusMod

MaterialDamage: This value is also found in the game\bf1942\Game\materialManagerdefine.con file. The Material2 value is used. For example, the explosive pack's Material2 is 204, and the corresponding entry is:

  MaterialManager.material 204
MaterialManager.materialAttGroup 204
MaterialManager.materialDefGroup 204
MaterialManager.materialDamage 20


So the MaterialDamage base value is 20 for the explosive pack.

DamageMod: Similar to direct damage, the attack material and defense material are used to find the damage modifier, in the weapon's file in the directory bf1942\Game\damage_system. Continuing with an explosive pack (material 204) vs. a Wespe (material 45), the entry is in the file bf1942\Game\damage_system\exppack.con:

  MaterialManager.attGroup 204
MaterialManager.defGroup 45
MaterialManager.damageMod 3


(Note that, if you look inside this file, the comments are incorrect about what material does what damage.) So, the DamageMod is 3 for the explosive pack vs. the Wespe.

RadiusMod: All explosions fall off with distance. The property DamageType in the weapon's Weapons.con file specifies the type. For explosive packs (and almost every other explosive) this entry is:

  ObjectTemplate.damageType 1


which means that the object explodes on impact. Landmines and flak guns are the only weapons with a DamageType of 4, which was introduced with the v1.4 patch. This setting is used to allow the projectile to explode when it is near another object. The property ObjectTemplate.explodeNearEnemyDistance sets this explosion distance.

Damage falls off linearly with distance from the center of the explosion, going to zero at its Radius. The term is simply (1 - distance/radius). For our example, say the explosive pack was put 1.2 meters from center of the Wespe. The radius mod is then (1 - 1.2/4), or 0.7.

Hitpoints: as with direct damage, this is the number of points of damage done. For our explosive pack vs. Wespe example, the MaterialDamage was 20, the DamageMod was 3, and the RadiusMod was 0.7. This gives:

Hitpoints = MaterialDamage * DamageMod * RadiusMod
Hitpoints = 20 * 3 * 0.7 = 42

So the Wespe takes 42 points of damage. It has 50 hitpoints at full strength, so it would be brought down to 8 hit points.

Collision Damage

Vehicles collide, wreckage hits a ship, a soldier falls down a hill - these are all instances where collision damage takes place. The relevant factors are the materials of the colliding objects and the square of the relative velocity. A classic kamikaze tactic is to run a jeep full-speed into a tank, blowing both up. However, if the tank goes into reverse before getting hit, it will often take considerably less damage, even though the relative impact velocity is not that much lower.

Collision damage can be an important factor in the weapon's effectiveness. For example, the splash damage of the Wasserfall rocket does not harm tanks. However, slamming one of these into a tank usually destroys it, due to the fragments of the rocket itself colliding with the tank. Another example is shooting tank shells against concrete and brick buildings. Such shots create stone ricochet fragments that are highly effective at killing soldiers and destroying vehicles.

The relevant files for collision damage are in the directory bf1942\Game\collision_armor. These files contain MaterialDamage and DamageMod values in the same way as computed for projectile and splash damage.

There are two major types of collision damage: object/object and soldier/object (soldiers running into each other do not do anything). Object/object damage is computed separately for each object (if the object is destructible), first with one object being the attacker and the other the defender, then the reverse. The equation used is:

Hitpoints = MaterialDamage * DamageMod * VelocityMod * CollisionAngleMod

MaterialDamage: this value is determined the same way as the value used for projectile damage, and is found in game\bf1942\Game\materialManagerdefine.con. For example, here is the Willy Jeep's entry:


MaterialManager.material 45
MaterialManager.materialAttGroup 45
MaterialManager.materialDefGroup 45
MaterialManager.materialDamage 1


so the MaterialDamage value is 1.

DamageMod: this value is found in a similar way to projectile damage, but this time the attack and defense material pair can also be found in the files in the bf1942\Game\collision_Armor directory. "Armor" here refers to all vehicles, objectives, and soldiers. For example, a jeep running into a Tiger tank uses the values in the LightArmor.con file:


MaterialManager.attGroup 45
MaterialManager.defGroup 54
MaterialManager.damageMod 0.1
MaterialManager.setEffectTemplate e_collision_metal


for a DamageMod of 0.1.

VelocityMod: is equal to the relative velocity squared times the SpeedMod property of the defending vehicle. The SpeedMod property is found inside the object's Objects.con file under the objects directory. For example, the Tiger's value, in file objects\Vehicles\Land\Tiger\Objects.con, is:

  ObjectTemplate.speedMod 0.75


In general, tanks tend to use a value of 0.75, while some (but not all) lighter vehicles and planes use 2.

CollisionAngleMod: is computed two different ways, depending on the AngleMod value of the defender. This value can be found inside the defending object's Objects.con file, similar to SpeedMod. However, most objects do not have this value set, so have a default of 0; only planes have this value set, and always to 1. The actual expression used is:

CollisionAngleMode = AngleMod + (1 - AngleMod) * sine( cosine( angle ) * 90 degrees )

This looks complex, but because the AngleMod is always either 0 or 1, one part or the other of this expression goes away when evaluated. It's presented here in full, as in theory you could set AngleMod to some other value. The angle is the angle of collision between the two objects. Specifically, it is the direction of the attacker compared to the normal of the surface hit of the defender. 0 degrees is head-on. So, for airplanes the final value is simply 1, i.e. the angle an object collides with the plane does not matter, the plane will take full damage. For other objects, this term falls off with angle, e.g. 0 degrees gives 1.0, 30 degrees gives 0.978, 60 degrees gives 0.707, 80 degrees gives 0.270, 90 degrees gives 0.0. So hitting at anything but a glancing blow does nearly full damage.

So, for our jeep crashing into a Tiger, say the jeep is going 20 meters/second (about 45 MPH) relative to the Tiger when it hits. It impacts at an angle of 20 degrees. The equation is then:

Hitpoints = MaterialDamage * DamageMod * VelocityMod * CollisionAngleMod
Hitpoints = 1 * 0.1 * (20*20 * 0.75) * sine( cosine( 10 degrees ) * 90 degrees ) = 30

So the Tiger would take this much damage. Note the large effect that velocity has on this equation: at 30 meters/second damage goes up to about 67.5 hitpoints, and 40 meters/second does 120 hitpoints of damage.

Soldier/Object Collision Damage

Soldier/object damage computation is still more involved. First, if the relative speed is less than 8 meters/second (about 18 MPH), the soldier takes no damage, i.e. it's usually hard for a soldier to hurt himself running around. If this speed is greater, then the soldier's contribution to the speed has 8 meters/second subtracted from it if both objects are dynamic (i.e. the other object can move; the soldier is not falling onto a static object). In other words, a soldier can still hurt himself by falling, but the effect of running towards an oncoming vehicle vs. running away is ignored. There is no armor modifier, but a height modifier becomes important:

Hitpoints = MaterialDamage * DamageMod * VelocityMod * HeightMod * HeightMod * CollisionAngleMod

These are computed as before, with the addition of the HeightMod value and a modification of theCollisionAngleMod value.

HeightMod: The height is calculated as the vertical distance before the collision took place between the soldier and the object he's hitting. This height value is also affected by the soldier's damping ability. The rocketeer class has a damping value of 0.0, which is found in objects\Items\GerEliteKit\Common\Objects.con as the property ObjectTemplate.Damping. The height value is multiplied by this damping value (if present) to give the effective height. The height modification factor is computed based on this effective height and the relative speed. The HeightModis set to 1 (i.e. no effect) if the height is less than a meter, otherwise the HeightMod is set to the effective height. Note that the HeightModvalue is squared in the final equation.

CollisionAngleMod: This value is computed as before, but then may be modified due to the height of a fall or the relative speed of the collision. If the height before damping is between 1 and 2 meters, the CollisionAngleMod is set to "(1-CollisionAngleMod)*(height-1) + CollisionAngleMod". All this means is that for a fall of 1 meter theCollisionAngleMod value is used as is, at 2 meters this value is goes to 1, and between these two heights this value is interpolated between the two. In other words, as the distance fallen increases, the angle of impact matters less - a long fall is a long fall. At a height of more than 2 meters this value is always set to the maximum value of 1. However, we're not done yet. The relative speed (minus the soldier's contribution, as explained above) is checked: if this value is 30 meters/second or more, theCollisionAngleMod is set to its maximum of 1. If the speed is between 10 and 30, then this modifier is again interpolated between these two: "(1 - CollisionAngleMod)*((speed - 10)/20) +CollisionAngleMod". The intent is again to ignore the angle of impact when the collision speed is fairly high.

So, let's keep our example simple: a soldier hits the ground at a speed of 15 meters/second, with a height fall in 1/30th of a second of 0.45 meters. The speed is greater than 8 meters/second, so damage will be computed. The ground is a static object, so there is no reduction in the soldier's speed due to being hit by a dynamic object (a vehicle, wreckage, etc). TheMaterialDamage value is found in materialManagerDefine.con, and is 30 for all ground/water materials 0-15. The DamageMod value is in the MaterialManagerSettings.con file, and for attack materials 0-15 (different types of ground, the exception is Material 1 is water) and for defense material 41 (soldier's trunk) theDamageMod is 0.001. The SpeedMod for a soldier is found in CommonSoldierData.inc, and is 0.5. Say the CollisionAngleModis originally 0.9. Because the speed is between 10 and 20 meters/second, this value would be recomputed as:

New CollisionAngleMod = (1 - CollisionAngleMod)*((speed - 10)/20) + CollisionAngleMod

New CollisionAngleMod = (1 - 0.9)*((15 - 10)/20) + 0.9 = 0.925

The CollisionAngleMod is not affected by the height, since the height is less than 1. The HeightMod is forced to 1, since the height is less than 1.

Hitpoints = MaterialDamage * DamageMod * VelocityMod * HeightMod * HeightMod * CollisionAngleMod
Hitpoints = 30 * 0.001 * (15*15*0.5) * 1 * 1 * 0.925 = 3.1 hitpoints

The Weapons Effects page details a wide range of experiments of ramming one vehicle into another, to give a sense of what these collision effects mean in practice.

Critical Damage

Some vehicles stop moving and take damage by themselves when heavily damaged. The idea is that if a vehicle is nearly destroyed, it's probably on fire and will soon be fully destroyed on its own. The relevant values in the object's Objects.con file are:

  ObjectTemplate.criticalDamage 12
ObjectTemplate.hpLostWhileCriticalDamage 1.5


The criticalDamage value is the number of hitpoints at or below which the object starts to self-destruct. This is usually about 10%-20% of the maxhitpoints, though can vary on up to 50%. The hpLostWhileCriticalDamage value gives how many hitpoints are lost per second when in the critical zone. Note that normally an engineer can repair at a faster rate than this damage rate and so can bring a vehicle back from the brink. The repair factor is set in as "objectTemplate.repairFactor 0.15", which is how much is repaired per 1/30th of a second, i.e. 4.5 hitpoints per second. While we are on the topic, medics heal using "objectTemplate.healFactor 0.25" for others (7.5 hitpoints/second) and "objectTemplate.selfHealFactor 0.15" (4.5 hitpoints/second) for themselves.

Abandonment Damage

This type of damage occurs when a vehicle is moved away from its spawn point and then left unattended. The vehicle will self-destruct after a certain amount of time. This type of damage is important for game play, as it means that abandoned vehicles will eventually disappear and then get replaced at its original spawn point. Unlike most other damage factors, these settings are found in the level's battle type ObjectSpawnTemplates.con file, e.g. Bf1942\Levels\Anzio\Conquest\ObjectSpawnTemplates.con. Here is an example:

  ObjectTemplate.TimeToLive 45
ObjectTemplate.Distance 40
ObjectTemplate.DamageWhenLost 10


These settings mean that if the vehicle is moved 40 meters or more away from its spawn point, it will have 45 seconds to live unattended. After this period, the vehicle will take 10 hitpoints of damage each second.

Upside-Down Damage

If an object's Objects.con has this property defined:

  ObjectTemplate.hpLostWhileUpSideDown 10


then the object takes this much damage per second when it is determined to be upside-down (even the slightest bit, i.e. rocking back and forth on its side).

Water/Drowning Damage

If an object's Objects.con has these properties defined:

  ObjectTemplate.damageFromWater 1
ObjectTemplate.hpLostWhileDamageFromWater 10


then it takes the amount of damage per second specified by hpLostWhileDamageFromWater when touching water. For soldiers, the standard definition, in objects\Soldiers\Common\CommonSoldierData.inc, is:

  ObjectTemplate.hpLostWhileDamageFromWater 1
ObjectTemplate.WaterDamageDelay 90
ObjectTemplate.DamageFromWater 1


The additional value WaterDamageDelay delays drowning damage for 90 seconds, then damage takes place at a hitpoint per second.

Desertion Damage

After nine seconds you take damage when you leave the battlefield, and a fully healthy soldier will then die in about six seconds. The game detects out of bounds by finding color "7", a specific terrain type, in the battle's materialmap.raw file. The relevant property for setting the amount of damage taken per second is game.damageForBeingOutsideWorld <float>, which defaults to 5.0 hitpoints per second. There is no command for changing the delay.

Damage Analysis Program

The damage.pl damage analysis program in the damage program archive can be used to analyze and debug any mod's weapons and armor behavior. The Damage Page is an example of output from this script, giving an analysis of BF 1942 and its two expansions.

To use this Perl program, you first need to install a Perl distribution, if you do not have one. ActiveState's Perl distribution is free and high quality.

To run the damage.pl script, you need to do a few things:

• Extract the damage.pl file from damage.zip to some directory, say C:\perlprogs.
• Extract the Objects.rfa and levels\Game.rfa files to some new directory. This is done by using the MDT's winRFA.exe program, at C:\Program Files\EA GAMES\Battlefield 1942\Mod Development Toolkit\Tools\RFA Tools\winRFA.exe and opening up each .rfa file.
• Open up a command prompt window. Click "Start | Run..." and type "cmd.exe".
• In the command window go to the directory where you unpacked the .rfa files. The program will examine all .con and .inc files found in this directory and all subdirectories.
You're now ready to run the perl script. To analyze the damage system for the mod, type:
    perl c:\perlprogs\damage.pl > myweapons.htm

This generates the analysis. Note that some of the information in this analysis is not generated by the program. Specifically, the "Direct Hit Defense Material IDs" section is not. This information is stored in the defenders' collision meshes, which the program does not analyze.

There are a few user options, including the ability to set table names for Desert Combat and Eve of Destruction weapons, and to see the (usually) unused armor types. You enable or disable these by editing the damage.pl file itself; the options are near the top of the file.

This program is not perfect. Since it does not have access to all the collision mesh materials, it will not find names for armor materials used on meshes but not used as splash damage materials anywhere. Set \$showallarmor=1 in the program if you want to see all armor types.

For Battlefield 1942 with the Secret Weapons expansion, the program will detect and warn that the MaterialDamage value for materials 256 and 257 gets reset. This is actually a feature, in that the .con files should normally not do this. The DP 1928 assault gun and the Wasserfall rocket were accidentally assigned to the same attack material, so these weapons cannot be used in the same mod without some work to redefine the material of one or the other.

Resources

See the Damage Page for much related information and a full rundown of BF weapons and armor. The Weapons Effects chart is a more readable (though less precise) presentation based on the Damage Page, and also includes data from empirical testing.

Acknowledgements

Thanks to Trevor Larkum for first outlining the basics of the projectile damage system to me, and to Patrik P. and the other programmers at DICE for answering my questions.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6385244131088257, "perplexity": 2399.9353953504065}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-17/segments/1618039398307.76/warc/CC-MAIN-20210420122023-20210420152023-00013.warc.gz"}