Skip to main content
Source Link
Mooing Duck
  • 255
  • 3
  • 10

Stolen blatantly from D_M_Gregory's tweets:

My preferred approach for this kind of selection is to build some Gambler's Fallacy into the generator - adding notion an item can be "overdue" / "used up".

I start with a non-negative weight associated with each item - these don't have to sum to 100% so they're easy to edit. As part of the generator state I track a "dueness" for each item, initialized to that item's weight.

When drawing an item, I form a selection weight for each item as Max(item dueness + item weight * noise, 0) …and select an item with weighted random selection from these weights. After a draw, I increase the dueness of each item (including the selected one) by its original weight, and decrease the dueness of the selected item by the total original weight. If I've overconstrained it so it gets all zero weights, it falls back to the original weights.

The noise parameter lets me control how predictably deck-like (~0) or chaotically dice-like (>>0) the generator behaves. So it's not all or nothing, I can dial in the trade-off I want between consistent guarantees and unpredictability.

This gives me much stronger control over the observed frequencies of each item compared to weighted rolls without memory. I can even add a cooldown between rolls of a single item to avoid back-to-back fails/criticals. And you can even change the source weights on the fly!

So that's how I'm tackling this problem currently, letting me guarantee players don't wait too long for a particular event (droughts), or experience too many back-to-back (streaks), with design parameters I can freely tune to any numbers I want and get the frequencies I expect!

Post Made Community Wiki by Mooing Duck