New: 36 free tools for Unreal Engine and Unity developers.Try them →

Pity Systems and Weighted Loot Tables: A Practical Guide

How to build a weighted loot table, roll it in code for Unity and Unreal, and protect unlucky players with hard pity, soft pity and shuffle bags.

In this article
  1. Weighted loot tables
  2. Bad-luck protection
  3. Which one should you use?
  4. Tune it with numbers
  5. Summary
  6. FAQ

Pure randomness is fair on average and cruel at the edges. With a 1% drop rate, one player in a hundred needs over 459 tries (the maths is in Drop Rates Explained). Weighted loot tables and pity systems are the two tools game designers use to keep loot exciting without making anyone miserable.

Weighted loot tables

Instead of writing a percentage on every item, give each item a weight:

ItemWeightChance
Common7070%
Rare2222%
Epic77%
Legendary11%

Chance = weight ÷ total weight (here, total = 100). The big advantage: add a new item with weight 10 and every chance adjusts automatically, with no spreadsheet rework.

Rolling a weighted table

Pick a random number between 0 and the total weight, then walk through the items:

Unity (C#):

public T Roll<T>(List<(T item, float weight)> table)
{
    float total = 0;
    foreach (var e in table) total += e.weight;
    float r = Random.value * total;
    foreach (var e in table)
    {
        if (r < e.weight) return e.item;
        r -= e.weight;
    }
    return table[table.Count - 1].item;
}

Unreal (C++):

int32 RollIndex(const TArray<float>& Weights)
{
    float Total = 0.f;
    for (float W : Weights) Total += W;
    float R = FMath::FRand() * Total;
    for (int32 i = 0; i < Weights.Num(); ++i)
    {
        if (R < Weights[i]) return i;
        R -= Weights[i];
    }
    return Weights.Num() - 1;
}

Store the table in a ScriptableObject (Unity) or a DataTable (Unreal) so designers can tune weights without touching code.

Bad-luck protection

Hard pity

Count failures. After N failures, the next roll is guaranteed to be the rare item, and the counter resets.

  • Simple to explain: "guaranteed within 90 pulls".
  • Choose N near the tries for 99%, so pity only rescues the unluckiest players.

Soft pity

Raise the chance a little after each failure, and reset it after a success:

chance = baseChance + failures × step

The drop feels random but extreme bad luck becomes impossible. Many games combine soft pity with a hard cap.

Shuffle bags

Put a fixed set of outcomes in a "bag" (for example 99 commons and 1 legendary), draw without putting them back, and refill when empty. Every player gets exactly one legendary per 100 draws. It feels less random, which is great for resources and fair progression, less exciting for chase items.

Duplicate protection

When a player already owns an item, reroll it or convert it into currency. This keeps late-game loot meaningful.

Which one should you use?

GoalUse
Progression itemsShuffle bag or hard pity
Exciting chase itemsWeighted table + soft pity
Paid random itemsPublished odds + hard pity
Crafting resourcesShuffle bag

Tune it with numbers

The free Drop Rate & Loot Table Calculator turns weights into percentages and "1 in N" values, and shows how many tries it takes to reach 50%, 90% and 99% for any drop chance. Use the 99% number as your first guess for a hard pity threshold.

Summary

  • Weights make loot tables easy to extend and tune.
  • Roll by walking through cumulative weights.
  • Hard pity guarantees, soft pity smooths, shuffle bags make outcomes fixed.
  • Pick pity thresholds from the tries needed for 99%.

Frequently asked questions

What is a weighted loot table?

A list of items with a weight each. An item's chance is its weight divided by the sum of all weights, so adding a new item only needs a new weight and the other chances adjust automatically.

What is a pity system in games?

Bad-luck protection that guarantees a rare reward after a number of failed attempts (hard pity) or raises the chance a little after every failure (soft pity).

How do I choose a pity threshold?

Look at how many tries the unluckiest players would need without pity. The number of tries for a 99% chance is a good starting point: pity then only helps the unluckiest 1%.

What is a shuffle bag?

A bag with every outcome in fixed amounts, drawn without replacement and refilled when empty. If a bag of 100 contains one rare item, every player gets it within 100 draws.

  • #game design
  • #loot
  • #unity
  • #unreal engine
Written by Renish

Indie Unreal Engine developer and founder of Tvashta Studio. Builds the Shopping Simulator Kit plugin in UE5 C++ and the free tools on this site, and writes these guides from that work for Unreal Engine and Unity developers. More about the studio.

Related articles

All articles →