XP Threshold Curve

XP requirements for player level-ups are defined by the XP_THRESHOLDS array in engine/world/leveling.ts. The table stores cumulative XP totals — the value at index n is the total run XP needed to reach level n.

Levels 1–20 — hand-tuned

The first twenty levels are explicitly authored in _BASE_THRESHOLDS, designed in two segments:

  • Levels 1–10 — flat linear ladder. Per-level cost grows in fixed 50-XP steps from 50 (lvl 1) through 500 (lvl 10). Cheap early levels give new players visible progress fast.
  • Levels 11–20 — escalating curve. Per-level cost grows by roughly 15–24% each step, climbing from 575 (lvl 11) to 3200 (lvl 20). The shape is hand-tuned, not formulaic, to ramp tension as a run goes deep.
LevelCumulative XPCost to reach
15050
5750250
102750500
1569001150
20179003200

Beyond level 20 — 12% compound growth

There is no level cap. _ensureThreshold(level) lazily extends XP_THRESHOLDS whenever a level beyond the current table end is queried. Each new step costs ceil(lastCost * 1.12) — 12% compounding on the previous level’s per-step cost. The curve grows steeply at high levels but never reaches a wall.

Per-orb XP cap

A single XP orb pickup cannot grant more than one level. The cap is enforced at the pickup-resolution boundary: max(50, (next - current) * 0.75), i.e. 75% of the current level’s remaining XP gap, with a floor of 50. Even a giant late-game orb hitting a fresh level can at most cover three quarters of the way to the next one, so level-ups always require at least two pickups.

Source

src/starship-survivors/engine/world/leveling.ts_BASE_THRESHOLDS (lines 336–358), XP_THRESHOLDS (line 362), _ensureThreshold (lines 365–373).