Skip to content

Conversation

@Arufonsu
Copy link
Contributor

@Arufonsu Arufonsu commented Feb 1, 2026

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.

@Arufonsu Arufonsu requested a review from a team February 1, 2026 17:45
@Arufonsu Arufonsu added the performance Performance optimization label Feb 1, 2026
@Arufonsu Arufonsu marked this pull request as draft February 1, 2026 19:54
@Arufonsu Arufonsu force-pushed the performance/entity-packets-broadcast branch from 80b30e8 to 060e558 Compare February 1, 2026 22:58
- 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.
@Arufonsu Arufonsu force-pushed the performance/entity-packets-broadcast branch from 060e558 to 3a2d944 Compare February 1, 2026 22:59
@Arufonsu Arufonsu marked this pull request as ready for review February 1, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants