So after doing a bunch of butchery-related science, I've figured out some things like how item yields are calculated, and thought I'd share the write-up of my results. Maybe someone will find them useful (or it's already been done before, and I've seriously wasted my time
). I've not really shown my working (my notes are long and messy), aside from a few examples to better explain a point, but I have conducted enough tests that I'm fairly confident on my conclusions.
Most of the information is written assuming that you already know mostly how modding works (for example, I don't go into any explanation about what tissues are), and it's a bit unstructured, so just bear those in mind.
Calculating YieldsYields are calculated on a per part, per layer basis. Each tissue layer on a part is considered individually, even if multiple layers of the same part are made of the exact same materials. (footnote 1)
Step 1: Get the base volume of the tissue layerI'm not going to explain how RELSIZEs and RELATIVE_THICKNESSes work exactly, because I'm terrible at explaining things, so I'll just operate on the assumption that you know how they work, or have looked elsewhere for an explanation
The base volume of a tissue layer is based on what percent of its body part volume it represents (based on the layer's RELATIVE_THICKNESS compared to the RELATIVE_THICKNESS of all other layers), which is based on what percent of the whole body's unmodified base volume (defined with BODY_SIZE) that the part represents (based on the part's RELSIZE compared to the RELSIZE of all other parts).
Only these aspects - the relsizes of body parts, the base body size, and the relative thickness of a tissue layer compared to others on its part - are what are considered at this stage. Things like whether the layer thickens with strength, if the part has size modifiers, etc. aren't factored in here. This is an important thing to note: they have no impact on the relative base volumes of parts in this calculation! (footnote 2)
Even if a layer is now missing (like fat having melted off), its defined relative thickness is still factored in to the calculations - the volume of muscle on a part doesn't suddenly increase because the fat layer is gone or anything like that.
Step 2: Apply modifiers to each tissue layer's base volume to get its modified volumeThere are multiple different modifiers that affect the base volume to get the modified volume. Because these modifications happen after relsizes and such have been considered, they don't impact the volume / yields of any of the other layers on its body part, or any other body parts.
Each of these modifiers is applied as a multiplier to the base volume.
Body ModifiersThe HEIGHT, BROADNESS, and LENGTH of the creature's whole body is used as a modifier. The values for these can be set using the BODY_APPEARANCE_MODIFIER token (whenever these tokens are omitted, the default values are 100).
Modifier = (Body Height / 100) *(Body Broadness / 100) * (Body Length / 100)Body Part ModifiersThe HEIGHT, BROADNESS, and LENGTH of the body part are used as a modifier. The values for these can be set using the BP_APPEARANCE_MODIFIER token after selecting the part (whenever these tokens are omitted, the default values are 100).
Modifier = (Part Height / 100) * (Part Broadness / 100) * (Part Length / 100)Stronk and chonk - THICKENS_ON_STRENGTH and THICKENS_ON_ENERGY_STORAGEIf the tissue has the THICKENS_ON_STRENGTH or THICKENS_ON_ENERGY_STORAGE tokens, modifiers based on the creature's stats are applied.
- If a layer has just THICKENS_ON_STRENGTH, the multiplier is the creature's STRENGTH/1000.
- If a layer has just THICKENS_ON_ENERGY_STORAGE, the multiplier is the creature's fat amount / 250,000. Because a creature's "normal" fat level is 500,000, you'll likely notice adding this token to a tissue will double the yields from that tissue, as that value gives a 2x multiplier.
- If a layer has both THICKENS_ON_STRENGTH and THICKENS_ON_ENERGY_STORAGE, the multiplier is the mean average of the two multipliers combined (so the multiplier is: (Strength/1000 + Fat amount/250,000) / 2). This means that it some cases, you could end up getting lower item yields having both tokens than just having one.
Other ModifiersThe amount of a layer that's remaining after some of it has been lost does have some impact on its yield volume, however I didn't purposely investigate it. I'd assume that the % of layer that's remaining is used as a modifier. I did test what happens when a layer is fully gone, however - it yields 0 of its item, regardless of the special clauses (see: later).
Step 3: Get the item yieldsThe number of items yielded from butchering the tissue layer is based on a simple formula (however, there are some special cases that can modify the number of items):
Number of items = Modified volume / 25,000 (rounded down)In cases where the yield from this calculation is 0, there are two special clauses that can apply, based on the body part's size, and the modified volume of the tissue.
- Volume Clause: If the modified volume of a layer is at least 260, any yield of 0 is changed to 1.
- Part Size Clause: If the size of the body part that the tissue layer is a part of is at least 260, any yield of 0 is changed to 1. A layer could in practice represent even a tiny fraction of a volume unit, and yet still yield 1 item just because its part is 260 or bigger.
Butcher ItemsWhat items are actually yielded from butchering a tissue layer is based on the material it's made from. There are some specially-coded cases based on the materials tokens - for example, materials with the MEAT token will yield meat, materials with the BONE token will yield bone. The token BUTCHER_SPECIAL can be used to set the item yield to be any particular item you desire.
The item count isn't at all impacted by the size of the item being produced. If a layer's modified volume is big enough to yield 40 items, it'll yield 40 meat or 40 statues all the same.
Items with standard dimensions (e.g. BARS, THREAD, CLOTH) seem to be produced at those standard dimensions. For example, with a BUTCHER_SPECIAL:THREAD:NONE material that has a modified volume large enough for an item yield of 10, a stack of 10 thread items will be produced, each item being at 15000 dimensions.
Extra Butcher ObjectsExtra butcher objects don't impact the yields of butchering layers associated with the parts at all. They also don't care if the part they're attached to is big enough to yield at least 1 item if it was butchered regularly. So, an extra butcher object that's attached to a body part whose volume is below 260 will still drop its item, even if butchering the layers on that part might not yield anything.
NOMEAT, NOBONES etc.So how do the creature tokens such as NOMEAT and the like factor into yields for their items? They don't at all, as far as I can tell. Perhaps the tokens affect fort-mode butchering (not adventure mode/arena that I tested with), or the tokens are depreciated from an old version, or they're not supposed to do anything to do with butchering and handle something like whether entries show up in the stockpiles screen or not.
FootnotesA size 50,000 part is made up of 10 equally-sized tissue layers of the same material. If the calculations group the material volumes of each tissue layer with the same material together, we can expect an item yield of 2 (50,000 / 25,000), as there is 50,000 units worth of the material represented across those 10 layers. If each tissue layer is calculated individually instead, the yield will be 10 (as each layer will satisfy the Part Size Clause).
RESULTS:
Item yield: 10
CONCLUSION:
Each tissue layer is calculated individually.
A size 1000000 creature has 2 body parts of equal size. Each part has its own tissue with its own material yield - one meat, the other logs. The log-yielding body part has a height modifier of 200.
Normally, a creature of this size would yield a total of 40 items, so a creature with two equally sized body parts with tissues like this one would yield 20 meat from the meat-yielding part, and 20 logs from the log-yielding part.
If the part size modifier we've added to the log-yielding part is factored in while working out the relative sizes of the parts, we should see the yield of meat go down, since the meat-yielding part would be taking up a smaller ratio of the total creature size. However, if the body part modifier on the log-yielding part is applied as a bonus afterwards, we should see a meat yield of 20, and a log yield above 20.
RESULT:
Meat Yield: 20
Log Yield: 40
CONCLUSION:
Body part modifiers (as well as most other modifiers) aren't factored in to the initial sizing calculations, and are instead applied as bonuses afterwards.