
Fate - Advanced Weighted Drops for GameMaker
A downloadable tool
Decide your players' Fate!
Weighted random selection sounds simple until you actually need to do it properly. Basic weighted rolls are fine, but then you need one item to never drop twice in a row, and another to be guaranteed at least once in every ten pulls, and a rare item that gets progressively more likely the longer someone goes without seeing it, and suddenly you're maintaining a pile of counters and flags and special cases that have nothing to do with the rest of your game.
Fate handles all of that. It keeps retrieving an ordinary drop simple, while giving you a ton of options to deal with complexity.
Also, don't just think of this as a loot system. Fate is useful for any weighted random selection: which enemies spawn on a map, which events fire during a run, which NPC shows up at the shop, whatever your game needs to decide by weighted chance.
The core pattern
// Create some drop entries
var _common = new FateValueEntry("COMMON").SetWeight(94);
var _rare = new FateValueEntry("RARE").SetWeight(6);
// Add them to a loot table
var loot_table = new FateTable([_common, _rare]);
// When you need a drop, roll for it
var _roll = FateRollValues(loot_table, 1);
// Check that the roll was valid
if (_roll.IsOk()) {
// And grab the drop from the roll
var _drop = _roll.GetFirstDrop();
}
That's it for the simple case. Build a table, roll it, check the result. But there's quite a lot more available when you need it.
Features
Entries can be marked as guaranteed (always included in a roll regardless of weight), unique (never selected more than once per roll), or weighted normally. A FateTableEntry wraps another table as an entry, so outcomes can branch recursively through multi-stage generation. A FateCreatorEntry instantiates an actual game object or struct when it's selected, so a roll can directly produce a live instance or struct rather than just a value you then have to act on.
The policy system is where Fate starts to spread its wings in terms of giving you options. Policies modify selection behavior at roll time without you changing your entries or your roll calls. The built-in ones cover the things that come up constantly in real games: pity (rare entries become progressively more likely the longer someone goes without hitting them), rate-up (featured entries get a weight boost for a period), duplicate protection (recently selected entries are penalized or excluded from the next roll), and batch guarantees (at least one target entry in every N rolls). There's also EnableStandardGachaRules if you want the full set in one call, which sets up pity, rate-up and featured handling the way a gacha game would expect them to work.
Policies track their own state, and that state saves and loads through Fate's persistence system, so a pity counter that was at 87 before the player quit is still at 87 when they come back.
The probability tools let you inspect what Fate would actually do before committing to it. Preview evaluates likely outcomes without running any selection side effects, GetEntryProbability gives you the current effective chance for a specific entry under active policies, and GetValueProbability does the same by value rather than entry reference. These are useful for showing probability info in UI or for balance work without having to do the math yourself.
For QA there's a simulation suite that runs a table thousands of times and gives you a report with observed rates per entry, a deterministic result hash for regression locking, and assertion helpers so you can write checks like "this entry should appear between 5% and 7% of the time" and get a clear pass/fail. If your drop rates drift after a change, you'll know.
Support and feedback
Discord (questions, discussion, show and tell): https://discord.gg/tafsfNAzWm
Part of the RefresherTowel Games Toolkits
Part of a growing suite of GameMaker tools designed to play nicely together. If you like this style of tooling, you might also want:
- Whisper - make your narrative dynamic and reactive, like Hades or Crusader Kings III.
- Catalyst - makes modifiable statistics (and general numbers) super easy.
- Pulse - a signals and events framework (supporting queries that allow you to ask questions instead of just broadcast signals!)
- Statement - a state machine framework (with a fully visual in-game debugger).
- Quill - a FREE text box creator that automatically gives you advanced features like a right click context menu, proper text selection, multi-line text boxes, plus more!
- Echo - advanced debug logging (level filtering, tags, optional stack traces, history dumps) that now comes with an advanced, yet easy to use debug UI builder!
Get Pulse, Catalyst, Statement and Echo in the Ignition Kit bundle for a discount! Or buy the Full Suite Pass bundle (get access to all past and future tools) in one go!
| Updated | 8 days ago |
| Status | Released |
| Category | Tool |
| Author | RefresherTowel |
| Made with | GameMaker |
| Tags | drops, GameMaker, libraries, library, Loot, loot-table, random, weighted-drops |
| Code license | MIT License |
| Links | Homepage, Documentation, Discord |
| Content | No generative AI was used |
Download
Click download now to get access to the following files:


Leave a comment
Log in with itch.io to leave a comment.