Jump to content

How the "random" part of the weapon or tool damage actually works.


Gako21

Recommended Posts

Random values in items' damages and other attributes has been a heavily discussed subject since they were implemented, really. Finding, or crafting, a quality 4 weapon that's worse than a quality 2 one certainly raises frustration and questions about how can it be that way. The reason offered has been that there is a "random" factor of +-15% to most values, mainly to damage. But how random are the values in the end? This question started to bug me after I tried to reach the theoretical max damage of a steel pickaxe. Quick calculations say the damage should reach the maximum of 103,6, but I failed to reach even past 95,4. This started to interest me and began to type down the block damages of the pickaxes I spawned through the creative menu systematically. After 200 different values I made a histogram out of them. The results were quite shocking, as you may see:

15All.thumb.PNG.addad3a6277468907ba306c5a3d0469c.PNG

 

The bottom bar has different block damage values, ranging from 64 to about 95,2. Each dot represents the "base" value a steel pickaxe of certain quality should have. The graph, however, is nowhere near what one could expect to see based on past assumptions. The first thought I had was that I had no idea which bar came from which quality. So I repeated this experiment and this time listed the quality I had got the block damage value from. The results were equally interesting, if not even more:

15Tiered.thumb.PNG.f0c1970fd30b2dde73a5f3a9658d6ec9.PNG

 

Here we can see the bars colour-coded: grey is quality 1 picks, orange is quality 2, quality 3 is yellow, quality 4 is green, quality 5 is blue and quality 6 is pink. The bars are at the same places as in the picture above, but two notable points can be picked from this. The first is that quality 2 and 4 steel pickaxes share the same possible damage values. This surprised me greatly as it would be logical to think that 4 is better than 2. The other thing to notice is that quality 3 picks' damages varied by a lot. The worst picks were only a bit better than quality 1 pickaxes, but the best were as good as quality 5 picks were. This increased my interest in this phenomenon and I did an additional test by removing the tier bonus so that every quality would have the same base value where the "random" value would be added. The results were, in the light of these past pictures, quite explanatory:
15Flat0.1.2.thumb.PNG.c1ce86595be47e136393e8e2f85472e0.PNG

 

Here we can see the bars aligning (near) perfectly next to each other, filling the area of +-0.15 the base steel pickaxe's block damage completely. This chart explains the huge differences in quality 3 picks' damages and why quality 2 and 4 picks have the same damage values. It also explains why I was not able to get the theoretically best damage out of my pickaxe. I was able to determine the ranges to these values quite accurately.
 

T1 Min T1 Max T2 Min T2 Max T3 Max Min T3 Max Max T3 Min Min T3 Min Max T4 Min T4 Max T5 Min T5 Max T6 Min T6 Max
+2% +7% +7% +12% +12% +15% -15% -13% -13% -8% -8% -3% -3% +2%


The Min value indicates the left side of the bar group whereas the Max value indicates the right side of it, thus telling the best possible value the quality item can have in relation to the base value. The exact values are mostly useful for searching the best (or worst) damage one can have in a pick.

I have done, in addition to everything presented above, tests with other types of stats and items as well. So far it seems that both entity and block damage follow the same deviation no matter the item, be it a weapon or a tool. There are some values outside the scope occasionally, but these are usually about 1% lower than the mathematical model would suggest. Stamina usage and attacks per minute (apm) don't seem to follow it, nor does armour properties. There are some other shenanigans happening with the armour resists, but their relation to this phenomenon remains unclear yet. I will continue to experiment with this subject and you are free to do similar testing with any property and item you wish. I would actually encourage you to check the chart every now and then and see if you find any clear anomalies in your travels. Would the event occur, be sure to post it here for us to see!

Link to comment
Share on other sites

22 minutes ago, Gako21 said:

pickaxes I spawned through the creative menu

 

For what it is worth, it used to be that CM spawns did not use the RNG system in the same way as real-world spawns. You might want to repeat your test using the 000_loot_new_test POI in the prefab editor. Has 40x of every container in the game. You could mod a couple of container types so they only produce steel picks (using appropriate quality probability tables) and then open a bunch of containers to get 'random' picks.

Possibly the results would be the same, but I will say that a few days ago I was looking at guns and using the CM and every Q1 rifle had identical stats, as did every Q2 rifle and so on. I've been conditioned to not use CM for any statistical analyses. Maybe it's a myth though; your data is more varied than I would have expected.

Link to comment
Share on other sites

8 minutes ago, Boidster said:

 

For what it is worth, it used to be that CM spawns did not use the RNG system in the same way as real-world spawns. You might want to repeat your test using the 000_loot_new_test POI in the prefab editor. Has 40x of every container in the game. You could mod a couple of container types so they only produce steel picks (using appropriate quality probability tables) and then open a bunch of containers to get 'random' picks.

