Skip to main content

Mining System

The mining system implements OSRS-accurate mechanics with pickaxe tier bonuses, level-based success rates, and proper rock depletion.
Mining code lives in packages/shared/src/systems/shared/entities/ResourceSystem.ts and packages/shared/src/systems/shared/entities/gathering/.

Overview

Mining follows Old School RuneScape mechanics:
  • Pickaxe tier affects roll frequency (not success rate)
  • Success rate is level-only (pickaxe doesn’t affect it)
  • 100% rock depletion on successful mine (1/8 chance)
  • Dragon/Crystal pickaxe bonus speed (chance for faster rolls)
  • Tick-based timing (600ms ticks)

How to Mine

Requirements

  1. Pickaxe in inventory or equipped
  2. Mining level matching the ore requirement
  3. Cardinal adjacency to the rock (N/E/S/W, not diagonal)

Mining Flow

  1. Click an ore rock
  2. System validates level and tool
  3. Player faces the rock and starts mining animation
  4. Every N ticks (based on pickaxe tier), roll for success
  5. On success: receive ore, grant XP, 1/8 chance to deplete rock
  6. Rock respawns after configured ticks

OSRS-Accurate Mechanics

Variable Roll, Fixed Success

Mining uses “variable-roll-fixed-success” mechanics:
This means:
  • Roll frequency varies by pickaxe tier (8 ticks for bronze → 3 for rune)
  • Success rate is determined by level only (pickaxe doesn’t affect it)

Pickaxe Tiers

Pickaxes are defined in tools.json manifest:
Tier Table:

Dragon/Crystal Pickaxe Bonus

Dragon and Crystal pickaxes have a chance for bonus speed:
Bonus Speed:
  • Dragon: 1/6 chance (16.7%) for 2-tick roll → avg 2.83 ticks
  • Crystal: 1/4 chance (25%) for 2-tick roll → avg 2.75 ticks
The bonus roll is server-side deterministic - rolled once per mining attempt.

Success Rate Formula

Mining uses OSRS’s LERP interpolation formula:

Success Rate Tables

Success rates are defined in GATHERING_CONSTANTS.MINING_SUCCESS_RATES:
Example Success Rates:

Rock Depletion

100% Depletion on Success

When you successfully mine ore, the rock has a 1/8 chance to deplete:

Respawn Timing

Rocks respawn after a configured number of ticks (from manifest):
Common Respawn Times:

Model Scaling Fix

Recent fix ensures rocks display at correct scale:
This fixes “squished resources” bug where rocks appeared flattened due to incorrect quaternion normalization.

Server-Authoritative Position

Mining uses server-authoritative position for all validation:

Testing

Mining has comprehensive test coverage: