Skip to main content

Skills System Documentation

Hyperscape implements a comprehensive OSRS-style skills system with 17 skills, XP progression, and level requirements.

Overview

Total Skills: 17 (7 combat, 3 gathering, 7 production) Level Range: 1-99 for all skills XP Formula: Uses OSRS XP table formula:
Combat Level: Calculated from combat skills using OSRS formula Total Level: Sum of all skill levels (max 1683 at 99 in all skills)

Skill Categories

Combat Skills

Gathering Skills

Production Skills

Production Skills Details

Cooking

Mechanics:
  • Cook raw food at fires or ranges
  • Burn chance decreases with level
  • Stop-burn level varies by food and heat source (ranges have lower stop-burn)
  • Grants cooking XP per successful cook
Recipe Data: packages/server/world/assets/manifests/recipes/cooking.json Example Recipe:

Smithing

Mechanics:
  • Smelting: Combine ores + coal at furnaces → bars (4 ticks, success rate varies)
  • Forging: Use bars at anvils → weapons/armor/tools (4 ticks)
  • Multi-output support: Arrowtips produce 15 per bar
  • Grants smithing XP per item made
Recipe Data:
  • packages/server/world/assets/manifests/recipes/smelting.json
  • packages/server/world/assets/manifests/recipes/smithing.json
Example Smelting Recipe:
Example Smithing Recipe:

Crafting

Mechanics:
  • Leather Armor: Use needle + thread + leather/dragonhide
  • Jewelry: Use mould + gold bar at furnace
  • Gem Cutting: Use chisel on uncut gems
  • Thread has 5 uses before being consumed
  • Always succeeds (no failure rate)
  • Grants crafting XP per item made
Recipe Data: packages/server/world/assets/manifests/recipes/crafting.json Example Recipe:
Categories: leather, studded, dragonhide, jewelry, gem_cutting

Fletching

Mechanics:
  • Arrow Shafts: Knife + logs → 15 arrow shafts per log
  • Bows: Knife + logs → unstrung bow, then bowstring + unstrung bow → strung bow
  • Arrows: Arrowtips + headless arrows → finished arrows (multi-output)
  • Headless Arrows: Arrow shafts + feathers → headless arrows (multi-output)
  • Always succeeds (no failure rate)
  • Multi-output support (15 shafts per log, 15 arrows per set)
  • Grants fletching XP per action (total for all items produced)
Recipe Data: packages/server/world/assets/manifests/recipes/fletching.json Example Recipe (multi-output):
Categories: arrow_shafts, headless_arrows, shortbows, longbows, stringing, arrows

Runecrafting

Mechanics:
  • Click altar to instantly convert all carried essence → runes
  • Two essence types: rune_essence (basic runes), pure_essence (all runes)
  • Multi-rune crafting at higher levels (e.g., 2x air runes at level 11, 3x at level 22)
  • Grants runecrafting XP per essence consumed
  • No tick delay (instant conversion)
Recipe Data: packages/server/world/assets/manifests/recipes/runecrafting.json Example Recipe:
Multi-Rune Calculation:
  • Base: 1 rune per essence
  • Each threshold in multiRuneLevels adds +1 rune per essence
  • Example: At level 22, air runes produce 3 per essence (base + 2 thresholds)
Altar Types: air, water, earth, fire, mind, body, cosmic, chaos, nature, law, death, blood

Tanning

Mechanics:
  • Talk to tanner NPC to instantly convert hides → leather
  • Costs coins per hide tanned
  • No level requirement
  • No XP reward
  • Instant conversion (no tick delay)
Recipe Data: packages/server/world/assets/manifests/recipes/tanning.json Example Recipe:

Skill Guide Panel

