ModernUO/Projects/Server/Mobiles
Kamron Batman ee2cd1d18d
feat: Adds new decay system and SkipSerialization (#2311)
## Summary

- Replaces scan-based decay checking during world saves with an event-driven timer wheel scheduler
- Removes virtual property checks from serialization hot path, achieving 6-8x faster world saves

## Changes

### DecayScheduler (new):
- Timer wheel with 12 HashSet buckets (5-min intervals) + PriorityQueue for active processing
- O(1) register/unregister vs O(n) scan of all items
- Auto start/stop when items exist/empty
- Configurable tick interval with jitter to prevent system synchronization

### Item.cs:
- Added ScheduledDecayTime computed property
- Added UpdateDecayRegistration() called from SetLastMoved(), property setters, AddItem()/RemoveItem()
- Hooks in Visible, Movable, Spawner setters and Delete()

### World.cs:
- Removed _decayQueue, EnqueueForDecay(), ProcessDecay()
- ItemPersistence.Serialize() now tight loop without virtual calls

## Performance

| Metric        | Before     | After     | Improvement |
|---------------|------------|-----------|-------------|
| Items (230K)  | 245K ticks | 34K ticks | 8x faster   |
| Mobiles (43K) | 56K ticks  | 6K ticks  | 9x faster   |
| Total         | 302K ticks | 40K ticks | 7.5x faster |

## Configuration

decay.maxItemsPerTick = 250       # Items processed per tick
decay.tickInterval = 256ms        # Base processing interval
decay.bucketInterval = 5min       # Timer wheel bucket size
decay.jitterMaxMs = 25            # ±25ms tick jitter
2026-01-08 11:43:51 -08:00
..
Mods fix: Updates schema generator to 2.6.4 (#1452) 2023-08-11 00:09:56 -07:00
AggressorInfo.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
BaseVendor.cs fix: Fixes client crash while selling items to NPC (#1296) 2022-12-05 20:16:31 -08:00
Body.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
IHasSteps.cs feat: Adds Stamina System to overhaul overweight. (#1465) 2023-09-16 17:52:54 -07:00
IMount.cs fix: Optimizes FindItemsByType by removing allocations. (#1515) 2023-09-28 19:36:45 -07:00
IVendor.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Mobile.cs feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Mobile.Enumerators.cs feat: Adds proper OSI tracking up to 120 tiles. (#2281) 2025-11-29 09:55:52 -08:00
Mobile.Migrations.cs fix: Overhauls virtue system (#1376) 2023-07-19 21:43:47 -07:00
Movement.cs fix: Consolidates and fixes movement/direction checks (#1861) 2024-07-06 12:41:45 -07:00
Notoriety.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
SimplePrompt.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
SimpleTarget.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00