Skip to content

Description

A drop chance of five percent means somebody goes eighty tries without it. That player does not think "variance" - that player thinks the game is broken, writes a post about it, and is not wrong to feel what they feel.

PityRoll is the layer that puts a floor under bad luck. It is one component, one call where your table already rolls, and a set of pure functions you can read in an afternoon.

KEY FEATURES

  • One counter per entry. A key is one entry of one table, so picking up a common cannot reset the protection that was building towards the rare. A single shared counter is the most common way this feature is got wrong, and it defeats the whole thing silently.

  • Soft pity. The chance climbs with every miss from an attempt you choose - and below that attempt it is exactly the base chance, so a player who datamines your table finds the number they were told.

  • Hard pity that lands where you said. HardPityAt = 40 means the fortieth attempt in a row gets it. Not the thirty-ninth, not the forty-first. The off-by-one here is invisible in testing and obvious to a community spreadsheet.

  • One formula. EffectiveChance is a pure function and the roll calls it rather than repeating the arithmetic, so the chance your UI shows is the chance the roll used. There is no second copy to drift.

  • Consumed exactly once. A natural success inside the pity window resets the counter too. Nobody gets the drop and keeps the protection.

  • Reproducible. The random value is handed in, so a server, a client prediction and a replay reach the same answer from the same inputs.

  • Saves anywhere. The state is four integers - plain data, no pointers, no objects.

WHAT IT IS NOT

It is not a loot table, not a random number generator and not replicated. It answers one question - did this attempt succeed - and your table does the rest.

A demo level ships with it: two columns at the same five percent, fed the same sequence of random numbers, one with protection and one without. The left column goes forty-one attempts dry. The right one cannot.

Full C++ source. No third-party libraries. Unreal Engine 5.8, Win64.

Included formats