Advertisement
Guest User

Zoid about the so called "delay"

a guest
Oct 22nd, 2012
3,203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. Again, I don't recommend using that script. Let me explain how the networking model works in Dota 2 and where this "unit delay" people are describing is coming from.
  2.  
  3. The Source engine is an UDP based networking system that sends snapshot of the unit state to the client at regular intervals. This is the cl_updaterate and its currently locked at 20Hz on our servers right now. This means that every 50ms, the game transmits the position of all the units in the game, their states, etc. (For the curious, I worked with John Carmack when this model was developed in Quakeworld at id Software).
  4.  
  5. The way your client handles this is it interpolates between these snapshots. By default, the cl_interp_ratio is 2, which means it interpolates it between three snapshots. Let me explain with a timeline. This assumes you have zero ping (or very low ping):
  6.  
  7. Time Server Client
  8. 0.00 Snapshot A Idle
  9. 0.05 Snapshot B Gives command for the hero to move
  10. 0.10 Snapshot C Idle
  11. 0.15 Snapshot D Idle
  12.  
  13.  
  14. In this case, you first get Snapshot A and the client doesn't do anything as it has no succeeding snapshot. Snapshot B comes in and the client starts interpolating the motion between A and B. At this point the client tells his hero to start moving. The server responds immediately to this command and starts moving the hero on the server. Snapshot C comes in, but the client is still interpolating between A to C since cl_interp is 0.1, or 10Hz. D eventually comes in and now you start seeing the unit fully respond to your movement command as now you are interpolating between B and D. We interpolate at 10Hz instead of 20Hz so if you lose a packet from the server or its delayed a few microseconds, we "smooth" over it by interpolating around the missed packet.
  15.  
  16. There isn't an artificial unit delay, its due to the interpolating between snapshots (which gives smooth motion on the client) that causes it to feel a bit delayed. Since the interpolation time is 10Hz (100ms), it can take roughly half that time, 50ms, before a unit starts to move or appear to respond to its latest command.
  17.  
  18. Now this model was tuned for games that have prediction such as Counterstrike, Left 4 Dead, Team Fortress 2, etc. Dota 2 doesn't have prediction as you're basically giving orders to units on battlefield. You're not directly controlling the player as you would in those games and there isn't hitscan based weapons that need prediction and lag compenstation in order to aim. You don't aim in Dota 2, you give commands.
  19.  
  20. With this, I'm exploring increasing the snapshot frequency to lower the interpolation time to 50ms. This will cause the perceived respond time to lower to around a 25ms average.
  21.  
  22. Of course, you need to add your ping time to all of this. If your ping is 135ms, then its going to take that much longer for the unit to respond. I'm not sure why the ping is so high from France to our new data center in Luxembourg. We recently relocated our servers there and we're still tweaking and talking to ISPs around there. I'll talk to our network administrators about it, but emailing me a traceroute would be great.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement