To walk through a specific example (possibly incorrectly, but I do my best!): the Shotgun Messiah crate. Starts with this block in blocks.xml (it actually starts with the sealed crate block, which degrades to this 'loot container' block after you beat on it):
<block name="cntLootCrateShotgunMessiah">
<property name="Extends" value="cntGarageStorage"/>
<property name="LootList" value="50"/>
</block>
The LootList value points to this from loot.xml:
<!-- shotgun Messiah -->
<lootcontainer id="50" count="1,3" size="6,4" sound_open="UseActions/open_cardboard" sound_close="UseActions/close_cardboard" loot_quality_template="qualBaseTemplate">
<item group="groupAmmoRegular" prob=".3"/>
<item group="groupWeaponsAllScaled" prob=".4"/>
<item group="groupModAllScaled" prob=".1"/>
<item group="weaponParts" count="1,5" prob=".15"/>
<item group="groupArmorScaled" prob="0.2"/>
<item name="resourceRepairKit" count="2,3" prob="0.1"/>
</lootcontainer>
Diving into groupWeaponsAllScaled (also in loot.xml) we get:
<lootgroup name="groupWeaponsAllScaled">
<item group="groupWeaponsMeleeScaled"/>
<item group="groupWeaponsRangedScaled"/>
</lootgroup>
And deeper into the rabbit hole, groupWeaponsMeleeScaled, where it gets more interesting:
<lootgroup name="groupWeaponsMeleeScaled">
<item group="groupWeaponsT0_Melee" loot_prob_template="ProbT0"/>
<item group="groupWeaponsT1_Melee" loot_prob_template="ProbT1"/>
<item group="groupWeapons_MeleeParts" loot_prob_template="ProbT1"/>
<item group="groupWeaponsT2_Melee" loot_prob_template="ProbT2"/>
</lootgroup>
So the way I interpret this is that, like any loot group, any <item> in the group has a probability - usually just a number like in the <lootcontainer> above. In this case the game assigns a full probability template, based on GS, to each item. So for Tier-0 Melee ("groupWeaponsT0_Melee"), we find this:
<lootprobtemplate name="ProbT0">
<loot level="0,2" prob="0.16"/>
<loot level="3,4" prob="0.2"/>
<loot level="5,7" prob="0.3"/>
<loot level="8,9" prob="0.37"/>
<loot level="10,12" prob="0.49"/>
<loot level="13,14" prob="0.58"/>
<loot level="15,16" prob="0.72"/>
<loot level="17,19" prob="0.83"/>
<loot level="20,21" prob="1"/>
...
<loot level="46,999999" prob="0"/>
<lootprobtemplate>
This can't be considered by itself, however since
each <item> entry from the "groupWeaponsMeleeScaled" has a probability. So let's also look at Tier-1 Melee ("groupWeaponsT1_Melee"), which is also in the lootgroup:
<lootprobtemplate name="ProbT1">
<loot level="0,9" prob="0"/>
<loot level="10,12" prob="0.04"/>
<loot level="13,14" prob="0.04"/>
<loot level="15,16" prob="0.05"/>
<loot level="17,19" prob="0.05"/>
<loot level="20,21" prob="0.06"/>
<loot level="22,24" prob="0.1"/>
So taking these two tables together with some example GS:
GS
Prob of T0 Melee raw/actual
Prob of T1 Melee raw/actual
1
0.16 / 1.0 (i.e. 100% chance)
0.0 / 0.0 (no chance)
10
0.49 / 0.924 (92%)
0.04 / 0.076 (8%)
20
1.0 / 0.943 (94%)
0.06 / 0.067 (7%)
The "actual" numbers there (which are not the
true actual numbers because the lootgroup has 2 other <item> entriesI didn't include) have to do with how 7D2D computes final probability among a set of possibilities. As far as I understand it, all individual probabilities are added up (may not add up to exactly 1.0!) and then each item's probability is divided by the total to result in an "actual" probability. I think they recently have made some adjustments to try to get more multi-item groups to add up cleanly to 1.0 so it's easier to interpret.
I wonder if thats really how it works.... the XML is a little odd to me. For example, looking at T3, it seems like your chance of getting one steadily increases (which makes sense) until it gets to 100% at GS185-187. Then it starts decreasing. So the higher you get, the less chance of finding a T3.... that doesn't make sense to me. There has to be more to it that I'm just not seeing.
Yeah, it's because of the probability calcs. To take a very simple fake example:
<lootgroup>
<item name="PUPPY!" prob="1.0">
<item name="KITTY!" prob="1.0">
<item name="ALLIGATOR!" prob="1.0">
<lootgroup>
That lootgroup would not be guranteed to provide you a puppy, a kitty, and an alligator (as fun as that might sound). What the game does is adds up all the probabilities and then divides each item by the total. Total is 3.0, each item is 1.0, so actually each item has a 1/3 chance of being the looted item. Note that 1.0 is the default probability so any <item> entry which doesn't have a probability assigned counts as 1.0 (I think).
It gets much more complex when probability tables are involved, but generally just know that the numbers you see increasing to 1.0 and then decreasing are combined with
other numbers from
other probability distributions (scaled differently across the gamestages) which has the net result, in general, of higher-tier items being more common as gamestage increases. Even though the raw number you see in the probability table might be decreasing.
It's weird.
Here's one of their spreadsheets where they work all this out, for people who enjoy mathematical self-abuse:
https://docs.google.com/spreadsheets/d/15TQ_P13gKYMb75eKlzzOxoEKCMINosQJIBBPpz2MONE