- 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.
User:Tfaal/The Complete Dorf's Guide to Bodies
Bodies in Dwarf Fortress, as in real life, are complicated things. But while creating a functioning body from scratch in the real world will take you years of research and a descent into mad science, creating one in Dwarf Fortress only takes a few minutes, and keeps the mad science down to manageable levels. So hook up the lightning rod, throw on your goggles and practice your evil laugh, because we're about to stitch together some giblets.
Body parts are defined by the BP tag in the body_default file, and grouped together in collections with the BODY tag:
[BODY:BASIC_1PARTBODY] [BP:UB:body:bodies][UPPERBODY][LOWERBODY][CATEGORY:BODY] [DEFAULT_RELSIZE:2000]
This creates a body part called "body" with a relative size of 2000. Now, if body parts were all just made like that, there would be nothing telling the creature file how to put them together. So for limbs, organs and such, we do it like this:
[BODY:BASIC_3PARTARMS] [BP:RUA:right upper arm:STP][CONTYPE:UPPERBODY][LIMB][RIGHT][CATEGORY:ARM_UPPER] [DEFAULT_RELSIZE:200] . . .
That CONTYPE tag tells the right upper arm to connect with all body parts that have the UPPERBODY tag. There is no limitation on tags here. If I gave the upper body the SQUEDLEYSPOOCH tag, and then gave everything that connected to it CONTYPE:SQUEDLEYSPOOCH, it would work just fine. If I wanted to connect with that part specifically, I would use the CON tag. The syntax for the con tag is this:
[CON:RUA]
That tag tells the body part to connect with the part that has this pattern
[BP:RUA:blah blah blah:blah blah blah]
As you can see, the right upper arm fits this pattern, and so the two parts are connected.
In the creature_whatever file, these collections of body parts are then called via the BODY tag, like so:
[BODY:BODY_WITH_HEAD_FLAG:HEART:GUTS:BRAIN:MOUTH]
Here, things start getting complicated. In the material_template_default file, all of the physical properties of a given material are defined. Ignition point, shear yield, that kinda stuff. Here's the file for skin, as an example:
[MATERIAL_TEMPLATE:SKIN_TEMPLATE] [STATE_COLOR:ALL_SOLID:GRAY] [STATE_NAME:ALL_SOLID:skin] [STATE_ADJ:ALL_SOLID:skin]
Completely independent of this, the tissue_template_default file defines all the biological aspects of a tissue:
[TISSUE_TEMPLATE:SKIN_TEMPLATE] [TISSUE_NAME:skin:NP] [SCARS] [TISSUE_MATERIAL:LOCAL_CREATURE_MAT:SKIN] [RELATIVE_THICKNESS:1] [HEALING_RATE:100] [VASCULAR:1] [PAIN_RECEPTORS:5] [CONNECTS] [TISSUE_SHAPE:LAYER]
In the b_detail_plan_default file, material and tissue templates come together. First the materials are imported, --
[BODY_DETAIL_PLAN:STANDARD_MATERIALS] [ADD_MATERIAL:SKIN:SKIN_TEMPLATE] [ADD_MATERIAL:FAT:FAT_TEMPLATE] [ADD_MATERIAL:MUSCLE:MUSCLE_TEMPLATE] . . .
-- then the tissues:
[BODY_DETAIL_PLAN:STANDARD_TISSUES] [ADD_TISSUE:SKIN:SKIN_TEMPLATE] [ADD_TISSUE:FAT:FAT_TEMPLATE] . . .
Bear in mind that the b_detail_plan_default file only exists to make the creature_whatever files shorter. These things could just as effectively be done there.
Now we get to the meat of this. Adding the tissues to the body parts. This big ugly line here --
[BP_LAYERS:BY_CATEGORY:BODY:ARG3:50:ARG2:5:ARG1:1]
-- is basically saying "Take all parts that have the CATEGORY:UPPERBODY tag, and give them 50 thickness units of ARG3, 5 thickness units of ARG2, and 1 thickness unit of ARG1." What are those? That's up to the creature_whatever file to decide. Let's have a look at the dwarf entry in creature_standard:
[BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
As you can see, the first thing after VERTEBRATE_TISSUE_LAYERS is SKIN, so the ARG1 from b_detail_plan_default gets translated into skin. The same applies for fat, muscle, etc. So that line ends up reading as "Take the upper body, and add 50 thickness units of muscle, 5 thickness units of fat, and 1 thickness unit of skin." And there you have it! The upper body is defined. From here, defining organs is very similar. The only major thing left are body part positions and relations. Positions tell a body part where it is in relation to it's parent body part (the body part closer to the torso), like this:
. . . [BP_POSITION:BY_CATEGORY:CHEEK:FRONT] [BP_POSITION:BY_TOKEN:R_EAR:RIGHT] [BP_POSITION:BY_TOKEN:L_EAR:LEFT] . . .
Which translates too "Place everything in CATEGORY:CHEEK at the front of it's parent body part, then place the body part with token R_EAR on the right side of it's parent body part, etc." Relations are similar, but instead of giving position in terms of the parent body part, they do so in terms of other, disconnected body parts:
. . . [BP_RELATION:BY_CATEGORY:CHEEK:AROUND:BY_CATEGORY:TEETH:100] [BP_RELATION:BY_CATEGORY:CHEEK:AROUND:BY_CATEGORY:MOUTH:100] [BP_RELATION:BY_CATEGORY:LIP:AROUND:BY_CATEGORY:MOUTH:100] . . .
Well, that's about all there is to know about bodies. Hope this helped!