> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rpg-leveling.zuxaw.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mathematical Formulas

> Monster-level XP, level-difference multipliers, zones, and progression.

# Mathematical Formulas

In **0.2.0**, XP and progression use a **monster-level-based system** with **level-difference multipliers** and **zones**. This replaces the previous health-based XP formula.

***

## How the New System Works

Your XP gains depend on **two main factors**:

1. **Monster level** - Base XP scales with the monster's level (higher level = more base XP).
2. **Level difference** - How close the monster's level is to yours. Fighting monsters near your level gives the best XP; farming much easier or much harder content is heavily penalized.

***

## XP Gain from Mobs

### Base XP (Monster Level)

Base XP is determined by the **monster's level**:

```
Base XP ≈ MonsterLevel × √MonsterLevel   (conceptually; implementation may use level² scaling)
```

| Monster Level | Approx. Base XP |
| ------------- | --------------- |
| 1             | \~1             |
| 50            | \~353           |
| 81            | \~729           |
| 100           | \~1,000         |

Higher-level monsters give more base XP.

### Level Difference Multiplier

The **difference between your level and the monster's level** applies a multiplier:

| Your Level vs Monster Level | Multiplier   | Result                                  |
| --------------------------- | ------------ | --------------------------------------- |
| **Same level** (±0)         | **1.5×**     | **Best XP!**                            |
| **1–5 levels higher**       | 1.1× – 1.5×  | Great XP                                |
| **6–25 levels higher**      | 1.0×         | Normal XP                               |
| **26–30 levels higher**     | 0.5×         | Reduced (50% penalty)                   |
| **31–40 levels higher**     | 0.4×         | Low (60% penalty)                       |
| **41–50 levels higher**     | 0.3×         | Very low (70% penalty)                  |
| **51+ levels higher**       | 0.2×         | Minimal (80% penalty)                   |
| **1–5 levels lower**        | 1.4× – 1.0×  | Good XP                                 |
| **6–25 levels lower**       | 0.96× – 0.2× | Decreasing XP                           |
| **26+ levels lower**        | 0.1×         | Very low (90% penalty, trivial content) |

You can disable the **underleveled XP penalty** (rows where the monster is higher than you) via `EnableGapLevelXpReducer: false` in config - you will get full XP (1.0×) from higher-level monsters. See [Configuration](configuration) or [Difficulty Scaling](difficulty-scaling).

**Best strategy:** Fight monsters within **±25 levels** of your level. **Same-level** or **slightly higher** (±5) gives the highest bonuses.

### Final XP Formula

```
Final XP = Base XP(monster level) × Level Difference Multiplier × RateExp × ZoneRateExp
```

| Variable                        | Description                                                                                                                                                    |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Base XP**                     | From monster level (see table above)                                                                                                                           |
| **Level Difference Multiplier** | From your level vs monster level (see table)                                                                                                                   |
| **RateExp**                     | Global XP rate from RPGLevelingConfig (default 1.0; e.g. 2.0 = double XP)                                                                                      |
| **ZoneRateExp**                 | Per-zone XP multiplier from ZoneLevelConfig (default 1.0; e.g. 2.0 = double XP in that zone, 0.5 = half). Applied to mob kills and block break XP in the zone. |

**Example (Level 81 vs Level 81 monster, RateExp 3.0, ZoneRateExp 1.0):**\
Base 729 × 1.5 × 3.0 × 1.0 = **\~3,281 XP** per kill.

***

## Zones and Monster Level Ranges

The world is divided into **zones** with different monster level ranges:

| Zone  | Name             | Monster Levels | Best For                |
| ----- | ---------------- | -------------- | ----------------------- |
| **1** | Emerald Grove    | 1 – 25         | Early game (Level 1–30) |
| **2** | Howling Sands    | 25 – 50        | Mid game (Level 20–55)  |
| **3** | Borea            | 50 – 75        | Late game (Level 45–80) |
| **4** | Devastated Lands | 75 – 100       | End game (Level 70–100) |
| **5** | Skylands         | 85 – 100       | Max level               |
| **6** | Poisonlands      | 90 – 100       | Ultimate challenge      |

### Monster Level Variation (±5)

Monsters in a zone have **±5 level variation** around their base. Same zone, same “type” of monster can be different levels (e.g. 30, 33, 37, 40). This adds variety and keeps combat less predictable.

***

## Zone Colors on the HUD

The HUD shows the **current zone** and its **color** based on how it fits your level:

| Color                     | Meaning                 | XP                        | Action                      |
| ------------------------- | ----------------------- | ------------------------- | --------------------------- |
| **White**                 | Too easy (−26+ levels)  | 10% (90% penalty)         | Move to a harder zone       |
| **Green**                 | Good match (±25 levels) | 100–150% (full + bonuses) | **Stay here**               |
| **Orange / Red / Purple** | Too hard (+26+ levels)  | 20–50% (50–80% penalty)   | Come back when higher level |

**Pro tip:** If the zone name is **green**, you're in the right place for the best XP.

***

## XP Required for Level

Total XP required to reach a level:

```
XP_required = LevelBaseXP × level^2.5 + LevelOffset   (level ≥ 2)
XP_required(1) = 0
```

The exponent **2.5** (not squared) gives a steeper curve: easier early levels, much harder at high levels.

