v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Material science"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m (Removing {{migrated article}})
(→‎Effects on Combat: rewrite alpha)
Line 43: Line 43:
  
 
==Effects on Combat==
 
==Effects on Combat==
The Dwarf Fortress combat system does not use all material properties at present (0.34.11). Weapon and armor damage/wear/decay is not tracked.  
+
The Dwarf Fortress combat system does not use all material properties at present (0.40.05). Weapon and armor damage/wear/decay is not tracked.  
  
The mechanics governing how material properties impact the protection armor provides against projectiles have been [http://www.bay12forums.com/smf/index.php?topic=116151.0 studied reasonably carefully], and are described below. Armor protection from melee weapons has not been studied in detail, although it likely shares many similarities with ranged weapons. '''''Note: all of the below is based on recent (0.34.11) experiments, and is no longer correct due to changes made in 40.05. Testing is [http://www.bay12forums.com/smf/index.php?topic=141364 ongoing] to find the appropriate values for 40.05.'''''
+
The formulae below have been reverse-engineered [http://www.bay12forums.com/smf/index.php?topic=131995.0] [http://www.bay12forums.com/smf/index.php?topic=142372.0] and experimentally proven [http://www.bay12forums.com/smf/index.php?topic=116151.0] [http://www.bay12forums.com/smf/index.php?topic=141364] by several independent researchers. Below are the simplified results; for more details see links above.
  
===Projectile Properties===
+
===Attack Types===
The main factor determining if a projectile penetrates armor is its momentum.  Material properties of the bolt/arrow (except for IMPACT_YIELD, which will be described below), as well as bolt quality and marksdwarf/archer skills do not appear to matter (the skill of the marksdwarf determines if the bolt misses, hits, is dodged, or is blocked with a shield).  Dwarven weapons launch projectiles with roughly constant momentum. However rounding of projectile masses can result in some very strange behavior.  The complete calculation used to determine projectile momentum is as follows:
+
Both creatures and items can have [ATTACK] tokens. A creature can execute any of its natural attacks plus any attacks of the items it holds.
*Find the mass of your projectile.  Mass=SOLID_DENSITY*SIZE/1,000,000.
+
The attacks marked with [EDGE] flag deliver ''edged'' damage which is governed by [SHEAR_*] tokens; they can be further differentiated by attack contact area: generally concentrated strikes (area of 50 or less) are considered ''stabbing'' while wider areas correspond to ''slashing'' attacks. This distinction shall be emphasized later.
*Floor that number to an integer.
 
*Divide the SHOOT_FORCE of the weapon by the integer, and round the result to the nearest integer.
 
*Cap the results by the SHOOT_MAXVEL for the weapon.
 
*Multiply the velocity by the ''unrounded'' mass of the projectile to get the momentum.
 
For DF34.11 values, iron, bronze, copper, silver, and steel bolts/arrows all have mass between 1 and 2, which will be floored to 1, meaning that they will have velocity equal to SHOOT_FORCE (so long as it is less than or equal to SHOOT_MAXVEL).  Wood, adamantine, and bone bolts/arrows, as well as all blowdarts, have mass less than 1, and will have velocity which is always equal to SHOOT_MAXVEL and does not depend on SHOOT_FORCE.
 
  
===Interactions Between Projectiles and Armor===
+
Every other attack is considered ''blunt''. [IMPACT_*] tokens affect blunt combat. Most specialised blunt weapons have small contact area; edged weapons generally also have blunt attacks with larger area values; items or creatures without defined attacks get default blunt attack with area = (size)^2/3.
[[File:projectile.png|200px|thumb|right|A simplified flowchart showing how material properties are used as a projectile contacts armor.]]
+
Under certain circumstances edged attack can be converted to blunt, but not otherwise.
When a projectile strikes armor, there are several possible outcomes:
 
*Conversion of edged damage to blunt damage (chain mail does this).
 
*The projectile absorbs the force of the collision, and is deflected.
 
*The armor absorbs all or part of the force of the blow.
 
*The armor is fractured and does nothing to stop the projectile.
 
For armor to be at all effective at stopping projectiles, the armor material must have SHEAR_YIELD and/or SHEAR_FRACTURE greater than or equal to the projectile material.  Otherwise, the projectile just cuts through the armor like it isn’t there.  Additionally, the IMPACT_FRACTURE of the armor must be large relative to the projectile momentum, or the armor fractures and the projectile passes through without slowing down significantly (this happens for metal bolts against any plate armor in 0.34.11).  
 
  
====Conversion of Edged Damage to Blunt Damage====
+
Wrestling moves are special: '''breaking bones''' uses [BENDING_*] values, '''pinching''' utilizes [COMPRESSIVE_*] properties, and '''biting''' can  deal [TENSILE] or [TORSION] damage depending on whether the attack is edged. Those attacks generally ignore armor.
If the momentum of the projectile is not too high, then chain armor can convert the edged damage normally caused by projectiles to blunt damage, resulting in chips, fractures, jams and bruises, but no tears or cuts.  Plate armor does not appear to provide this type of protection under any conditions tested so far.  It is not yet known how the momentum needed for edged damage to penetrate chain armor is calculated, but for the cases examined the momentum needed is many times larger than those observed for in-game projectiles.
 
  
====The Projectile Absorbs the Force of the Collision====
+
===Contact Area===
If the projectile does not cut right through the armor (armor material must have SHEAR_YIELD and/or SHEAR_FRACTURE greater than or equal to the projectile material), then it must push in a chunk of the armor.  If the armor is not strong enough to resist being pushed in (armor resisting the blow is covered in the next section), then the force to push in the armor is proportional to the mass of the chunk of armor.  If the projectile material is not strong enough to exert this force, then it is deformed and deflects.  The following algorithm determines if this type of deflection occurs:
+
Attack contact area is the minimum of weapon contact area and armor/layer contact area.
*Calculate the volume of armor moved by the projectile.  Multiply armor LAYER_SIZE by projectile CONTACT_AREA, and then round down to the nearest 100.  If the result is less than 100, then instead round up to 100.
+
Body parts have areas dependant on their size, as with non-weapon items; part size is <u>creature size</u> '''times''' <u>relative size of the part in proportion to whole body</u>.
*Mass=armor SOLID_DENSITY times the volume from the last step
 
*If the IMPACT_YIELD of the projectile is less than mass*(800/157)/PROJECTILE_SIZE, then the projectile deforms and is reported as “deflected”.
 
In-game, this type of deflection is observed for wood bolts impacting metal armor, and explains why adamantine is observed to be the worst armor for deflecting wood bolts, as it has the lowest density. As explained below, adamantine can barely stop wood bolts using the "Armor Absorbs the Force of the Collision" mechanism, and wood bolts would easily fracture copper or steel armor were it not for the higher densities of those metals causing the projectile to absorb the force of the collision instead.
 
  
====The Armor Absorbs the Force of the Collision====
+
Armor size is calculated as <u>underlying body part size</u> '''times''' <u>coverage/100%</u> '''times''' <u>size/100</u> '''times''' <u>1+(UPSTEP+UBSTEP+LBSTEP)/4</u>; MAX count as 3 in the last sum.
  
This form of deflection depends only on the momentum, but not the material, of the projectile. The armor will provide 50% protection from projectiles if
+
(armor tables go here)
momentum = (IF-IY/2)*round100(C*S)/(2400000-AU*10000-Q*30000)
+
 
 +
===Attack Momentum===
 +
DF uses momentum-based combat physics, so the momentum plays central role in calculations.
 +
Since momentum equals velocity times mass, and lighter items can be swung faster, attack momentum is largely independent from weapon weight. The simplified formula is as follows:
 +
 
 +
M = Str * Vel / ( 10^6/Size + 10*F/W ),
 +
 
 +
where:
 +
* '''Str''' is creature strength (e.g. 1250 for average dwarf)
 +
* '''Vel''' is weapon's velocity modifier if present (e.g. 1.25x, 2x)
 +
* '''Size''' is normal creature size (e.g. 60000 for dwarves)
 +
* '''F''' is "fatness modifier" (also includes muscle); dwarf with weight of 66000 will have F=66000/60000=1.1
 +
* '''W''' is weapon weight in kilograms (Γ).
 +
 
 +
(There is also supposed to be a velocity limit but little is known about its precise value.)
 +
 
 +
Momentum can be further increased with weapon skill, status effects, attack modifiers etc.
 +
 
 +
====Ranged Attacks====
 +
Attacks from missile launchers are entirely dependent on launcher's [SHOOT_FORCE] and [SHOOT_MAXVEL] tags.
 +
Specifically, as long as projectile is heavy enough, it is fired with momentum of SHOOT_FORCE/20; if this would make its speed exceed SHOOT_MAXVEL, it is capped at this value instead.
 +
(As usual, momentum = velocity times weight.)
 +
Vanilla bolts and crossbows end up with momenta of 50, as long as their density exceeds 1670.
 +
 
 +
===Attack Momentum Costs===
 +
The attack generally needs some momentum threshold to break through each armor/tissue layer.
 +
If the attack is '''edged''', it also can cut through it instead. For latter it has to have momentum no less than:
 +
 
 +
M >= (rSY + (A+1)*rSF) * 10 / Q,
  
 
where:
 
where:
*IF is IMPACT_FRACTURE,
+
* '''rSY''' is the ratio of layer's to weapon's SHEAR_YIELD
*IY is the IMPACT_YIELD of the armor material,
+
* '''rSF''' is ditto with SHEAR_FRACTURE
*C is the CONTACT_AREA of the projectile (although it is the smaller of the projectile's contact area and the body part struck's contact area),
+
* '''A''' is attack contact area
*S=LAYER_SIZE of the armor item(s) covering the body part struck,
+
and '''Q''' is sharpness multiplier, specifically [[edge|sharpness]]/5000. For most metals (those with [MAX_EDGE:10000]) it equals quality multiplier (1.4x for fine, 2x for masterwork etc.) For materials with superior MAX_EDGE, add additional multiplier: 1.2x for [[divine metal]], 1.5x for [[glass]], 2x for [[obsidian]] and 10x for [[adamantine]].
*AU is the target's armor user skill (0=none, 16=legendary), and
+
 
*Q is the armor quality (0=none, 5=masterwork).
+
Should it exceed this value, attack momentum is decreased by some 5% and the layer is considered punctured/severed. Calculations then repeat for the underlying layer. Otherwise damage is converted to blunt ''just for this layer'' and proceeds as following.
*The function round100(x) is equal to 100 if x is less than 100, and 100*floor(x/100) otherwise (rounded down to the nearest 100).
+
 
 +
'''Blunt attacks''' can be deflected entirely if weapon's IMPACT_YIELD is low relative to layer's density; this is rarely the case.
 +
Otherwise, attack must have minimum momentum of:
 +
 
 +
M >= (2*IF - IY) * A / 500,
 +
 
 +
where IF and IY are IMPACT_FRACTURE/1000 and IMPACT_YIELD/1000 respectively, and A is contact area as above.
 +
Again, on success layer is considered thrashed, momentum is reduced by about 5% and next layer is tested.
 +
 
 +
If both edged and blunt momenta thresholds haven't been met, attack is ''permanently'' converted to blunt and its momentum may be greatly reduced.
 +
Specifically, it is multiplied by SHEAR_STRAIN_AT_YIELD/50000 for ''edged'' attacks or IMPACT_STRAIN_AT_YIELD/50000 otherwise. I.e., most metals reduce blocked attacks by 98%-99%; but see below.
 +
 
 +
===Elastic Material Modifiers===
 +
Clothing with [STRUCTURAL_ELASTICITY_*] tokens has its stress properties modified.
 +
 
 +
Items with [STRUCTURAL_ELASTICITY_CHAIN_ALL] or metallic items with [STRUCTURAL_ELASTICITY_CHAIN_METAL] have their [*_STRAIN_AT_YIELD] increased to 50000, which means that blocked attack will not be dampened; it still may be converted to ''blunt'', however. Metal leggings and chainmail shirts have this property in vanilla.
 +
 
 +
Items made of cloth (including adamantine!) with [STRUCTURAL_ELASTICITY_WOVEN_THREAD] additionally have their SHEAR values reduced to negligible 20-30 kPa. This makes candy clothing especially useless in combat. Caps and all clothing have this tag in vanilla.
 +
 
 +
===Penetration Depth===
 +
This is also very important parameter.
 +
Please write something about it.
  
It unclear if or how the thicknesses of multiple armor layers covering one body part stack. This formula is approximate, and the exact values of the coefficients in the denominator may not be accurate.  The amount of protection provided drops sigmoidally from 100% to zero over a fairly narrow range. Furthermore, negative status of the target creature (fallen over, unconscious, etc.) are known to significantly reduce armor protection provided. These numbers will roughly predict the results for an ideal, uninjured dwarf, and worse protection should be expected in other cases.  The exact manner in which status affects impact armor protection has not yet been explored.
+
===Pulping===
 +
<pre>
 +
Pulping appears to work by evaluating the layers in a body part.  
 +
If each layer meets any one of the following criteria then the body part is pulped:
 +
a) 100% bruised/burned/frostbite/melt/necrosis/blister/boil/freeze/condense (i.e. 10000+ in layer_effect_fraction)
 +
b) 250% dented (i.e. 25000+ in layer_dent_fraction)
 +
c) 100% cut (i.e. 10000+ in layer_cut_fraction) (cut in this case is synonymous with fracture)
  
The manner in which armor offers protection is different depending on whether the bolt momentum is greater than 50000/IMPACT_STRAIN_AT_YIELD. If momentum is less than this threshold, then armor can completely deflect projectiles, while if it is larger, armor can significantly slow projectiles so that they cause only bruises (not tears, chips, fractures, or jams).  
+
Spines, skulls, and perhaps other body parts have the [PREVENTS_PARENT_COLLAPSE] token which prevents the parent body part (such as
 +
the head, upper body, or lower body) from being pulped until the sub-part is broken. It appears that only external body parts can be pulped,  
 +
not internal organs. You will find that boneless body parts that don't contain a spine/skull part will pulp VERY easily (i.e. eyes/ears).  
  
This type of collision is only observed in-game for bolts with densities less than about 750 (most wood, adamantine) deflecting off adamantine armor.  In all other cases the bolt momentum is far to high to be stopped by any armor using this mechanism.
+
There does not appear to be any distinctions between the combat text descriptions of the pulping,
 +
beyond the messages being appropriate to the weapon used (edged, blunt, or creature body part).
 +
</pre>
  
 
{{Category|Materials|*}}
 
{{Category|Materials|*}}

Revision as of 16:39, 17 January 2015

This article is about the current version of DF.
Note that some content may still need to be updated.

Materials have a number of properties representing real world variables that describe how they respond to inputs. In particular, the game now has a number of variables that describe what happens to a material when it's put under stress.

What is stress?

In the real world, an object is stressed when a force is applied to the object. Depending on the nature of the force applied, this stress can take a number of forms, and the object can respond differently based on its material and how that material handles different stresses.

In the material raws, whenever you see 'yield', 'fracture', or 'strain at yield', that property is a stress-related quality.

When does Dwarf Fortress make stress calculations?

At present, DF seems to only apply forces during combat, and thus only stresses objects (generally armor and various body layers) at that time.

There's a lot of stress-related properties, what do they mean?

The first thing you'll notice is that the second word in each stress variable is one of Yield, Fracture, or strain at yield. These are mechanical performance terms.

The first set of words are things like Impact, Bending, and so forth. These describe modes of applying force.

The following explanations assumes real world physics sort of apply (since Toady One chose real world properties). The game doesn't use all of these properties yet, and may not be applying them according to real world physics.

Mechanical Performance Properties

Yield: This is almost certainly 'Yield Strength', which is the amount of stress needed to cause a material to go from elastic deformation to plastic deformation. (That is, if you cease stressing the object, does it revert to its original shape or not). Since most objects only elastically deform over small distances of deformation, high Yield values generally means it takes a lot of force to noticeably 'stretch' them (but see strain at yield).

