ID:51364
 
I've long wanted a way to ping clients connected to my server in BYOND so that I can know who the culprits are for a slow (aka laggy) experience.

I came across this old section of code hunting through another computer tonight:

client/var/delay=0
client/var/timeout=0

client/proc/_delay()
src.delay=0
while(!timeout)
src.delay++
sleep(1)

client/verb/_Import()
spawn(-1)
src._delay()
src.timeout = ~shell("ping 192.168.1.100")
src.delay-=40
if(src.delay<0)
src.delay=0

if(delay<10)
world<<"Timeout: 0[delay]"
else
world<<"Timeout: [delay]"


This little snippet of mine was a test to see if I could fake a lag delay test for developing games.

It works with some degree of inaccuracy, but it's far from perfect. Does any one have an idea how such a thing could be done? And if they do, could I borrow it?