| Variable        | Description                                                                                                                    |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **level**       | Target level                                                                                                                   |
| **LevelBaseXP** | Base for level formula (default 150.0 in config; examples below use 50.0)                                                      |
| **LevelOffset** | Added to total XP per level. Only affects **XP needed for 1→2**; for 2→3 and beyond it cancels out when taking the difference. |

**Examples (LevelBaseXP = 50.0, LevelOffset = 0.0):**

| Level | XP Required  |
| ----- | ------------ |
| 1     | 0 (starting) |
| 2     | 283          |
| 10    | 15,811       |
| 50    | 883,884      |
| 100   | 5,000,000    |

### XP Needed for Next Level

```
XP_needed = XP_required(level + 1) - XP_required(level)
```

***

## Progression and Monsters per Level

Approximate **monsters to kill per level** when fighting **same-level** monsters (RateExp 3.0, LevelBaseXP 150, default formulas). **"XP per level-up"** is the range for **one** level step in that band (e.g. 1→2 needs \~850 XP, 9→10 needs \~10,500 XP). Total XP to go 1→10 is much higher (\~47,400).

| Level Range | XP per level-up (min – max) | XP per Kill   | Monsters per level-up |
| ----------- | --------------------------- | ------------- | --------------------- |
| 1 → 10      | 849 – 10,984                | 4.5 – 122     | 189 – 90              |
| 20 → 30     | 34,809 – 60,089             | 403 – 703     | 86 – 85               |
| 50 → 60     | 134,566 – 172,496           | 1,591 – 2,039 | 85                    |
| 80 → 82     | 270,849 – 277,111           | 3,220 – 3,281 | 84                    |
| 90 → 100    | 326,656 – 372,192           | 3,845 – 4,433 | 85 – 84               |

**Total (1 → 100, same-level farming):** \~**9,000 – 12,000 monsters** (order of magnitude), depending on exact rates and level choices.

***

## XP from Mining and Woodcutting

**0.2.3+:** You can earn XP from breaking blocks:

* **Mining XP:** Blocks whose ID contains `ore` or `mineral` (e.g., Iron\_Ore, Diamond\_Mineral)
* **Woodcutting XP:** Blocks whose ID contains `log` or `tree` (e.g., Oak\_Log, Birch\_Tree)

**Note:** Stone, rock, wood, and plank blocks do NOT give XP (but still benefit from Mining/Woodcutting stat speed bonus).

### Block XP Formula

```
Block XP = BaseBlockXP × PlayerScale × ZoneMultiplier × RateExp
```

| Variable           | Description                                                                                                         |
| ------------------ | ------------------------------------------------------------------------------------------------------------------- |
| **BaseBlockXP**    | From config: `BlockXPBaseMining` (default 5.0) or `BlockXPBaseWood` (default 3.0)                                   |
| **PlayerScale**    | `1.0 + (playerLevel - 1) × BlockXPPlayerLevelFactor` (no cap). Factor default 0.1 (see [Main Config](config-main)). |
| **ZoneMultiplier** | `1.0 + (zoneLevelMid - 1) × BlockXPZoneLevelFactor`, capped at 1.5                                                  |
| **RateExp**        | Global XP rate from config (same as mob XP)                                                                         |

### Zone Bonus for Blocks

Mining/woodcutting in higher-level zones gives more XP. Each zone can have its own `BlockXPZoneLevelFactor` in [Zone Config](config-zones):

| Zone             | ZoneLevelMid | BlockXPZoneLevelFactor | Zone Multiplier |
| ---------------- | ------------ | ---------------------- | --------------- |
| Zone 1 (L1-15)   | 8            | 0.005                  | 1.035×          |
| Zone 2 (L15-50)  | 32           | 0.005                  | 1.155×          |
| Zone 4 (L75-100) | 87           | 0.005                  | 1.43×           |

### Example

Player level 50, mining ore in Zone 3 (L50-75, zoneLevelMid=62), RateExp=3.0, BlockXPPlayerLevelFactor=0.1:

```
BaseBlockXP = 5.0 (mining)
PlayerScale = 1.0 + (50-1) × 0.1 = 5.9 (no cap)
ZoneMultiplier = 1.0 + (62-1) × 0.005 = 1.305
Block XP = 5.0 × 5.9 × 1.305 × 3.0 ≈ 115.4 XP per ore
```

At level 80 (no zone bonus, factor 0.1): PlayerScale = 1 + 79×0.1 = 8.9 → \~133 XP per ore (mining, base 5, rate 3).

See [Main Config](config-main) for `EnableBlockXP`, `BlockXPBaseMining`, `BlockXPBaseWood`, `BlockXPPlayerLevelFactor`.

***

## Stat Points

Same as 0.1.9:

* **Stat points per level:** 3 (configurable)
* **Max level:** 100
* **Total at max:** (100 − 1) × 3 = **297** stat points

See [Configuration](configuration) for `StatPointsPerLevel`, `StatValuePerPoint`, and related options.

***

## Summary

| Topic          | 0.2.0 behavior                                    |
| -------------- | ------------------------------------------------- |
| **XP source**  | Monster **level** (not max health)                |
| **Multiplier** | **Level difference** (you vs monster)             |
| **Zones**      | 6 zones with level ranges; HUD shows zone + color |
| **Variation**  | ±5 monster level within a zone                    |
| **Best XP**    | Same-level or ±5 levels; **green** zones          |
| **Penalties**  | Too easy (white) or too hard (orange/red/purple)  |

For **difficulty scaling** (monster damage, HP, level-gap combat), see [Difficulty Scaling](difficulty-scaling).
