Knob
Randomness
You might say: nondeterminism, weighted choice, stochastic selection
A controlled chance of choosing among several reasonable options instead of always taking the same top choice.
- What it does
- Adds variety and makes behaviour harder to exploit without granting the AI permission to choose nonsense.
- Ask
- Where may chance enter, and what stops a low-scoring or unsafe action from winning?
- Typical
- Deterministic top choice, weighted choice among the best few options, or stochastic search with a bounded random seed.
- Trouble
- The opponent repeats a solved script, or randomness selects an action that the player can see is wrong.
What to look for
- Two good options chosen in different runs
- A weighted-choice trace showing the candidate set
- The same situation producing varied but plausible actions
Connections
- See also: Mixed strategy
Sources
- David Rez Graham, An Introduction to Utility Theory, Section 9.6
You can get the best of both worlds by taking a subset of the highest scoring actions and choosing one of those with a weighted random.
- Kevin Dill, What Is Game AI?, p. 4
we need to ensure that our random choices are all still reasonable.
- Steven Rabin, Game AI Pro: Collected Wisdom of Game AI Professionals, ch. 3, §3.1 Introduction
We depend on it for variation in our games, using it to keep our gameplay fresh and our NPCs from becoming predictable
- Steven Rabin, Game AI Pro: Collected Wisdom of Game AI Professionals, ch. 3, §3.3.2 Randomness Doesn’t Look Random: The Fix
When generating a random sequence of numbers, if the next number will hurt the appearance of randomness, pretend that you never saw it and generate a new number
- Steven Rabin, Game AI Pro: Collected Wisdom of Game AI Professionals, ch. 3, §3.4 Perlin Noise for Game AI
This “smooth” nature of randomness means that we don’t get wild jumps from one random number to another, which can be a very desirable trait.
Use it on your project
teardown-apply: hold "Randomness" (randomness) from the teardown at https://teardownatlas.com/game-ai/ against my project
Paste it into a coding agent that has the teardown skills.
An AI agent wrote this map with the teardown skill. It can contain errors: check the sources before you rely on a part. About and legal