Spielerando

Dynamic Difficulty

Dynamic difficulty watches how the player is doing and moves the game one small step easier or harder, aiming for a steady win rate. It judges only after enough results, waits after every change, stays inside a floor and a ceiling, and leaves a gap where a player who is doing fine is left alone.

Also called: Adaptive difficulty, Rubber banding, Difficulty scaling, Auto difficulty.

A small otter-like raft-pilot in a yellow cape fights tall choppy waves on the left, while the river ahead of her smooths out step by step into gentle ripples under a calming hand-shaped current.
Marrowtide Run, an invented river-rafting adventure. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Dynamic Difficulty" to my game.

What it should do: Players struggle and coast at different times. Nudging the challenge toward what each player can handle keeps a stuck player in the game and a strong player interested, without asking them to pick a setting.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> settling
  settling: Gathering results
  watching: Watching
  easiest: At the easiest
  hardest: At the hardest
  settling --> watching: enough results
  settling --> easiest: enough, at the floor
  settling --> hardest: enough, at the ceiling
  watching --> settling: changes, or returns
  easiest --> settling: toughens, or returns
  hardest --> settling: eases, or returns
```

Use these starting values:
- target: 0.7
- tolerance: 0.2
- alpha: 0.2
- minResults: 6 results
- maxEase: 3 steps
- maxToughen: 2 steps
- stepSize: 0.1 x

Watch out for these common mistakes:
- The game swings up and down: Tell your AI: after a change, set the average back to the target and wait for several new results before judging again.
- Easing off with no floor: Tell your AI: set an easiest level that still has some danger, and stop easing there.
- One bad night remembered forever: Tell your AI: when the player returns, keep the level but wipe the recent results, so the game starts watching afresh.
- Unfair deaths count as lost fights: Tell your AI: only report a result for fights that were fair, and leave out ones that ended for outside reasons.
- A quiet zone is missing: Tell your AI: only react beyond a band on each side of the target, and do nothing inside it.
- The change hits in the middle of a fight: Tell your AI: read the strength once when an encounter starts and keep it until the encounter ends.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

Players struggle and coast at different times. Nudging the challenge toward what each player can handle keeps a stuck player in the game and a strong player interested, without asking them to pick a setting.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

enough resultsenough, at the floorenough, at the ceilingchanges, or returnstoughens, or returnseases, or returnsGathering resultsWatchingAt the easiestAt the hardest
How it runs, as a diagram
  • Gathering results → Watching: enough results
  • Gathering results → At the easiest: enough, at the floor
  • Gathering results → At the hardest: enough, at the ceiling
  • Watching → Gathering results: changes, or returns
  • At the easiest → Gathering results: toughens, or returns
  • At the hardest → Gathering results: eases, or returns

Good starting values

ValueStart withWhat it changes
target0.7The share of encounters the player should win. Seven in ten feels like a challenge that can be beaten. Much above three quarters leaves too little room for the high band.
tolerance0.2How far the average may stray from the target before the game reacts. The gap on both sides is the quiet zone where it leaves the player alone, and a narrow one makes the game twitchy.
alpha0.2How much each new result counts. At 0.2 the last five or so results matter most. A higher number reacts faster and also to luck.
minResults6 resultsResults needed after a change before the game judges again. Too few and a lucky or unlucky streak moves the game back and forth.
maxEase3 stepsHow far the game may ease off. The floor keeps a player who is truly stuck from getting an empty game.
maxToughen2 stepsHow far the game may push back. Smaller than the way down, because a skilled player is better served by a harder fixed setting they choose.
stepSize0.1 xHow much stronger the enemies get with each step up. Ten in a hundred is small enough that one step is not noticed on its own.

What usually goes wrong

The game swings up and down

If the game judges after every result and the average is not reset, a bad fight makes it easier, the next easy fight makes it harder, and the player feels the difficulty jump around.

Fix: Tell your AI: after a change, set the average back to the target and wait for several new results before judging again.

Easing off with no floor

Some games ease off without limit, so a player who keeps failing ends up in an empty game that no longer feels like a game.

Fix: Tell your AI: set an easiest level that still has some danger, and stop easing there.

One bad night remembered forever

A player who had a terrible evening comes back a week later to a game still on the easiest setting, or still counting that streak against them.

Fix: Tell your AI: when the player returns, keep the level but wipe the recent results, so the game starts watching afresh.

Unfair deaths count as lost fights

A death from a crash, a bug or a scripted trap is counted as a lost fight, and the game eases off for a player who did nothing wrong.

Fix: Tell your AI: only report a result for fights that were fair, and leave out ones that ended for outside reasons.

A quiet zone is missing

If the game reacts to any move away from the target, a player who is doing fine still sees the difficulty changing, because no player hits exactly seven in ten.

Fix: Tell your AI: only react beyond a band on each side of the target, and do nothing inside it.

The change hits in the middle of a fight

An enemy that suddenly gets tougher while the player is fighting it feels like a cheat.

Fix: Tell your AI: read the strength once when an encounter starts and keep it until the encounter ends.

How to check it works

Works well with

Clashes with Difficulty Settings: A player who chose hard may find the game quietly easing off, and a player who chose relaxed may find it toughening up. Let the adaptive part work only inside the chosen setting, and tell the player when it is on.

Clashes with Meta-Progression: Upgrades earned over many runs make the player stronger, and an adaptive game answers by making the game harder, so the upgrades seem to do nothing. Pick one to lead. Base the adaptive steps on a level that already includes the upgrades, or keep the steps small.

Common questions

what do i tell my ai to add dynamic difficulty

Paste this: Add dynamic difficulty: keep a running average of wins and losses, judge only after at least 6 results since the last change, move one step easier below a win rate of 50 percent and one step harder above 90 percent, reset the average after every change, and stay between a floor and a ceiling.

does dynamic difficulty annoy players

It can, when it is obvious. Small steps, a quiet zone where nothing changes and a pause after every change keep it unnoticed. Some players dislike it on principle, so let them switch it off.

what should dynamic difficulty measure

Fair encounter results are the simplest: won or lost. Hits taken and time to finish also work, but each extra number is one more thing to tune and to get wrong.

how is dynamic difficulty different from difficulty settings

Difficulty settings are a choice the player makes once and can see. Dynamic difficulty is decided by the game from how the player plays. The two can live together if the adaptive steps stay inside the chosen setting.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it