Jump to content

  • Log In with Google      Sign In   
  • Create Account


ENet RTT different from own measured RTT?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 29 June 2013 - 06:13 AM

Hey,

I'm using ENet in my game and found out that the method ENetPeer::roundTripTime returns much higher RTT from the genuine value I guess. I measured RTT by my own - sending a reliable packet and getting it back took about 40 - 50 ms while ENetPeer::roundTripTime returns about 300 ms. Why is that happening? I guess the right value is 40 - 50 but why ENet gives so high RTT? It lacks documentation on this matter and I'm not sure whether it's my fault or I don't understand sth?


Edited by savail, 29 June 2013 - 06:21 AM.


Sponsor:

#2 Tispe   Members   -  Reputation: 1002

Like
0Likes
Like

Posted 30 June 2013 - 02:34 AM

There are many mysteries surrounding ENet, I took up the same questions 8 threads down but nobody has posted an answer yet :/



#3 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 30 June 2013 - 04:02 AM

hmm, recently I thought that maybe the value returned by ENetPeer::roundTripTime divided by 8 will be the genuine RTT? It would match the RTT measured by myself. Maybe it's senseless tongue.png but when creating a host in the tutorial:

client = enet_host_create (NULL /* create a client host */,
    MAX_PLAYERS_IN_ROOM /* only allow MAX_PLAYERS_IN_ROOM outgoing connections */,
    2 /* allow up 2 channels to be used, 0 and 1 */,
    57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */,
    14400 / 8 /* 56K modem with 14 Kbps upstream bandwidth */);

the outgoing and incoming bandwidth are specified and divided by 8 too tongue.png. I don't understand why they need to be divided by 8, but maybe it's same with ENetPeer::roundTripTime...


Edited by savail, 30 June 2013 - 04:02 AM.


#4 hplus0603   Moderators   -  Reputation: 5155

Like
2Likes
Like

Posted 30 June 2013 - 09:56 AM

The bandwidth is divided by 8 because it translates from "bits per second" to "bytes per second." That probably has nothing to do with the RTT.

 

Have you read the code that calculates RTT within ENet and figured out how it's calculated? It may start with some high guess, and then successively improve that guess as traffic flows, which means it may take a time to get a good value. (This is just speculation on my part -- I haven't used/read it personally.)


enum Bool { True, False, FileNotFound };

#5 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 30 June 2013 - 11:34 AM

hplus, you are great! Thanks a lot for your tip! It's highly dubious that I could figure this out soon enough :P and you saved my time and nerves. Indeed, it turned out that the right RTT is calculated over the course of time. I measured ENetPeer::roundTripTime after being connected for 1 sec and after being connected for 10 seconds. The results were alright in the second case - it seems 1 second isn't enough to calculate RTT appropriately in ENet.

 

Anyway, I understood that it was translated from bits to bytes per sec but the commented lines confused me, for example:

57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */

it's written that 57600 equals 56 Kbps but 56Kbps = 56000 bps so why there's 57600 instead of 56000? Maybe I'm dumb, sorry if that's the case :P



#6 hplus0603   Moderators   -  Reputation: 5155

Like
2Likes
Like

Posted 30 June 2013 - 07:18 PM

In this case, "K" is 2^10 == 1024. Which is actually 57344, so the comment is wrong anyway.

 

This has to do with how asynchronous serial systems were designed a long time ago, with a base baud (line change) rate of 75 baud, then 300 baud, then 1200 baud etc. 57600 is 48 times 1200, so it's a common serial port speed in asynchronous serial ports. Meanwhile, once modems went above 2400 bps or so, they started to use advanced signal processing to send more than just "1" and "0" in a single line state change. up to 14400 bps, they used QAM, and over that, "trellis" coding. You can Google for "V.34" and "V.90" for more historical arcana :-) 

 

The "56 kbps" modems were actually sending at a rate approximating 56,000 bits per second when working at full output power on clean lines, but that was actually not standards compliant and the transmission rate was limited in actuality to 53,300 bps downstream. (Upstream was typically limited to 33.6 kbps.) To drive them, you'd typically use a 57600 (or faster) baud rate on your serial port. The inclusion of 57600 may have been a confounding of the two similar speeds on the part of the original author.

 

That being said, those are some pretty low limits to use for games of today. Modem games do not support FPS play for 20 players. You'll want to bump up those numbers with the stated goals of your game, and require all players to have at least some kind of "broadband" connection.


enum Bool { True, False, FileNotFound };

#7 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 01 July 2013 - 02:06 AM

Thanks a lot for all this info! I totally forgot that 1 K is 1024 not 1000 in IT :|






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS