Now let's take a look at the weapon code.
[ITEM_WEAPON:ITEM_WEAPON_AXE_BATTLE]
[NAME:battle axe:battle axes]
[SIZE:800]
[SKILL:AXE]
[TWO_HANDED:47500]
[MINIMUM_SIZE:42500]
[MATERIAL_SIZE:4]
[ATTACK:EDGE:40000:6000:hack:hacks:NO_SUB:1250]
[ATTACK:BLUNT:40000:6000:slap:slaps:flat:1250]
[ATTACK:BLUNT:1000:1000:strike:strikes:pommel:1000]
I can't figure out most of this.
SIZE: Must have something to do with how big the weapon is, but what is the effect? What are the units?
SKILL: Clearly the skill used to fight with this weapon.
TWO_HANDED: This must have something to do with whether this weapon is two-handed, but how does it work? I note that for crossbows its value is zero. Crossbows are two-handed, so at first I thought that if some property of the weapon is above this value, it must be wielded with two hands.
MINIMUM_SIZE: What are the units? What does it mean? Does any battle axe made have to have this size regardless of what it's made from? And if so, what's up with SIZE? Or maybe this is the minimum size a creature has to be to be capable of wielding it?
MATERIAL_SIZE: I just don't know. The only thing I can think of is that it's some manner of quotient that indicates how much of this weapon's constituent material is present in the weapon, in order to determine its weight. If so, anyone got a guess what the math is?
Weight = mass divided by the acceleration of gravity, and mass = density multiplied by volume. We have access to all of the material densities, but there's no indication what the unit is or how volume is handled.
ATTACK: Luckily, this is mostly documented. The format is:
[ATTACK:EDGE or BLUNT:contact area:penetration size:verb used in the second person:verb used in the third person:noun substituted for the weapon's name:velocity modifier]
The difference between EDGE and BLUNT is documented: it determines whether penetration is a factor. That is, it determines whether this attack is compared against the yield, fracture, and elasticity against shearing or impact.
Contact area: I'm assuming that the higher this number, the larger the amount of tissue that is struck by the attack. I'm basing this on the fact that it's really high for the battle axe and really low for the spear. I'm assuming that, the larger the contact area, the larger the amount of tissue that can be damaged. This is surely a factor in whether limbs get cut off; it happens all the time with battle axes but never happens with bolts.
However, the way that tissues are damaged is handled by scores measured in kPa: kilopascals, a unit of pressure equal to 1000 Newtons of force over an area of one square meter. That's about 0.132 pounds per square inch. As a reference point, the typical pressure applied by the atmosphere on our bodies is 101.325 kPa, or 14.7 pounds per square inch. But that's not the point. The point is, assuming the same amount of force, a large contact area means a lower chance to fracture tissues than a small contact area. Therefore, weapons with a high contact area are inferior (they'd only inflict bruises) unless there's enough extra force behind them to make up for it. Question is, what determines the force of the blow?
If we tackle this from a mechanical physics level (an experimental approach supported by the fact that kPa are used in the game's math), then force = mass times acceleration, and mass = weight divided by the acceleration of gravity. Problem is, in order to calculate the amount of force at the time of impact, I gotta know the weight of the weapon, the distance that the weapon has to travel, and the amount of energy per unit of time that a given dwarf can exert. (Since there's no variable for weapon length, I can assume that the system doesn't take leverage into account. In order for it to do so, there'd also have to be a way to define, f'rinstance, how much an axe blade weighs in relationship to the rest of the axe. Not to mention a difference between thrusts and swings that wasn't merely cosmetic.)
If we can figure all that out, I can calculate how many kPa of pressure a given dwarf with a given weapon can apply to a tissue, which could be compared to the material fracture values to determine whether he'd be able to break that material (there's also clearly some random element at work in combat; there'd have to be some experimentation to determine whether the amount of pressure a blow applies is modified in either direction -- i.e. a ratio or additive modifier is applied to deviate from an average pressure -- or only downwards, as with a percentile ratio). Furthermore, it'd be nice to know what happens to a tissue that is merely bruised and not broken. Does bruising compromise the tissue's resistances? In what manner?
Not only would this information be useful for weapon and material modding, but it would also help to test the given fracture values to see if they're realistic -- and whether, even if they *are* realistic, if they are stylistically acceptable to Toady's or any modder's genre/gameplay sensibilities. In other words, I'm saying that Toady should enlighten us because it will help us test (and thus help him design) his game.
Penetration size: clearly, the higher this value, the greater the penetration of the attack, since piercing weapons have really high values for this. But how does it work? Since crossbow bolts have a higher penetration size than they do contact area, we can assume that it's not the portion of the contact area that gets penetrated. It must have something to do with penetration *depth*. Therefore, it must have something to do with how much strike energy is lost after breaking through one tissue, thus modifying the pressure applied to the next. Relative tissue thickness must also have something to do with this.
Moving past the verbs and noun, let's get to...
Velocity modifier: whoa. I'm really stuck now. This value either modifies the velocity of the blow (and by extension the pressure it applies on impact), or it modifies how long it takes the dwarf to perform this attack. Either way, it would appear that lower values are faster -- otherwise there's no advantage to pommel strikes, making them a useless thing to add to the game. I'm also guessing that 1000 is an average amount -- that it doesn't change anything in any way.
What makes me think that it might have something to do with how long it takes a creature to perform the attack is that the game seems to have an initiative system similar to that of ADOM. In ADOM, everything has a "Speed" score that averages at a hundred; every unit of time, that Speed value is added to a score called "Energy." When Energy reaches 1000, that creature gets to perform an action. I've noticed from adventurer mode that creatures in DF also have a speed score, although it seems to have an average of 1000. The manual says that every 10 frames, an "average, unburdened" dwarf will move one square. So it looks to me that this system is the same as the one in ADOM, except it's calculated out to one more digit.
(And, no, I don't think that reflects poorly on Toady. For one, I designed the same damn system myself almost ten years ago, except that the average speed was 15 and the total you had to reach to act was 30 -- it's common for people to design the same things without know about each other. For two, there's nothing wrong with stealing mechanics from other games. It's a normal and healthy part of game design. You can't copyright a rule, and for good reason.)
If that's true, then the velocity modifier might affect how often a creature gets to act. I dunno, though. It's gonna take some experimentation to figure out which of the above (if either) is true.
Now let's look at a ranged weapon.
[ITEM_WEAPON:ITEM_WEAPON_CROSSBOW]
[NAME:crossbow:crossbows]
[SIZE:400]
[SKILL:HAMMER]
[RANGED:CROSSBOW:BOLT]
[SHOOT_FORCE:1000]
[SHOOT_MAXVEL:100] This is just to make sure a near-weightless object doesn't go faster than the string could possibly go.
[TWO_HANDED:0]
[MINIMUM_SIZE:15000]
[MATERIAL_SIZE:3]
[ATTACK:BLUNT:10000:4000:bash:bashes:NO_SUB:1250]
We can ignore the stuff that's the same as contact weapons, but it bears mentioning that the ATTACK tag here isn't the one used for shooting; it's the one used for when you clobber things with your crossbow when you run out of ammo. The same goes for the SKILL tag. The edge/blunt, contact area, and penetration size of a ranged weapon are determined by the ammo you're using. (The AMMO definitions contain nothing that we haven't already seen, so there's no need to cover them.)
RANGED:CROSSBOW:BOLT identifies this as a ranged weapon, using the crossbow skill, and loaded with the BOLT subtype of AMMO.
SHOOT_FORCE must indicate how much force the weapon is fired with. Since it's not a contact weapon, force can't be calculated based on how much power the creature has; it has to be a property of the weapon. If you know the force behind the shot (given here) and the mass of the projectile (which can be calculated from its material density once we figure out how volume works), then you know how much it accelerates once that force is applied.
Now, in the real world, it will immediately begin decelerating once it leaves the bow, because the force has been removed; the only thing keeping it moving forward will be its own momentum, which will gradually give in to friction. Before it runs out of momentum, though, it's going to hit the ground. See, if you fire a bullet parallel to the ground and drop a bullet from the same height, they'll hit the ground at the same time. Going fast doesn't give you more hang-time. (I was going to say "arrow" instead of bullet, but I just remembered that the flights on arrows probably convert some of its thrust into lift, meaning that it *won't* fall as fast as a dropped arrow. It'll still fall before it runs out of momentum though.)
But, I've got no clue whether any of that is accounted for by DF's system. Until I know, there's no hope of calculating the actual effectiveness of a ranged weapon.
SHOOT_MAXVEL would seem to put a cap on how fast the projectile can travel. I wonder if this is necessary, though. If densities, volumes, and SHOOT_FORCE are set properly, nothing should be able to travel at an unrealistic speed. Also, to address Toady's comment in the file, it's not exactly relevant how *fast* the string moves. What matters is how much energy is being transferred from the bow to the string and from the string to the bolt. Which determines speed, sure, but speed *by itself* is irrelevant. The bolt and the string don't have to travel at the same speed, and probably won't (at least as soon as they lose contact) because of their different masses.
This post was basically a long way of saying that I don't know. But I wanted to show that I was trying. I'm pretty much lost in this stuff. The blend of absolute units (like kPa) with arbitrary units (like relative tissue thickness) with mystery units (like contact area) has me hopelessly confounded. Can anyone shed some light on the issue?
edited to correct a typo