Commit 3a2d944
committed
performance: optimize packet broadcasting by caching entity snapshots
- Add snapshot caching for entity stats, vitals, statuses and player equipment
- Cache per-(player,npc) aggression to skip unchanged NpcAggressionPacket sends
- Cache per-(player,map) visible map-items hash to avoid regenerating identical MapItemsPacket data
- Skip redundant broadcasts when cached state matches current values
- Clear all snapshots when entities leave map/layer/instance (including player/npc aggression)
- Batch vital and status updates to only include entities with actual changes
- Equipment broadcasts now only send when items change
These changes significantly reduce network bandwidth and server CPU in high-entity scenarios (raids, events, crowded maps) by eliminating unnecessary/duplicate packet transmissions to clients while preserving first-send guarantees and correctness. Behavior is fully backwards-compatible; clients see the same game state with less packet noise and lower latency impact from server-side broadcasting.1 parent a73e5c7 commit 3a2d944
1 file changed
Lines changed: 283 additions & 21 deletions
0 commit comments