Feature (added in PR #711):
  • Click any skill icon in the skills panel to open the guide
  • Shows all unlocks for that skill at each level
  • Visual indicators:
    • ✓ Green: Unlocked (player meets level requirement)
    • ➤ Yellow: Next unlock (closest level above player)
    • 🔒 Gray: Locked (future unlocks)
  • Displays levels to next unlock
  • Shows unlock type badges (item, ability, location, etc.)
Data Source: packages/shared/src/data/skill-unlocks.ts Example Unlock Data:

ProcessingDataProvider API

Location: packages/shared/src/data/ProcessingDataProvider.ts Purpose: Centralized recipe data provider for all processing skills. Loads recipes from JSON manifests and provides lookup methods.

Initialization

Cooking Methods

Smithing Methods

Smelting Methods

Crafting Methods

Fletching Methods

Runecrafting Methods

Tanning Methods

System Architecture

SkillsSystem

Location: packages/shared/src/systems/shared/character/SkillsSystem.ts Responsibilities:
  • XP tracking and level calculation
  • Level-up detection and events
  • Combat level calculation
  • Total level tracking
  • Skill milestone detection
  • XP drop visualization
Key Methods:
Events Emitted:
  • SKILLS_XP_GAINED: XP awarded to a skill
  • SKILLS_LEVEL_UP: Skill leveled up
  • SKILLS_MILESTONE: Skill milestone reached (50, 92, 99)
  • SKILLS_UPDATED: Skills data changed (for UI sync)
  • COMBAT_LEVEL_CHANGED: Combat level changed
  • TOTAL_LEVEL_CHANGED: Total level changed
  • XP_DROP_BROADCAST: XP drop for visual feedback

Processing Systems

All processing systems follow a common pattern:
  1. Listen for interaction events (player clicks station/uses item)
  2. Validate player level and materials
  3. Create tick-based session (or instant for runecrafting)
  4. Process on tick completion (consume materials, add output, grant XP)
  5. Cancel on movement/combat (OSRS behavior)
  6. Emit completion events (for UI feedback and logging)
Systems:
  • CookingSystem - Food preparation
  • FiremakingSystem - Fire lighting
  • SmeltingSystem - Ore smelting
  • SmithingSystem - Item forging
  • CraftingSystem - Leather/jewelry/gems
  • FletchingSystem - Bows/arrows
  • RunecraftingSystem - Rune creation
  • TanningSystem - Hide tanning
Common Features:
  • Server-authoritative (all systems run on server)
  • Rate limiting (prevent spam)
  • Audit logging (economic tracking)
  • Idempotency checks (prevent duplicate actions)
  • Inventory validation (re-check materials before consumption)
  • Session management (one active session per player)
Example: Starting a Crafting Session:

Database Schema

Character Skills (stored in characters table): Each skill has two columns:
  • {skill}Level - Current level (1-99)
  • {skill}Xp - Current XP (0-200,000,000)
Columns:
Migrations:
  • 0029: Added crafting skill columns
  • 0030: Added fletching skill columns
  • 0031: Added runecrafting skill columns

Adding New Skills

To add a new skill to Hyperscape:

1. Update SkillsSystem

Add skill constant to Skill object:
Add skill to Skills type in packages/shared/src/types/core/core.ts:
Add skill to level/XP calculation methods in SkillsSystem.ts:

2. Create Processing System

Create HerbloreSystem.ts following the pattern in CraftingSystem.ts:
  • Extend SystemBase
  • Listen for interaction events
  • Validate level and materials
  • Create tick-based sessions
  • Process on tick completion
  • Cancel on movement/combat
  • Emit completion events

3. Add Recipe Manifest

Create packages/server/world/assets/manifests/recipes/herblore.json:

4. Update ProcessingDataProvider

Add methods to load and access herblore recipes:

5. Add Database Migration

Create migration to add skill columns:

6. Update UI

Add skill icon to packages/shared/src/data/skill-icons.ts:
Add unlock data to packages/shared/src/data/skill-unlocks.ts:

7. Register System

Add to world initialization in packages/shared/src/runtime/createServerWorld.ts:

Testing

All skill systems have comprehensive unit tests: Test Files:
  • packages/shared/src/systems/shared/interaction/__tests__/CraftingSystem.test.ts
  • packages/shared/src/systems/shared/interaction/__tests__/FletchingSystem.test.ts
  • packages/shared/src/systems/shared/interaction/__tests__/RunecraftingSystem.test.ts
  • packages/shared/src/data/__tests__/ProcessingDataProvider.test.ts
Test Coverage:
  • Recipe loading and validation
  • Level requirement checks
  • Material consumption
  • XP calculation
  • Multi-output handling (fletching, smithing arrowtips)
  • Consumable tracking (thread uses)
  • Multi-rune multipliers (runecrafting)
  • Session management (start, complete, cancel)
  • Edge cases (out of materials, level too low, invalid recipes)
Example Test:

Performance Optimizations

Memory Management:
  • Pre-allocated buffers for inventory counting (avoids Map allocations in hot paths)
  • Reusable arrays for tick processing (avoids per-frame allocations)
  • Skill level caching (reduces entity lookups)
Tick Processing:
  • Once-per-tick processing guard (prevents duplicate processing)
  • Batch completion checks (collect completed sessions, then process)
  • Early exits for empty sessions
Example (from FletchingSystem):

Manifest-Driven Design

All skill recipes are defined in JSON manifests, not hardcoded in TypeScript: Recipe Manifests:
  • packages/server/world/assets/manifests/recipes/cooking.json
  • packages/server/world/assets/manifests/recipes/firemaking.json
  • packages/server/world/assets/manifests/recipes/smelting.json
  • packages/server/world/assets/manifests/recipes/smithing.json
  • packages/server/world/assets/manifests/recipes/crafting.json
  • packages/server/world/assets/manifests/recipes/fletching.json
  • packages/server/world/assets/manifests/recipes/runecrafting.json
  • packages/server/world/assets/manifests/recipes/tanning.json
Benefits:
  • Add new recipes without code changes
  • Easy balancing (edit JSON, reload)
  • Content creators can add recipes
  • Validation on load (detailed error reporting)
  • Fallback to embedded item data (backwards compatibility)
Validation: ProcessingDataProvider validates all recipes on load:
  • Required fields present and correct types
  • Level in range [1, 99]
  • XP > 0, ticks > 0
  • All item IDs exist in ITEMS manifest
  • Input amounts >= 1
  • Tool IDs valid
  • Consumable uses >= 1
Validation errors are logged to console with recipe label for easy debugging.

UI Components

SkillsPanel

Location: packages/client/src/game/panels/SkillsPanel.tsx Features:
  • Displays all 17 skills with icons, levels, and XP
  • Click skill icon to open Skill Guide Panel
  • Shows XP progress bars
  • Displays combat level and total level
  • Real-time updates via SKILLS_UPDATED events

SkillGuidePanel

Location: packages/client/src/game/panels/SkillGuidePanel.tsx Features (new in PR #711):
  • Modal window showing all unlocks for a skill
  • Sorted by level (ascending)
  • Visual unlock status (unlocked/next/locked)
  • Shows levels to next unlock
  • Type badges (item, ability, location, etc.)
  • Progress indicator (X/Y unlocked)
Usage:

Processing Panels

Panels:
  • CraftingPanel.tsx - Leather/jewelry/gems
  • FletchingPanel.tsx - Bows/arrows
  • SmithingPanel.tsx - Metal items
  • SmeltingPanel.tsx - Ore smelting
  • TanningPanel.tsx - Hide tanning
Common Features:
  • Category grouping (e.g., leather, studded, dragonhide)
  • Recipe filtering by available materials
  • Level requirement indicators (red = too low, green = can make)
  • Material count display
  • Quantity selection (1, 5, 10, All)
  • Output quantity display (for multi-output recipes)

Event Flow

Crafting Example

Runecrafting Example (Instant)

Common Pitfalls

1. Forgetting to Register Skills in Multiple Places

When adding a new skill, you must update:
  • Skill constants in SkillsSystem.ts
  • Skills type in types/core/core.ts
  • Skill arrays in getTotalLevel() and getTotalXP()
  • Database migration (add columns)
  • SKILL_ICONS in skill-icons.ts
  • SKILL_UNLOCKS in skill-unlocks.ts

2. Not Handling Multi-Output Recipes

Fletching and smithing arrowtips produce multiple items per action:
  • Use outputQuantity field in recipe
  • Grant XP once per action (not per item)
  • Display output quantity in UI

3. Forgetting Movement/Combat Cancellation

All processing systems must cancel on:
  • MOVEMENT_CLICK_TO_MOVE event
  • COMBAT_STARTED event
This is OSRS-accurate behavior.

4. Not Validating Materials Before Consumption

Always re-check inventory before consuming materials:

5. Hardcoding Recipe Data

Never hardcode recipe data in system files:

Additional Resources