Posted On: 2025-11-03
Today's post is a followup to an earlier one from this year: Two Kinds of Random. That post covered two common twists on randomization (biased and deterministic), but there's one more extremely common (and important) approach to randomness that I'd like to dive into here.
Randomness is a tool that designers can use to achieve their goals, but randomness is often chaotic in ways that frustrate most designs. Consider, for example, a maze made up of rooms with doors between them. Once a player has solved the maze, it no longer presents a challenge as the player already knows the way through it. To solve that, a designer might lean on randomness: create a maze with more than one way to the exit, but then randomly lock some of the doors, so that each time through the maze will be a bit different. While this would occasionally give the player a good experience, choosing purely at random which doors to lock will often lead to impossible mazes - which is not at all what the designer intended.
To solve this via validated randomness, a designer would create a set of rules that define a "valid" outcome, and then discard any random outcome that is not valid. For the maze example, the definition of a valid maze is simple: there must be a path from the start to the finish that does not involve opening a locked door. One way of applying this would be to lock doors at random, test to see whether there is a valid path, and if there isn't, unlock all the doors and then try again.
Despite the simplicity of the maze example, very often validated randomness is used in extremely complex/difficult-to-predict scenarios. Perhaps it is adding keys to the maze that unlock certain doors, and then requiring that the player must collect all the keys before they can complete the maze. Perhaps the maze itself changes as the player explores, having some doors lock/unlock based on which doors that player opens. Perhaps there are traps in the maze that cause the player to lose, but a player picking purely at random should still be able to win 70% of the time. Most likely, it's all three rules (plus a few more) - validated randomness can test for any combination of rules using the same pattern (ie. start over as soon as one of the rules fails.)
To draw on an example from a side project I've been working on - I have a collection of points, and am trying to randomly draw lines between them. The player starts at one point and needs to be able to visit every point by traveling along those lines, but the visual layout of the lines needs to be aesthetically pleasing. Thus, I start by adding random connections between points, but skip adding a connection that would result in very long lines, lines that overlap, or too small an angle between the new line and an existing one. Since this approach can sometimes get stuck (ie. a disconnected point that can only connect via a tiny angle with an existing line), I have it stop after a certain number of attempts, and then discard the layout and start from scratch if not all the points are connected. Lastly, once I have a valid layout, I check the number of lines each point has, and randomly add one or two more if there is a long string of points with only a single line ( since those tend to stand out in a bad way visually.) This is all just considering the layout itself - the details of what happens when a player visits a point is a separate problem (one that is also solved using complex rules and validated randomness.)
Validated randomness is a common tool for designers to sculpt randomness into a form that supports their design. While it may sometimes require discarding a large amount of work, it can be scaled up to handle incredibly complex designs - which is often a necessity in modern digital games. Lastly, validated randomness is - by definition - guaranteed to produce a desirable outcome, making it particularly well-suited to tasks that require that level of certainty (ie. preventing unwinnable starting conditions.)
Hopefully this exploration of validated randomness has been interesting. As always, if you have any thoughts or feedback, please let me know.