Fracture: The fracture point is the amount of stress or force necessarily to cause the material to fail, or in other words, to break.

Strain at yield (sometimes incorrectly referred to as 'elasticity'): This variable tells you how much deformation occurs to the material while it is deforming elastically. That is, as long as the force is less than the yield strength, stress * strain at yield = deformation distance. The smaller the strain at yield, the less deformation occurs under stress.

Note: Strain at yield is the inverse of the Elastic Modulus. Thus a highly elastic material has low elastic modulus, and engages in less elastic collisions.

Modes of Applying Force

Impact: Force applied by a sudden strike, like a hammer.

Compressive: Force applied by exerting pressure on an object, like trying to squish something between your hands.

Tensile: Force applied by pulling on something, like suspending one object via another. (e.g., if you suspend an elf from a metal pole, you are applying a tensile force to the pole).

Torsion: Force applied by twisting something. Note that you're twisting some portion of the object relative to itself to cause a torsion stress to be applied to it. (Consider trying to twist a metal rod by grasping at either end and attempting to wring it - yes, you'd have to apply a lot of force to succeed).

Shear: Force applied by pushing part of the material so it tries to slide relative to another part of it. Ie, pushing at the top of an object when the bottom part is fixed to the ground is going to primarily apply a shear stress to it (the top part will try to move in the direction you push, and the lower part will resist this shear stress).

