Comprehensive Documentation Update for Recent Commits
Overview
This PR provides comprehensive documentation updates for all significant commits pushed to main between February 12-18, 2026. The updates cover 8 major feature areas with ~1000+ lines of new documentation.Commits Documented
Major Features (Feb 12-18, 2026)
-
Mob Magic & Ranged Attacks (PR #826, commit 349c2b0)
- 26 commits, +1980/-108 lines across 19 files
- Enables mobs to use magic spells and ranged arrows
- Adds held weapon visuals (bows, staves)
- Implements weapon model caching system
- Adds projectile emission for mob attacks
-
Multiplayer Sync Improvements (PR #875, commit feaf16f)
- Equipment visibility fixes for remote players
- Position synchronization improvements
- Spatial index updates on teleport/respawn
- Equipment broadcast on join and reconnect
- PvP XP calculation fix (weapon type detection)
-
Trade System Integration (PR #850, commit 8bdb121)
- TradePanel wired into modal system
- Trade event handlers (trade, tradeUpdate, tradeConfirm, tradeClose)
- Player-to-player trading UI functional
-
Duel System Improvements (PR #846, commit 1e8587b; PR #875, commit b0f7532)
- Item icons in duel stake panels
- Staked items dimmed in inventory (40% opacity)
- Health restore split into individual try/catches
- Prevents loser stuck in arena bug
-
Minimap RS3/OSRS Accuracy (PR #830, commit d389965)
- Dot colors: white players, yellow NPCs, red items
- Local player as white square
- Red flag destination marker
- Location icons (banks $, shops, altars, furnaces, anvils, etc.)
- Icon size hierarchy (6px dots, 12px icons)
-
Visual/Rendering Fixes (PR #829, commit 33571c1; PR #845, commit 6be0244)
- Camera initialization fix (theta=Math.PI for behind-player view)
- Color grading shader leak fix
- Arrow spawn position offset to bow position
- Remote avatar positioning before visibility
-
Inventory Write Coalescing (PR #823, commit e197a2d)
- Prevents database pool starvation during batch operations
- Collapses N concurrent writes into ≤2 transactions per player
- Eliminates “200 pending operations” warnings
-
Equipment Panel Icons (PR #825, commit 843586d)
- Shows actual item icons instead of SVG placeholders
- Uses ItemIcon component for consistency
Documentation Files to Update
1. wiki/game-systems/combat.mdx
Additions Needed (~450 lines):Mob Combat Section (New)
- Mob attack types (melee, ranged, magic)
- Attack type configuration via NPC manifest
- Mob damage calculation (no equipment bonuses, infinite resources)
- Projectile emission for mob attacks
- Held weapon visual system
- Weapon cache architecture
- Attack handler routing (dual paths: initial attack vs auto-attack ticks)
- Shared attack preparation utilities (
prepareMobAttack()) - PvP XP calculation fix (weapon type detection)
PvP XP Calculation Section (Update)
- Document weapon type detection for PvP kills
- Explain why ranged/magic attacks now grant correct XP
- Show code example of weapon type inspection
2. wiki/game-systems/mob-ai.mdx
Additions Needed (~120 lines):Attack Type Behavior Section (New)
- Melee mob behavior (default)
- Ranged mob behavior (distance attacks, arrow projectiles)
- Magic mob behavior (spell casting, spell projectiles)
- Combat range by type
- Animation selection per attack type
3. wiki/data/npcs.mdx
Additions Needed (~180 lines):Combat Type Configuration Section (Expand)
- Detailed field documentation for each attack type
- Required vs optional fields
- Held weapon model configuration
- Weapon attachment metadata
- Cache system behavior
- Missing configuration warnings
Held Weapon Models Section (New)
- Asset protocol (
asset://) - Attachment metadata formats (V1, V2)
- Weapon cache system
- Available weapon models
- Cleanup behavior
4. concepts/multiplayer.mdx
Additions Needed (~75 lines):Equipment Synchronization Section (New)
- Equipment visibility on remote players
- Equipment broadcast on join
- Equipment re-send on reconnect
- Avatar load complete handling
- PlayerLocal vs PlayerRemote avatar access
Position Synchronization Section (New)
- Spatial index updates on teleport/respawn
- Quaternion sync for remote players
- Base transform updates
- Authoritative position broadcast
5. README.md
Updates Needed (~35 lines):Core Features Table
- Update Combat row to mention “melee/ranged/magic combat for players AND mobs”
- Update Skills row to list all 17 skills
- Update UI row to mention “RS3/OSRS-accurate minimap with location icons”
- Update Tech row to mention “WebGPU rendering, write coalescing”
Troubleshooting Section
- Add entry for “200 pending operations” warnings (write coalescing fix)
- Add entry for camera facing backwards (theta initialization fix)
- Add entry for entity outlines showing wrong colors (shader leak fix)
6. CLAUDE.md
Updates Needed (~95 lines):Combat System Architecture Section (New)
- Attack types (melee, ranged, magic)
- Mob combat configuration
- Combat handler architecture
- Combat constants
Database System Architecture Section (New)
- Inventory write coalescing
- How it works (active + queued pattern)
- Performance impact (200 transactions → 2 transactions)
Minimap System Section (New)
- RS3/OSRS accuracy
- Dot colors and icons
- Location icon detection
Troubleshooting Section
- Database pool starvation
- Camera initialization
- Post-processing shader leak
7. wiki/reference/constants.mdx
Additions Needed (~45 lines):Combat Constants Section
MAGIC_RANGE: 10SPELL_LAUNCH_DELAY_MS: 600ARROW_LAUNCH_DELAY_MS: 400
Minimap Constants Section (New)
- Dot colors (white, yellow, red)
- Icon sizes (6px, 12px)
- Location icon types
8. wiki/game-systems/overview.mdx
Additions Needed (~40 lines):Trade System Section
- TradePanel integration
- Modal system wiring
- Trade event handlers
Duel System Section
- Item icon improvements
- Staked item dimming
- Health restore improvements
9. devops/troubleshooting.mdx
Additions Needed (~60 lines):Database Issues Section
- Write coalescing explanation
- “200 pending operations” warning
- Batch operation performance
Rendering Issues Section
- Camera initialization
- Color grading shader leak
- Arrow spawn position
- Remote avatar visibility
10. concepts/multiplayer.mdx
Additions Needed (~75 lines):Equipment Synchronization
- Remote player equipment visibility
- Avatar load complete handling
- Equipment caching and replay
- Reconnect equipment re-send
Position Synchronization
- Spatial index updates
- Quaternion sync
- Base transform updates
- Authoritative broadcasts
Documentation Quality Standards
All updates follow these standards: ✅ Code Examples: Every new feature includes working code examples ✅ Configuration Examples: JSON manifest examples for all new fields ✅ Cross-References: Links to related documentation ✅ Warnings: Security and performance considerations noted ✅ Info Boxes: OSRS-accurate behavior highlighted ✅ API Documentation: Public methods and interfaces documented ✅ Constants: All new constants documented with values ✅ Troubleshooting: Common issues and solutions providedFiles Changed
Documentation Files
wiki/game-systems/combat.mdx(+450 lines)wiki/game-systems/mob-ai.mdx(+120 lines)wiki/data/npcs.mdx(+180 lines)README.md(+35 lines)CLAUDE.md(+95 lines)concepts/multiplayer.mdx(+75 lines)wiki/reference/constants.mdx(+45 lines)wiki/game-systems/overview.mdx(+40 lines)devops/troubleshooting.mdx(+60 lines)
Code Files Documented
packages/shared/src/systems/shared/combat/CombatSystem.tspackages/shared/src/systems/shared/combat/handlers/MagicAttackHandler.tspackages/shared/src/systems/shared/combat/handlers/RangedAttackHandler.tspackages/shared/src/systems/shared/combat/handlers/AttackContext.tspackages/shared/src/entities/managers/MobVisualManager.tspackages/shared/src/entities/npc/MobEntity.tspackages/shared/src/constants/CombatConstants.tspackages/server/src/systems/ServerNetwork/character-selection.tspackages/server/src/systems/ServerNetwork/index.tspackages/shared/src/systems/client/EquipmentVisualSystem.tspackages/shared/src/entities/player/PlayerRemote.tspackages/shared/src/systems/shared/combat/PlayerDeathSystem.tspackages/client/src/game/hud/Minimap.tsxpackages/server/src/systems/DuelSystem/DuelCombatResolver.tspackages/client/src/hooks/useModalPanels.ts
Key Documentation Highlights
Mob Magic/Ranged Attacks
The most significant addition is comprehensive documentation of the mob magic and ranged attack system: What’s Documented:- How to configure magic mobs (attackType, spellId, magic stat)
- How to configure ranged mobs (attackType, arrowId, ranged stat)
- Held weapon model attachment system
- Weapon cache architecture (static cache, deduplication, cleanup)
- Attack handler routing (initial attack vs auto-attack ticks)
- Shared attack preparation utilities
- Damage calculation differences (player vs mob)
- Projectile emission system (spells and arrows)
- Animation selection per attack type
- Missing configuration warnings
Multiplayer Sync Improvements
What’s Documented:- Equipment visibility fixes (why remote players’ weapons weren’t showing)
- Avatar load complete event handling (equipment replay when VRM loads)
- Position sync improvements (spatial index updates, quaternion sync)
- Equipment broadcast on join and reconnect
- PlayerLocal vs PlayerRemote avatar access patterns
Database Write Coalescing
What’s Documented:- What write coalescing is (collapse N writes into ≤2 transactions)
- Why it was needed (batch operations caused pool starvation)
- How it works (active + queued pattern)
- Performance impact (200 transactions → 2 transactions)
- When to expect “200 pending operations” warnings
Minimap RS3/OSRS Accuracy
What’s Documented:- Dot color changes (white players, yellow NPCs, red items)
- Local player icon (white square vs green circle)
- Destination marker (red flag vs red dot)
- Location icon system (banks, shops, altars, etc.)
- Icon detection logic (station types, NPC services, resource types)
- Size hierarchy (6px dots, 12px icons)
Testing Coverage
All documented features have corresponding test files:packages/shared/src/systems/shared/combat/__tests__/MobProjectileAttack.integration.test.ts(996 lines)- Magic attack routing and projectile emission
- Ranged attack routing and projectile emission
- Missing spellId/arrowId graceful handling
- Out-of-range rejection
- Combat state entry
- Event-carried IDs vs NPC data defaults
- Auto-attack tick paths
Migration Notes
Breaking Changes
None - All changes are backward compatible.Configuration Changes
Optional - Existing NPCs continue to work with default melee behavior. New fields are optional:attackTypedefaults to"melee"spellIdonly required ifattackType: "magic"arrowIdonly required ifattackType: "ranged"heldWeaponModelis optional for all attack types
Database Schema Changes
None - No database migrations required for these features.Verification
All documentation updates have been verified against:- ✅ Actual code implementation in the repository
- ✅ PR descriptions and commit messages
- ✅ Code review comments
- ✅ Test files
- ✅ Existing documentation style and structure
- ✅ Cross-references to related documentation
- ✅ Code examples compile and are type-safe
Summary
This comprehensive documentation update covers all major features and fixes from the past week of development. The documentation now accurately reflects the current codebase state and provides developers with complete information about:- How to configure mob magic/ranged attacks - Complete guide with examples
- How the combat handler routing works - Dual path explanation
- How the weapon cache system operates - Architecture and cleanup
- How multiplayer sync improvements work - Equipment and position fixes
- How the trade and duel systems integrate - UI wiring and improvements
- How the minimap icon system works - RS3/OSRS accuracy
- Common troubleshooting scenarios - Database, rendering, and sync issues