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
- Pickaxe in inventory or equipped
- Mining level matching the ore requirement
- Cardinal adjacency to the rock (N/E/S/W, not diagonal)
Mining Flow
- Click an ore rock
- System validates level and tool
- Player faces the rock and starts mining animation
- Every N ticks (based on pickaxe tier), roll for success
- On success: receive ore, grant XP, 1/8 chance to deplete rock
- Rock respawns after configured ticks
OSRS-Accurate Mechanics
Variable Roll, Fixed Success
Mining uses “variable-roll-fixed-success” mechanics:- 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 intools.json manifest:
Dragon/Crystal Pickaxe Bonus
Dragon and Crystal pickaxes have a chance for 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
Success Rate Formula
Mining uses OSRS’s LERP interpolation formula:Success Rate Tables
Success rates are defined inGATHERING_CONSTANTS.MINING_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):Model Scaling Fix
Recent fix ensures rocks display at correct scale:Server-Authoritative Position
Mining uses server-authoritative position for all validation:Testing
Mining has comprehensive test coverage:Related Documentation
- Resource Gathering - General gathering mechanics
- Skills System - XP and leveling
- Smithing - Using mined ores
- Item Manifests - Defining ores and pickaxes