MirrorNetworking / kcp2k

MIT License
289 stars 50 forks source link

jagatai high latency compared to telepathy #12

Closed miwarnec closed 3 years ago

miwarnec commented 3 years ago
miwarnec commented 3 years ago

testing on localhost first. telepathy: 13ms kcp: 30ms

significant difference already. let's find out why.

miwarnec commented 3 years ago

kcp send buffer is always between 20..300+ no matter which settings we use: https://gyazo.com/12ca6e6642c3879b50911824fa176b96 this would explain the latency.

miwarnec commented 3 years ago

1000 monsters: 30ms (sendbuffer usually ~300) 10 monsters: 30ms (sendbuffer usualy empty)

latency seems to be higher than telepathy because telepathy runs in a separate thread, where as unity's main thread is only ticked every 12-16ms.

still going to test over the internet from us<->asia now

miwarnec commented 3 years ago

testing over the internet from us<->asia. 1000 monsters benchmark. kcp V1.7, default settings:

2021-01-13_20-21-35@2x

telepathy: 180ms kcp: 220ms

=> the few ms difference are likely mostly because of unity's 16ms update rate where as telepathy is constantly updated in a thread => we could move kcp into a thread too later if needed

can't reproduce any serious latency issues as the ones mentioned above where telepathy=50ms, kcp=150ms. if anyone encounters latency issues, please let me know exactly how to reproduce with one of the mirror examples.

miwarnec commented 3 years ago

seems fixed. usually this only happened if buffers keep growing without being able to catch up. which would cause a disconnect now.