Sub topic 8
Dynamic difficulty adjustment and its limits
Dynamic difficulty adjustment (DDA) changes a game's challenge while the player is playing, based on how they are doing. Presets and granular settings put the choice in the player's hands. DDA makes the choice for them. That is why it needs more care than the other tools in this tutorial.
This chapter assumes you have read the chapters on challenge and flow, difficulty levers, and presets. You should be comfortable reading short TypeScript functions.
What DDA is
A DDA system has three parts:
- A signal. Something it measures, such as deaths per encounter, time to clear a room, or health remaining at the end of a fight.
- A target. The value of that signal you consider healthy, such as "players fail about 30% of attempts at a boss".
- An actuator. A lever it moves when the signal is off target, such as enemy damage or the number of spawned enemies.
The loop repeats: measure, compare to target, nudge a lever, measure again.
Choosing signals
The signal decides what the system reacts to, so it deserves more thought than the actuator.
| Signal | Good for | Risk |
|---|---|---|
| Recent fail rate on a repeated challenge | Boss fights, platforming sections | Needs several attempts, so it is slow to react |
| Health remaining at the end of an encounter | Combat that is rarely fatal | Players who heal heavily look stronger than they are |
| Time to complete a section | Puzzle and exploration pacing | Slow players may be thinking, not struggling |
| Accuracy or hit rate | Shooters | Mixes skill with weapon choice and range |
| Resource stock (ammo, potions) | Survival and horror games | Players who hoard look like they are doing badly |
Prefer signals that are direct outcomes of the challenge you want to tune. A fail rate on a boss tells you about that boss. A global "player skill score" built from many inputs is harder to debug and easier to get wrong.
Choosing actuators
The best actuators are the ones the player is unlikely to notice or resent. Compare the levers from the earlier chapter:
- Numbers such as enemy damage, enemy health, or spawn counts are easy to scale smoothly. They are also the easiest for a player to feel as "the game cheated".
- Information such as how long a hint takes to appear, or how strong a telegraph is, changes difficulty without changing the fight's stakes.
- Rules such as checkpoint placement or how much a death costs are visible and change the structure of play. Adjust them with great care or leave them to the player.
Quiet adjustments to resources (a few extra health pickups after repeated failure) usually feel less intrusive than making an enemy visibly weaker.
A bounded implementation
An unbounded adjuster is dangerous. It can drift to extremes, and it can erase the difference between the presets the player chose. The version below has four safeguards:
- It waits for at least five outcomes before acting.
- It moves by at most 0.05 per update.
- It never leaves the range 0.7 to 1.3.
- It produces a scale that multiplies the player's chosen preset, instead of replacing it.
const clamp = (value: number, min: number, max: number): number =>
Math.min(max, Math.max(min, value));
const TARGET_FAIL_RATE = 0.3;
const MIN_SCALE = 0.7;
const MAX_SCALE = 1.3;
const MAX_STEP = 0.05;
const WINDOW = 10;
// scale multiplies enemy strength; outcomes holds recent attempts (true = success).
function adjustScale(scale: number, outcomes: boolean[]): number {
if (outcomes.length < 5) return scale; // not enough evidence yet
const failRate = outcomes.filter((ok) => !ok).length / outcomes.length;
const delta = clamp((TARGET_FAIL_RATE - failRate) * 0.2, -MAX_STEP, MAX_STEP);
return clamp(scale + delta, MIN_SCALE, MAX_SCALE);
}
// Keep only the most recent attempts so old results stop mattering.
function record(outcomes: boolean[], ok: boolean): boolean[] {
return [...outcomes, ok].slice(-WINDOW);
}
// Simulate a player who loses twelve attempts in a row.
let scale = 1;
let outcomes: boolean[] = [];
for (let attempt = 1; attempt <= 12; attempt++) {
outcomes = record(outcomes, false);
scale = adjustScale(scale, outcomes);
}
console.log(scale); // 0.7, the floorSome details of this design:
- The sign.
scalemultiplies enemy strength. A fail rate above target gives a negative delta, so enemies get weaker. A fail rate below target gives a positive delta, so they get stronger. - Proportional step. The delta is proportional to how far the fail rate is from the target, then capped at
MAX_STEP. A player who is slightly off target gets a tiny change. - The window.
WINDOWkeeps the signal responsive. A window that is too long reacts slowly. One that is too short chases noise, because three bad attempts in a row can happen to anyone. - Layering on the preset. The scale is applied after the player's preset and overrides are resolved:
interface DamageSettings {
enemyDamageMultiplier: number;
}
function effectiveEnemyDamage(settings: DamageSettings, scale: number): number {
return settings.enemyDamageMultiplier * scale;
}
console.log(effectiveEnemyDamage({ enemyDamageMultiplier: 1.5 }, 0.7)); // 1.05A player on Hard with the scale at its floor still faces more damage than a Normal player with the scale at its ceiling would face from the preset alone. The preset keeps its meaning.
Limits and failure modes
DDA looks attractive on paper, and it fails in predictable ways.
Players notice, and notice badly
When enemies visibly stop dealing damage after a few deaths, players read it as the game pitying them. When a racing opponent magically catches up (rubber-banding), players feel their lead was pointless. Both reactions damage the sense that the player's actions mattered. Mastery depends on stable rules: if the challenge shrinks whenever you struggle, you never learn to beat the original version.
Players exploit it
If the system rewards failure with an easier game, a player can fail on purpose, then play well once the game has softened. This is called sandbagging. A bounded range limits the damage, but does not remove it. Reacting to a long window of results makes it more costly to fake.
Noise and small samples
Players leave the game, take a phone call, or try a risky strategy to see what happens. Each of these produces failures that say nothing about skill. Require a minimum number of outcomes, and consider ignoring attempts where the player quit or did something unusual.
Oscillation
A system that reacts quickly can overshoot. The game gets easier, the player wins several times, the game gets harder, the player loses, and the cycle repeats. Small steps, a smoothing window, and a target range instead of a single value (for example, "do nothing while the fail rate is between 20% and 40%") all reduce this.
Conflict with the player's own choice
A player who picked Story mode asked for a relaxed experience. A player who picked Hard asked for a strict one. A DDA system that quietly pushes against either choice breaks the promise the preset made. This is why the scale is bounded and layered on top of the preset.
Fairness and records
Scores, leaderboards, and achievements assume everyone faced the same challenge. DDA breaks that assumption. Common approaches are to disable DDA in ranked or competitive modes, to record the effective scale with each score, or to mark runs where it was active. The competitive-integrity chapter covers these cases in detail.
Hard to test
Because the game changes in response to play, two testers can see different games. Log the scale over time during playtests, and test the extremes by pinning the scale to its minimum and maximum. The testing chapter covers telemetry in more depth.
When to use it
| Situation | Suggested approach |
|---|---|
| Players have a clear preset and assist menu | Optional DDA, or none |
| Mixed-skill audience, few settings, no menu space | Bounded DDA on a narrow range |
| Competitive or ranked play | No DDA |
| A game built on mastery of fixed rules | Prefer assists and presets over DDA |
| Casual or narrative game where failing repeatedly would end the experience | Bounded DDA, preferably with an offer to lower difficulty |
A useful alternative to silent adjustment is a suggestion. After repeated failure, the game asks whether the player would like to try an easier setting. This keeps the choice with the player and builds confidence in the settings menu, which the later chapters on onboarding and mid-game changes build on.
If you do ship DDA, tell players it exists, and offer a way to turn it off. Hidden systems that players discover later cost more trust than a line in the settings menu ever would.
Exercise
A player on the Hard preset fails a boss eight times in a row. Using the bounded adjuster in this chapter (scale starts at 1.0, minimum 0.7, step cap 0.05, minimum five outcomes), what is the scale after the eighth failure, and why is that acceptable on Hard?
Show answer
The first four failures change nothing, because fewer than five outcomes exist. Failures five through eight each have a fail rate of 1.0, so the delta is (0.3 - 1.0) * 0.2 = -0.14, which is capped at -0.05. Four adjustments of -0.05 bring the scale to about 0.8. This is acceptable because the scale multiplies the Hard preset's values instead of replacing them. Hard's enemy damage of 1.5 becomes about 1.2 at that point, which is still higher than Normal's 1.0. The preset keeps its meaning, and the player gets only a modest, bounded relief.
Exercise
Name two reasons to disable DDA in a ranked multiplayer mode, and one alternative that keeps DDA but protects fairness.
Show answer
Ranked results are only comparable if everyone faces the same challenge, and a system that reacts to failure can be exploited by deliberately losing early. One alternative is to keep DDA in single-player modes and record the effective scale alongside each score, so leaderboards can exclude or flag runs where the scale was not 1.0.