Jump to content

[41.78] Loot rarity & rerolls unintuitively makes common items rare


Lightja

Recommended Posts

Because of how rerolls work with loot generation, common items are often times harder to find than rarer items because they are replaced on reroll. I discovered this when I started a very low loot run with a naked character, including no belt. Despite belts being mid-tier rarity, it can take upwards of months to find a belt despite them being possible in almost every wardrobe or nightstand. I'd have a pile of bats, which were supposedly ~50x rarer in wardrobes, before I found a belt.

 

To illustrate my point, I started a save with insanely rare loot settings (otherwise apocalypse, no traits, unemployed), went to a bathroom cabinet and refreshed 200x using LootZed in debug mode. Below are the results along with the weights for each item included in the loot definition for BathroomCabinet. This should be easily replicable. This was my first attempt and I can just tell you from lots of experience that this is happening in ways more noticable than this example. If you imagine Vitamins as "Belt" and Antibiotics as "BaseballBat", this is basically what I was experiencing in my personal example when searching for a belt.

 

200 loot rolls:

   BathroomCabinet = {
        rolls = 4,
        items = {
            "Toothbrush", 10,        : 4
            "Toothpaste", 10,        : 3
            "Tweezers", 10,          : 3
            "Bandaid", 10,           : 4
            "Mirror", 8,             : 1
            "Lipstick", 6,           : 2
            "MakeupFoundation", 6,   : 2
            "MakeupEyeshadow", 6,    : 2
            "Bandage", 6,            : 2
            "Perfume", 4,            : 2
            "Pills", 4,              : 2
            "Cologne", 4,            : 1
            "Comb", 4,               : 3
            "PillsVitamins", 4,      : 0
            "Razor", 4,              : 2
            "Disinfectant", 2,       : 1
            "PillsAntiDep", 1,       : 1
            "PillsBeta", 1,          : 1
            "PillsSleepingTablets", 1: 1
            "Antibiotics", 0.20,     : 1
        },
        junk = {
            rolls = 1,
            items = {
                
            }
        }
    },

 

This is somewhere between a bug report and a suggestion because it's not technically a bug, but I think the outcome is unexpected. It might even be deliberate, but at the very least it makes deliberately planning loot tables in a balanced manner more difficult than planned.

 

If I were designing a container and choosing weights for items, I would expect an item with weight of 10 to be selected roughly 50x as often as an item with a weight of 0.2. However, due to the roll system, toothpaste and tweezers (weight 10) were only selected 3x as often as antibiotics (0.2). Additionally, I would expect to find 20x vitamins compared to the number of antibiotics, but we have 1 antibiotics and 0 vitamins. I think it's fine to expect some bad luck protection to make rarer items more common, but the degree that it impacts the loot distribution in this system makes it very difficult to be deliberate about what items spawn in containers. 

 

If I want to make an item truly rare, I can't just give it a low weight in common containers, I am forced to only put it in only rare containers, on rare zombies, in event zombies, etc. I like the idea of making minimally consequential, but interesting and unique items as extremely rare but found in common containers. For example, a 3-point pen that lets you use all map writing functions, or a red leather jacket.

Changing this is obviously going to impact loot distribution heavily, so I don't know how realistic it is to implement, but most of the ideas I have for mods depend upon making very rare items which dont currently have a great distribution method. If I were to change it, I would probably adjust the amount & scope of the rerolls. If there is a known way to easily understand and work with these loot tables in a way that gives you an understanding of the actual outcome outside of building a model, I'd appreciate some info on that for mod planning purposes.

 

Edited by Lightja
Link to comment
Share on other sites

I don't think re-rolls replace already selected items, but I could be wrong.  My understanding was that the rolls value is just there to populate the container with more stuff - more rolls = more chances for each item to spawn.

 

To do what you want re pens, you may want to look at https://pzwiki.net/wiki/OnFillContainer

 

You could then remove a vanilla Pen, and add a 3-colour pen, when the game spawns loot into a container.

Use ZombRand(100), for example to replace 1 in 100 vanilla Pen with a 3-colour pen.

 

Rather than run code for literally every container, you could just do some roomNames or containerTypes, e.g. just school classrooms, or just desks.

 

Actually, thinking about it as I type, you don't even need to remove the vanilla pen - just have a chance to add the 3-colour pen to certain containers.

 

Link to comment
Share on other sites

OK, so I thoroughly reviewed the loot code and have to say I was wrong about how the loot works. I'm not sure where I got the idea exactly now that I reviewed it in depth, but I originally did some testing in dev mode that seemed to confirm my theory, as does my past experience. However, when I dug into it I realized I was incorrect. I definitely don't see where lucky/unlucky affects # of rolls, that must've been one of those nuggets of false info someone taught me early that I assumed was true.

 

here is an extremely boiled down version of how I now understand loot is rolled for a container.

 

--------doRollItem--------

{insanely rare, extremely rare, ?, ?, ??, ???} = {0.05, 0.2, 0.6, 1.0, 2.0, 3.0}
For (1 ... possible_items_list_length)...
calc (1.1 * 100 * wgt * 0.05) vs rand(10000)

if value < rolled rand(10,000) value (0.055% chance * wgt), add item to container
If item can stack >1, re-roll up to num_rolls (4) times

 

100 and 10000 are scalar
1.1 is lucky modifier - full list {0.9, 1.0, 1.1}
0.05 is loot modifier for insanely rare - full list {0.05, 0.2, 0.6, 1.0, 2.0, 3.0}


--------------------------------

if it does work like that, then nothing should be squishing the distribution at all and Carpentry 5 is actually 12x rarer than Carpentry 1, and Sledgehammer is actually 400x rarer than a crowbar. This does not seem to match my personal experience, so I feel like I might be missing something still, but maybe I am working backwards from my conclusion here.

For now just ignore this report. Just from personal experience I feel that there is something off with the loot causing the distribution to be flattened, but I will need to do more testing and figure out exactly what it is I'm experiencing.

Edited by Lightja
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...