View Single Post
Old December 14, 2016, 04:20   #4
Nomad's Avatar
Join Date: Sep 2010
Location: England
Posts: 958
Nomad is on a distinguished road
Originally Posted by Derakon View Post
For each depth, we examine the frequencies for all items that have an allocation rule for that depth, and build a table of length 1,000,000 of the different odds. In our example, at dlvl5 CLW would occupy 10,000 slots on this table. The table will have gaps in it -- not every slot will be taken (the table generator can at least enforce that we do not overfill it). If we want to generate an item, we roll, find the corresponding item if any, and generate it. If we don't find an item (an "allocation miss"), then nothing is generated.
How about picking an item at random from all those available at the current depth, then rolling against some sort of "rarity value" to see if it's actually generated?

- Generation process determines the item type will be a potion.
- Build a list of all potions that are allowed at this depth, and choose one at random, with all having even odds of being picked.
- Roll against rarity to see if the selected potion is actually created. (For instance, say CLW is picked, then there's an 90% chance of actually getting a potion of CLW, 10% chance of getting nothing, but if Experience is picked, there's only a 5% chance of it being created and a 95% chance of nothing.)
- Perhaps attempt multiple rolls, but if you get, I don't know, three to five "failed to create item" results in a row, then give up and nothing is generated. (This would be a good value to tweak with a global difficulty setting, actually - at low difficulty the game will try many times to create an item, high difficulty it gives up quickly.)
Nomad is offline   Reply With Quote