Bending: Force applied by bending a material.

Effects on Combat

The Dwarf Fortress combat system does not use all material properties at present (0.40.05). Weapon and armor damage/wear/decay is not tracked.

The formulae below have been reverse-engineered [1] [2] and experimentally proven [3] [4] by several independent researchers. Below are the simplified results; for more details see links above.

Attack Types

Both creatures and items can have [ATTACK] tokens. A creature can execute any of its natural attacks plus any attacks of the items it holds. The attacks marked with [EDGE] flag deliver edged damage which is governed by [SHEAR_*] tokens; they can be further differentiated by attack contact area: generally concentrated strikes (area of 50 or less) are considered stabbing while wider areas correspond to slashing attacks. This distinction shall be emphasized later.

Every other attack is considered blunt. [IMPACT_*] tokens affect blunt combat. Most specialised blunt weapons have small contact area; edged weapons generally also have blunt attacks with larger area values; items or creatures without defined attacks get default blunt attack with area = (size)^2/3. Under certain circumstances edged attack can be converted to blunt, but not otherwise.

Wrestling moves are special: breaking bones uses [BENDING_*] values, pinching utilizes [COMPRESSIVE_*] properties, and biting can deal [TENSILE] or [TORSION] damage depending on whether the attack is edged. Those attacks generally ignore armor.

Contact Area

Attack contact area is the minimum of weapon contact area and armor/layer contact area. Body parts have areas dependant on their size, as with non-weapon items; part size is creature size times relative size of the part in proportion to whole body.

Armor size is calculated as underlying body part size times coverage/100% times size/100 times 1+(UPSTEP+UBSTEP+LBSTEP)/4; MAX count as 3 in the last sum.

(armor tables go here)

Attack Momentum

DF uses momentum-based combat physics, so the momentum plays central role in calculations. Since momentum equals velocity times mass, and lighter items can be swung faster, attack momentum is largely independent from weapon weight. The simplified formula is as follows:

M = Str * Vel / ( 10^6/Size + 10*F/W ),

where:

  • Str is creature strength (e.g. 1250 for average dwarf)
  • Vel is weapon's velocity modifier if present (e.g. 1.25x, 2x)
  • Size is normal creature size (e.g. 60000 for dwarves)
  • F is "fatness modifier" (also includes muscle); dwarf with weight of 66000 will have F=66000/60000=1.1
  • W is weapon weight in kilograms (Γ).

(There is also supposed to be a velocity limit but little is known about its precise value.)

Momentum can be further increased with weapon skill, status effects, attack modifiers etc.

