# v0.34 Talk:Weight

## Clothing/armor weights[edit]

I crunched some numbers and came up with a calculation for the weight of armor or clothing:

Clothing weight = [BODY_SIZE]*(percentage)*[COVERAGE]*[LAYER_SIZE]*[SOLID_DENSITY]*(step factor)/10000000000

Where:

[BODY_SIZE] is of the creature that the clothing was created for (i.e. dwarf adult is 60000)

(percentage) is the relative size of the body part the clothing was created for, divided by the sum of relative sizes of the creature's body parts. See [BODY_DETAIL_PLAN:HUMANOID_RELSIZES] for reference. On most humanoids the head is 0.051 (i.e. 5.51%), the upper body and lower body are each 0.1836 (18.36%), each hand is 0.0147 (1.47%) and each foot is 0.022 (2.2%).

[COVERAGE] and [LAYER_SIZE] are clothing properties. [SOLID_DENSITY] is of the clothing material.

The (step factor) is for the clothing [UBSTEP] [LBSTEP] [UPSTEP]. Start with 1.00, and add 0.25 for each unit of step on the clothing. Possible step factors are 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, and 2.5. Robes, with MAX UBSTEP and MAX LBSTEP have a step factor of 2.5. Breastplates have 0 step, so they use a factor of 1.0. Mail shirts have UBSTEP 1 and LBSTEP 1, so they use a step factor of 1.5. Gauntlets have UPSTEP 1, so the step factor is 1.25.

Therefore we calculate the weight of a dwarf-sized iron greaves to be: 60000*0.1836*100*15*7850/10000000000*1.75=22.7

This calculation has been verified for several creature sizes and several worn clothing items. --UristDaVinci 07:40, 22 September 2012 (UTC)

- I've just checked a disassembly and I came up with the following formula for volume: BASE_SIZE * COVERAGE/100 * LAYER_SIZE/100. BASE_SIZE is calculated from some undetermined values within the caste raws (chosen by whatever race made the armor) using the whatever STEP values are available (in DFHack, they're all in caste_raw.unknown2.unk26[...], currently defined as a single int32[33] array though it's actually divided into 6 sections, one per armor type), using the number 1000 if the "maker race" wasn't available. The notable exceptions to this formula are shields (no coverage or layer_size) and helms (no step factors). --Quietust 15:07, 22 September 2012 (UTC)
- So if we use the "volume to weight" formula from the topic page we can solve for your BASE_SIZE as follows using the definitions above:

- BASE_SIZE: [BODY_SIZE]/10*(percentage)*(step factor)

- I thought it was interesting that when I changed body part sizes during the testing, doing things like making the upper arms huge didn't make for huge mail shirts. The step factors don't appear to actually check the body parts they cover, but just change a multiplier to the volume calculated based on the body part the clothing is worn on. --UristDaVinci 17:32, 22 September 2012 (UTC)

## Volume[edit]

Is "volume" as given here ever used anywhere without "*10"? Because wouldn't it be easier to use SIZE / CAPACITY units consistently and don't have *10 and /10 all over? - TBeholder 04:18, 23 October 2012 (UTC)

- The x10 factor is just a mathy way to say that the volume should be handled with 10 cm
^{3}(1 centiliter) precision (SIZE / 10 is an integer division, so by dividing and multiplying by 10 you just truncate last digit). However it's more convenient to think about volume in cm^{3}than in centiliters. So you are right that in practice you can almost always ignore x10 factors when SIZE is used and simplify calculation (most of game object sizes are multiples of 10 anyway). It will not work for non-multiples of 10, though. --Njals (talk) 00:19, 8 May 2013 (UTC)