Ground Items & Loot System
The ground item system handles item drops from mobs, player deaths, and manual drops. It follows OSRS mechanics with tile-based piling, stackable merging, and tick-based despawn timers.Ground item code lives in
packages/shared/src/systems/shared/economy/GroundItemSystem.ts.
See also: OSRS Wiki: Dropped itemsCore Features
- Tile-based piling - Items stack on same tile (max 128 per tile)
- Stackable merging - Same item types automatically combine
- Tick-based despawn - All timers in game ticks (600ms)
- Loot protection - Killer/dropper gets priority access
- O(1) tile lookups - Spatial indexing for performance
- Server authority - Client cannot spawn ground items
Ground Item Constants
Ground Item Data Structure
Spawning Ground Items
Loot Protection Phases
Following OSRS mechanics, dropped items have visibility phases:Private Phase (0-100 ticks / 0-60 seconds)
- Only the dropper/killer can see the item
- Only the dropper/killer can pick it up
Public Phase (100-200 ticks / 60-120 seconds)
- Everyone can see the item
- Anyone can pick it up
Tick Processing
Every game tick, expired items are removed:Removing Ground Items
When an item is picked up or despawns:Loot Tables
Mob drops are configured via loot tables in the NPC manifest:Common Drop Models
The most common loot items have dedicated 3D models:- Bones (
models/bones/bones.glb) - Dropped by all mobs for Prayer training - Coins (
models/coin-pile/coin-pile.glb) - Currency drops with visual pile representation
LootTableService.ts rolls drops based on weights:
Ground Item Events
| Event | Data | Description |
|---|---|---|
ITEM_DROPPED | entityId, itemId, position, droppedBy | Item spawned on ground |
ITEM_DESPAWNED | itemId, itemType | Item expired and removed |
ITEM_PICKUP | playerId, entityId, itemId | Player picking up item |