quantum-core-x icon indicating copy to clipboard operation
quantum-core-x copied to clipboard

feature: Packet sending queue throttling / update coalescing

Open andreionoie opened this issue 2 months ago • 3 comments

What feature would you like to request?

Throttling: keep some kind of limit throttle per-connection on packet sending so we don't overload the client.

Coalescing/Conflation: for a given key (e.g. character vid), only send the most recent update packet (deduplication). No point in sending multiple character updates just for them to get quickly overwritten in the client. The existing packet sending infrastructure should handle this so we don't worry about it in game logic classes.

Why do you need this feature?

Noticed multiple bugs or perf degradations or glitches due to this.

Feature Priority

High

Original Metin2 Behavior

Yes

Feature Screenshot / GIF

No response

andreionoie avatar Nov 09 '25 16:11 andreionoie

I don't think the original implementation has such a feature but I still think this is a valid improvement.

The current architecture is designed to push out as much packets as possible as fast as possible (multi threaded).

Where did you notice these bugs/degrations? On the client or server?

MeikelLP avatar Nov 10 '25 11:11 MeikelLP

Yes it may not be original behavior, I haven't been able to verify it. I was seeing in the client delays in the actual effect application of incoming packets of about 1-2 seconds, which only happened after some time playing, and which reset itself when re-connecting from scratch to the character, even though on the network layer everything was sent as normal. I assumed the client somehow buffered an incoming queue of packets which grew larger the more time passed playing. This may be solved with throttling. Regarding coalescing, there can be for example visual glitches when you switch some equipment, which for easier game logic is translated into two operations (unequip current + equip new). If you send update packets for each of these, there is basically a kind of "flashing" between these two states which would be solved by coalescing everything in a certain "packet sending window".

andreionoie avatar Nov 10 '25 11:11 andreionoie

Ah yes sounds reasonable. The original implementaion had the infamous bug if you have too many enemies the network delay is about 5+s depending on the amount which could sometimes kill you if you cannot predict the future

MeikelLP avatar Nov 10 '25 21:11 MeikelLP