Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualTispe

Posted 19 March 2014 - 02:00 AM


Now, for the outgoing data, you will need some kind of maximum send rate. One packet 20 times a second? That would mean you should set the timeout to no more than 50 milliseconds.

 

I disagree. Suppose your enemy is using a spell on you or some other action. You want to get that packet ASAP. For position updates 50ms between each packet is fine.
 
You don't want Enet to manage how often you send packets. You want Enet to send a packet as soon as you tell it to. You can't have Enet waiting 50ms on another thread while an outgoing packets is waiting to be sent. If you are "lucky" and get an incoming message in those 50ms then your waiting is interupted and you can send that outgoing packet, but be unlucky and that outgoing packets sits in a queue for 50ms.
 
You want another layer ontop of Enet to decide which packets are sent and at what frequency. And thus Enet must be very responsive for any requests, be it a position update or an action.
 
So, 1ms (which can mean upto 10ms if Sleep() is used inside Enet) or 100% CPU usage....

#1Tispe

Posted 19 March 2014 - 02:00 AM


Now, for the outgoing data, you will need some kind of maximum send rate. One packet 20 times a second? That would mean you should set the timeout to no more than 50 milliseconds.

 

I disagree. Suppose your enemy is using a spell on you or some other action. You want to get that packets ASAP. For position updates 50ms between each packet is fine.
 
You don't want Enet to manage how often you send packets. You want Enet to send a packet as soon as you tell it to. You can't have Enet waiting 50ms on another thread while an outgoing packets is waiting to be sent. If you are "lucky" and get an incoming message in those 50ms then your waiting is interupted and you can send that outgoing packet, but be unlucky and that outgoing packets sits in a queue for 50ms.
 
You want another layer ontop of Enet to decide which packets are sent and at what frequency. And thus Enet must be very responsive for any requests, be it a position update or an action.
 
So, 1ms (which can mean upto 10ms if Sleep() is used inside Enet) or 100% CPU usage....

PARTNERS