Ranged Attacks

Attacks from missile launchers are entirely dependent on launcher's [SHOOT_FORCE] and [SHOOT_MAXVEL] tags. Specifically, as long as projectile is heavy enough, it is fired with momentum of SHOOT_FORCE/20; if this would make its speed exceed SHOOT_MAXVEL, it is capped at this value instead. (As usual, momentum = velocity times weight.) Vanilla bolts and crossbows end up with momenta of 50, as long as their density exceeds 1670.

Attack Momentum Costs

The attack generally needs some momentum threshold to break through each armor/tissue layer. If the attack is edged, it also can cut through it instead. For latter it has to have momentum no less than:

M >= (rSY + (A+1)*rSF) * 10 / Q,

where:

  • rSY is the ratio of layer's to weapon's SHEAR_YIELD
  • rSF is ditto with SHEAR_FRACTURE
  • A is attack contact area

and Q is sharpness multiplier, specifically sharpness/5000. For most metals (those with [MAX_EDGE:10000]) it equals quality multiplier (1.4x for fine, 2x for masterwork etc.) For materials with superior MAX_EDGE, add additional multiplier: 1.2x for divine metal, 1.5x for glass, 2x for obsidian and 10x for adamantine.

Should it exceed this value, attack momentum is decreased by some 5% and the layer is considered punctured/severed. Calculations then repeat for the underlying layer. Otherwise damage is converted to blunt just for this layer and proceeds as following.

Blunt attacks can be deflected entirely if weapon's IMPACT_YIELD is low relative to layer's density; this is rarely the case. Otherwise, attack must have minimum momentum of:

M >= (2*IF - IY) * A / 500,

where IF and IY are IMPACT_FRACTURE/1000 and IMPACT_YIELD/1000 respectively, and A is contact area as above. Again, on success layer is considered thrashed, momentum is reduced by about 5% and next layer is tested.

If both edged and blunt momenta thresholds haven't been met, attack is permanently converted to blunt and its momentum may be greatly reduced. Specifically, it is multiplied by SHEAR_STRAIN_AT_YIELD/50000 for edged attacks or IMPACT_STRAIN_AT_YIELD/50000 otherwise. I.e., most metals reduce blocked attacks by 98%-99%; but see below.

Elastic Material Modifiers

Clothing with [STRUCTURAL_ELASTICITY_*] tokens has its stress properties modified.

Items with [STRUCTURAL_ELASTICITY_CHAIN_ALL] or metallic items with [STRUCTURAL_ELASTICITY_CHAIN_METAL] have their [*_STRAIN_AT_YIELD] increased to 50000, which means that blocked attack will not be dampened; it still may be converted to blunt, however. Metal leggings and chainmail shirts have this property in vanilla.

Items made of cloth (including adamantine!) with [STRUCTURAL_ELASTICITY_WOVEN_THREAD] additionally have their SHEAR values reduced to negligible 20-30 kPa. This makes candy clothing especially useless in combat. Caps and all clothing have this tag in vanilla.

Penetration Depth

This is also very important parameter. Please write something about it.

Pulping

Pulping appears to work by evaluating the layers in a body part. 
If each layer meets any one of the following criteria then the body part is pulped:
a) 100% bruised/burned/frostbite/melt/necrosis/blister/boil/freeze/condense (i.e. 10000+ in layer_effect_fraction)
b) 250% dented (i.e. 25000+ in layer_dent_fraction)
c) 100% cut (i.e. 10000+ in layer_cut_fraction) (cut in this case is synonymous with fracture)

Spines, skulls, and perhaps other body parts have the [PREVENTS_PARENT_COLLAPSE] token which prevents the parent body part (such as 
the head, upper body, or lower body) from being pulped until the sub-part is broken. It appears that only external body parts can be pulped, 
not internal organs. You will find that boneless body parts that don't contain a spine/skull part will pulp VERY easily (i.e. eyes/ears). 

There does not appear to be any distinctions between the combat text descriptions of the pulping, 
beyond the messages being appropriate to the weapon used (edged, blunt, or creature body part).