Progressive challenge and adaptive difficulty. Difficulty curves by time, level or wave (linear, easing, steps, sawtooth with rest dips), which variables to scale and which not to, difficulty presets (story, normal, hard) as multipliers, accessibility and assist options, dynamic difficulty adjustment that quietly eases off when players struggle and pushes when they cruise, rubber-banding for ra...
Download skill (.zip) Files on GitHubDifficulty scaling
Drop-in: assets/difficulty.js (tests: easing curve shape, steps, DDA lowers after deaths and raises after perfect play
within bounds, rubber-band limits).
import { curve, PRESETS, scaled, AdaptiveDifficulty, rubberBand } from "./core/difficulty.js";
const speedAt = curve.ease(120, 320, 90); // px/s over seconds played: fast ramp, then flattens
const preset = PRESETS[settings.difficulty]; // story / normal / hard
const dda = new AdaptiveDifficulty({ min: 0.8, max: 1.2 }); // subtle range
// events: dda.record("death") / ("hit") / ("perfect") / ("fastClear") each step: dda.update(dt)
enemy.speed = scaled(speedAt(runTime), preset, "enemySpeed") * dda.level;
What to scale
| Scale | Usually not |
|---|---|
| Spawn rate and count, enemy speed, enemy HP and damage, number of hazards, timers, gaps | Player controls (jump height, speed), hitbox sizes, input windows |
| New enemy types and combinations (more interesting than bigger numbers) | Rules that change what the player learned |
Ramp one or two variables at a time; mix in new ideas instead of only bigger numbers.
Curve shapes
ease: most games (quick start, then slow growth).steps: level-based (level 1, 2, 3 values).sawtooth: tension then a short dip (after a boss, a wave, a checkpoint). Rest moments make peaks feel bigger.
Presets and assists
- Offer Story / Normal / Hard as multipliers (
PRESETS). Allow changing it any time, without shame wording. - Assists: slower game speed, extra lives, aim assist, skip a level after N failures, longer timers, invincibility. They’re accessibility features. Keep achievements fair by noting assist use instead of blocking it.
Dynamic difficulty (DDA)
Quiet and bounded: ±20% at most, changing slowly, never visibly mid-action (apply on respawn or the next wave). Never punish skill: a player doing great gets a little more challenge, not cheap shots. Tell players it exists in the settings if it’s on.
Test
Plot the curve (values at 0, 1, 5, 10, 20 minutes), simulate runs (game-balance-testing), and play the first 2 minutes as a new player: losing should be possible but not likely.