Possibly the results would be the same, but I will say that a few days ago I was looking at guns and using the CM and every Q1 rifle had identical stats, as did every Q2 rifle and so on. I've been conditioned to not use CM for any statistical analyses. Maybe it's a myth though; your data is more varied than I would have expected.

 

You beat me to it.

 

Don't trust CM. When I tried to test damage values and ranges in A19 I simply used a couple of workbenches (benches and materials through CM) and built the items. That way you can't test quality6 items unmodded, but for a distribution test it should suffice and it is totally vanilla.

 

Edited by meganoth (see edit history)
Link to comment
Share on other sites

Thank you both for the input. I did consider the CM to be one of the things that could apply error to the experiment but the seemingly well-fitting spectrum the different qualities had made me think it had no significant effect on it. I will continue testing.

Link to comment
Share on other sites

If you go into loot.xml and comment out the entire "groupWorkbenchLoot" lootgroup and then paste this right below it, you'll get 10 steel pickaxes from every workbench. Using the 000_loot_new_test POI you can get 400 samples by searching the workbenches.

 

Actually, this is only a partial solution. It "works", but generally all Q6 picks in a single bench will have identical stats. I'll get something better.

 

<lootgroup name="groupWorkbenchLoot" count="10" loot_quality_template="QLTemplateT2">
    <item name="meleeToolPickT2SteelPickaxe"/>
</lootgroup>

 

You'll want to use 'giveselfxp' to get your lootstage up. I used 5 million XP and it gives Q4-5-6.

 

image.png.b00078724fc821022c916a50d0757ff9.png

 

The workbenches are towards the back of the center section of the POI. Approximately where the red box is.

 

image.png.0c89121711093906163a7f4ffcb12a4f.png

Edited by Boidster (see edit history)
Link to comment
Share on other sites

The CM does work for stat ranges if done correctly.  You have to type in the name to get the quality you want to grab.  Then delete some letters or continue typing, which will create different versions of the item, until you see one of the quality you want again.  I just did it and got two different Q6 Machine Guns. 


Gun 1
Damage 65.6
Magazine Size 62

Rounds/Min 454
Effective Range 43
Max Durability 553 

Gun 2

Damage 64.3
Magazine Size 60

Rounds/Min 450

Effective Range 41
 Max Durability 529

Link to comment
Share on other sites

3 minutes ago, Sjustus548 said:

The CM does work for stat ranges if done correctly.  You have to type in the name to get the quality you want to grab.

 

Right, but "common wisdom" (which may be neither!) is that nevertheless the CM does not produce the same range of possibilities as a real game.

Link to comment
Share on other sites

I pulled 25 Q6 steel pickaxes from random loot (after modifying the XML as shown above, and ignoring the duplicate stats within a single container) and got the following distribution. This looks much more like what one would expect from a random distribution, including values very close to the maximum of 103.6 (taking @Gako21's word for that). 

 

This seems to be good evidence in favor of the common wisdom about not using CM to check random stats. None of that artificial RNG, you need free-range organic world-seed RNG!

 

image.png.a9bfc2159b59de3bf329f12c977c296e.png

 

 

Edited by Boidster (see edit history)
Link to comment
Share on other sites

27 minutes ago, Boidster said:

If you go into loot.xml and comment out the entire "groupWorkbenchLoot" lootgroup and then paste this right below it, you'll get 10 steel pickaxes from every workbench. Using the 000_loot_new_test POI you can get 400 samples by searching the workbenches.

 

Actually, this is only a partial solution. It "works", but generally all Q6 picks in a single bench will have identical stats. I'll get something better.

 

<lootgroup name="groupWorkbenchLoot" count="10" loot_quality_template="QLTemplateT2">
    <item name="meleeToolPickT2SteelPickaxe"/>
</lootgroup>

 

You'll want to use 'giveselfxp' to get your lootstage up. I used 5 million XP and it gives Q4-5-6.

 

image.png.b00078724fc821022c916a50d0757ff9.png

 

The workbenches are towards the back of the center section of the POI. Approximately where the red box is.

 

I did it slightly different and it seemed to work for me.  I created one loot group that had 6 lines in it, all Compound bows.  Then I changed all loot containers to have that specific loot group in it.  I also made a custom loot probability where your loot stage didn't matter, but you had equal chance to get any of the quality levels.  Then loaded up an actual map and started looting until I could fill up 2 storage crates for each quality level.

 

Will check it out again to see if the same quality level in the same loot container had identical stats.  Though I was only trying to get a min / max to verify damage equation on generation of the item so I wasn't looking too deeply in it like you were.

    <lootqualitytemplates>
        <lootqualitytemplate name="SpecialLootProb">
            <qualitytemplate level="0,9999999" default_quality="1"><loot quality="1" prob="0.16"/><loot quality="2" prob="0.16"/><loot quality="3" prob="0.16"/><loot quality="4" prob="0.16"/><loot quality="5" prob="0.16"/><loot quality="6" prob="0.2"/></qualitytemplate>
        </lootqualitytemplate>
    </lootqualitytemplates>

</insertBefore>

<insertAfter xpath="/lootcontainers/lootgroup[@name='empty']">
    <lootgroup name="SpecialGuns" count="all" loot_quality_template="SpecialLootProb">
        <item name="gunBowT3CompoundBow"/>    
        <item name="gunBowT3CompoundBow"/>    
        <item name="gunBowT3CompoundBow"/>    
        <item name="gunBowT3CompoundBow"/>    
        <item name="gunBowT3CompoundBow"/>    
        <item name="gunBowT3CompoundBow"/>    
    </lootgroup>
</insertAfter>

<set xpath="/lootcontainers/lootcontainer/item/@group">SpecialGuns</set>

 

Link to comment
Share on other sites

6 hours ago, Boidster said:

I bet it's the custom quality template that 'fixes' the problem of all T6's in a container having the same stats.

I would guess otherwise; your list is using count=10 on one row, BFT's is count=all for six rows. Looks to me like each row is built into a "unique item" first and repeats of a row are then duplicates of that exact item.

 

EDIT-add: not exactly "item", but "the random rolls deciding the item", I may have simplified it too far .. :)

