Variable: math
const math: object;
MEE6-style level curve mathematics
Provides pure, deterministic functions for XP calculations using the MEE6
formula: XP = 5 * level² + 50 * level + 100
Features:
- Calculate XP requirements for levels
- Compute level from total XP
- Calculate progress within a level
- Validate XP and level values
- Compute XP differences between level ranges
Performance: All operations are O(1) or O(log n) - suitable for real-time use.
Formula Coefficients:
- CURVE_A (5): Quadratic coefficient - controls exponential growth
- CURVE_B (50): Linear coefficient - controls linear growth
- CURVE_C (100): Constant - base XP for level 1
Type declaration
computeLevelFromTotalXp()
computeLevelFromTotalXp: (totalXp) => LevelProgress;
Compute current level and progress from total XP
Computes current level and progress from total XP Inverse calculation of totalXpForLevel