# E2.M2 — XpAwardAndLevelEngine ## Summary | Field | Value | |--------|--------| | **Module ID** | E2.M2 | | **Epic** | [Epic 2 — Classless Progression](../epics/epic_02_classless_progression.md) | | **Stage target** | Prototype | | **Status** | Planned (see [dependency register](module_dependency_register.md)) | ## Purpose Central server-authoritative engine for classless skill progression: applying XP grants, resolving levels against data-driven curves, and emitting level-up events. Gathering, crafting, and combat integrate **as callers** of this API without being hard dependencies for implementing the engine itself (see Epic 2 Slice 2 vs Slice 3). ## Responsibilities - Apply `XpGrantEvent` (or equivalent) per skill with validated skill references from [E2.M1](E2_M1_SkillDefinitionRegistry.md). - Resolve experience against `LevelCurve` / threshold tables. - Emit `LevelUpEvent` when thresholds are crossed. - Support data-driven curves and reload policy agreed for prototype. ## Key contracts | Contract | Role | |----------|------| | `XpGrantEvent` | Structured XP award (skill id, amount, source, modifiers). | | `LevelCurve` | Thresholds or formula per skill or global policy. | | `LevelUpEvent` | Notification for UI, unlocks, and downstream systems. | ## Module dependencies - **E2.M1** — [SkillDefinitionRegistry](E2_M1_SkillDefinitionRegistry.md): `SkillDef`, categories, and validation of skill IDs. ## Dependents (by design) - **E5.M1** — CombatRulesEngine: combat awards XP via integration (Epic 5 / Epic 2 slices). - **E3.M1 / E3.M2** — Gathering and crafting award XP when wired in Slice 3. - **E7.M2** — RewardAndUnlockRouter routes quest rewards including XP through E2.M2. - **E2.M3 / E2.M4** — Mastery and pacing layers build on level/XP state (pre-production). ## Related implementation slices - **Epic 2 Slice 2 — XP engine (E2.M2 core)**: implement contracts and tests without requiring Epic 3 or 5 modules. - **Epic 2 Slice 3 — XP award integration**: wire E3.M1, E3.M2, E5.M1 to the award API for three prototype skill lines. ## Risks and telemetry - Runaway leveling in one skill: diminishing returns per slice; monitor distribution via E9.M2 when available. - Telemetry: `xp_grant`, `level_up`, time-to-first-level-up once real activity fires. ## Source anchors - Master plan: [`neon_sprawl_vision.plan.md`](../../../neon_sprawl_vision.plan.md) — Core Epic Map, Epic 2. - [Module dependency register](module_dependency_register.md)