Modding Discussion How to work out loot drop averages

Discussion in 'Starbound Modding' started by AngleWyrm, Jan 23, 2018.

  1. AngleWyrm

    AngleWyrm Scruffy Nerf-Herder

    Let's start from the viewpoint of looking at an already generated loot table, and we want to know typically in the long run how much stuff it produces. So here's an example loot table that generates pixels in different amounts.
    Code:
    chances:3, pixels:100
    chances:2, pixels:200
    chances:1, pixels:300
    There are a total of six chances (outcomes) that can happen, so each one is worth 1/6th (16.67%). Why use chances? Because it's easy to add new items or change existing items by just changing the chances for an item, whereas it's a headache to try and rebalance percentages when making updates so that they total 100%.

    To calculate the average drop from a loot table, multiply the chance times the loot and add them all together:
    averageLootDrop = 3/6 × 100 + 2/6 × 200 + 1/6 × 300 = 166.67 pixels

    So if we rolled a hundred times on this loot drop table, we would get about 16,667 pixels.
     
    Last edited: Jan 23, 2018

Share This Page