How does loot table in games work

897 views

How does programmers do loot tables for millions of items that all have different chances to drop when you kill a enemy in big games like path of exile , Diablo, WoW.

In: Mathematics

3 Answers

Anonymous 0 Comments

Firstly it’s not millions of items, it’s maybe a few thousand base items with a bunch of potential random attributes (for games that use a random attribute system).

Secondly there’s different ways of doing it, but a basic system might be:

* A database/table of all base items (and whatever rules are associated with those items for random attributes, and the odds of those attributes occurring on the item).
* A bunch of loot tables that have certain items from the item database linked to them, with whatever random chance each item has of dropping.
* NPCs, chests (anything that drops loot) with one or more loot tables linked to it.

When you loot the NPC, chest, etc, the game does some random number generation. It then compares that number(s) to the linked loot table(s) to determine what drops. If the items have random attributes, the game also generates some more random numbers to determine what attributes the item ‘rolls’ with, and how good those attributes are.

The generated item becomes a unique entry in a database/table somewhere (but not in the base item database), most usually stored with the character (or shared bank, or whatever) where the item resides. So in essence the “milllions of items” that you’re thinking of exist as unique entries on unique “loot tables” of thousands of characters.

This isn’t the only way to do it, though. The game might very well just have one massive database to store all unique items.

A handy place where you can actually see this in action is the construction kit for The Elder Scrolls series and Fallout series.

You are viewing 1 out of 3 answers, click here to view all answers.