Edited by theFlu (see edit history)
Link to comment
Share on other sites

If I want to know damage range of an weapon or stats range of any items, I'll use the console command:

giveself <item name> [quality level]

that Drops an item at your feet with maximum quality. Use the optional [quality level] to specify. Item names can be found in 7 Days To Die\Data\Config\items.xml

this way is quick and reliable, like:

giveself meleeWpnSledgeT3SteelSledgehammer

this command gives me a Q6 steel Sledgehammer with damage range from 62 to 75,

while the one from CM never has damage lower than 67 and higher than 70.

Link to comment
Share on other sites

Alright, so, after a good night's sleep and some testing after, it seems that acquiring steel pickaxes from either looting or crafting does randomize the values evenly around the base value of 62,8. In other words, the histograms I made are complete rubbish when it comes to actual items found while playing the game. Altho I am still profoundly confused by how the creative menu can produce something so systematic yet false. I guess this thread could be renamed to "How the CM actually works 🙃". Thank you all for your comments.

Link to comment
Share on other sites

11 hours ago, theFlu said:

I would guess otherwise; your list is using count=10 on one row, BFT's is count=all for six rows. Looks to me like each row is built into a "unique item" first and repeats of a row are then duplicates of that exact item

 

I didn't mention it, but I also tried the same technique as BFT, but using the game-standard quality template. I got the same results - usually all T6s in the same container had identical stats. Very occasionally one T6 out of the 3 or 4 in the container would be different, but usually they were identical. So I'm sticking with BFT's custom quality template being the smart idea.

Link to comment
Share on other sites

Well, I did say "I'd guess" ;)

My problem with the interpretation is that.. the qualitytemplate should only choose between 5 and 6, and the random rolls for the actual item should be made after that. No matter which way you land on the 6 really can't by itself dictate the rest. So there has to be some kind of a caching phenomenon 'after' the quality selection.

 

Having that happen on separate items lines of the xml would make more sense than having it happen due to the qualitytemplate; especially as the default template is using practically the same structure (same randomness), only choosing the section of the template by loot stage.

 

But yeh, I don't know what you've tested, so don't take my word for anything; I'm just voicing out a doubt whenever I have one. Even if unpopular, it should be useful for everyone in the long run. :)

Link to comment
Share on other sites

14 hours ago, longcheq said:

If I want to know damage range of an weapon or stats range of any items, I'll use the console command:

giveself <item name> [quality level]

 

Interestingly, if you use a quantity > 1 in that command, all the items are identical. I'm poking around in the code to see if I can figure out how that console command differs from a drag-and-drop from the creative menu. It's...complicated. At least for me who is not a C# programmer and only an academic exposure to C++. I know that this is the class which handles the 'giveself' console command, but tracing down to the moment where BlockDamage is calculated is a great use-case for Ibuprofen! And finding the place where stats are calculated on items pulled from CM may require codeine.

 

image.png.63850498970c7a718343f6004b801875.png

Link to comment
Share on other sites

9 hours ago, Boidster said:

So I'm sticking with BFT's custom quality template being the smart idea.

 

I wouldn't.

 

I was just able to check and the damage numbers are the same even with my method.  The reason I got a good range was because I opened up so many different containers to get two storage crates full for each quality level.  I did see a few outliers but when I get 5 Q1s in one container and they are all the same in terms of damage......

 

So distribution seems to be tied to each opening of a loot container.  Having multiple items in the same container does not create a good distribution.  Maybe change it to force getting each specific quality level in each container, then opening up a lot of containers might be a way to determine the randomization without playing a normal game and just keeping every item you find to compare🤷‍♂️

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...