-
Notifications
You must be signed in to change notification settings - Fork 381
performance: optimize entity packet broadcasting #2803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
80b30e8 to
060e558
Compare
- 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.
060e558 to
3a2d944
Compare
pandinocoder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the cache interact with clients connecting after the cache is established? Does the cache get hit there and skip sending values to them?
Does the cache properly clear when NPCs and players die/spawn/connect/disconnect?
Signed-off-by: Arufonsu <17498701+Arufonsu@users.noreply.github.com>
Signed-off-by: Arufonsu <17498701+Arufonsu@users.noreply.github.com>
When clients connect:
The cache is cleared via:
|
performance: optimize packet broadcasting by caching entity snapshots
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.