52 · Procedural · 2D and 3D

Loot tables (weighted random)

Make rare things rare, on purpose.

A plain random pick gives every item the same chance. A loot table gives each entry a weight, so common items drop often and legendaries rarely. Add pity timers so an unlucky player is not stuck forever, and seed the random so the same chest gives the same result for testing.

Space open a chest · X open 100 · P pity timerTap Open

Try this: Open chests one at a time, then 100 at once. The live tally drifts toward the table weights (60 / 28 / 10 / 2 %). Turn on the pity timer and a Legendary is guaranteed after 30 dry chests.

Chests 0Since Legendary 0

Pure weights. Open chests.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Build weighted loot tables: give each entry a weight, roll a random number times the total weight, guarantee a rare after 30 rolls without one, show the drop result within 0.5 s, and drop nothing instead of crashing when a table is empty.

43 words · one sentence to paste as is

Where it's used

Common mistakes

Using percentages that must add up to 100 and break when you add an item, rolling with uniform random, no pity so streaks feel unfair, hard-coded tables in code, and crashing on empty tables.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.