129 points · by zemanel · 15y ago · 54 comments
Most broadband connections (in the US) are really quite low latency and free from packet loss, especially to servers that are nearby (~800 miles).
Most cable/DSL connections will see 20-40 msec ping times to nearby servers. No prediction is necessary (or wanted) in that case, but you can still feel it a bit on all modern games.
Check out this earlier discussion on bufferbloat: http://news.ycombinator.com/item?id=2002992
Basically, if you have a broadband connection, a wireless card and a wireless N router expect bizarre latency spikes. The reason you get those unpredictable spikes is because of the unnecessarily big buffers at every step down the line.
smokinn@ubuntu:~$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=1.24 ms
64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=1.21 ms
64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=75.4 ms
64 bytes from 192.168.1.1: icmp_req=4 ttl=64 time=1.26 ms
64 bytes from 192.168.1.1: icmp_req=5 ttl=64 time=1.18 ms
64 bytes from 192.168.1.1: icmp_req=6 ttl=64 time=1.21 ms
64 bytes from 192.168.1.1: icmp_req=7 ttl=64 time=1.20 ms
64 bytes from 192.168.1.1: icmp_req=8 ttl=64 time=1.28 ms
64 bytes from 192.168.1.1: icmp_req=9 ttl=64 time=1.28 ms
64 bytes from 192.168.1.1: icmp_req=10 ttl=64 time=1.23 ms
64 bytes from 192.168.1.1: icmp_req=11 ttl=64 time=1.23 ms
64 bytes from 192.168.1.1: icmp_req=12 ttl=64 time=1.24 ms
64 bytes from 192.168.1.1: icmp_req=13 ttl=64 time=1.19 ms
64 bytes from 192.168.1.1: icmp_req=14 ttl=64 time=1.22 ms
64 bytes from 192.168.1.1: icmp_req=15 ttl=64 time=101 ms
64 bytes from 192.168.1.1: icmp_req=16 ttl=64 time=1.31 ms
64 bytes from 192.168.1.1: icmp_req=17 ttl=64 time=1.69 ms
Notice number 3 and 15. I'm not yet sure why exactly it does this, I haven't had time to investigate fully and honestly it's a minor problem since I don't really play games so it's pretty low on my priority list but I suspect it's either bufferbloat or a driver issue.Games that don't optimize and use more data on the wire actually feel more responsive than games that are wasteful with data.
Older games built on the Quake{1,2,3} engines use hardly any network bandwidth. Most Bad Company 2 games have only 32 players, which is hardly bigger than Quake1. What's going on that's so much more bandwidth intensive?
Also the need for more detailed positional/vector data for much more complex physics simulation, which also requires both a higher resolution of updates to function realistically. Additionally, fast moving vehicles with more delicate control/handling, such as fighter aircraft, also a require higher resolution of updates so that you can actually fly them without crashing due to the feedback loop of perceiving jerky/delayed movement and input response. Prediction can help to smooth this out.
Additionally modern games use things like physically simulated projectiles (think bullet drop[1]) with collisions calculated using mesh-based collisions instead of simple hitboxes, over much longer distances, so there is a need for prediction as timing is more of a factor. Quake 1, 2 and 3[2] use the 'hitscan' method[3] of calculating whether a bullet hits its target, which is instant and calculates a linear trajectory, which has the side effect of making it easier for players to adjust to lag (basically any difference between the player firing and the hit registering is network lag, and should be more or less consistent).
Finally, two slightly different issues that have become apparent in recent years are automatic match-making and local servers (ie, the game running on one player's console). Auto matchmaking is often fairly shitty, meaning that (on average) players end up playing on servers to which they have a higher ping time than if they had chosen the server from a server browser (something that is sadly becoming rare in today's games). The phenomena of local servers, on the other hand, puts pressure on the total available throughput, rather than ping time, as the player that is hosting likely has more limited outgoing bandwidth than a dedicated server might.
[1]http://en.wikipedia.org/wiki/External_ballistics#Bullet_drop
[2] only for some weapons, a rare exception for the time
http://www.fabiensanglard.net/quakeSource/quakeSourcePredict...
---
You may be right. I'm genuinely asking the guy if he knows one way or the other, as I do not know but certainly am curious. I mean, no lag compensation in the days of dialup? Seems like id/John Carmack would have know better even at that stage. But then again, it could just as easily be that they didn't realize the need for that tech in the beginning.
I don't know if the same holds true for their fiber but I'm sure interleave is common among DSL providers. Cable also suffers from neighborhood overselling where in peak hours people get ping times in like 200-600 ms when they are likely to play.
I don't know if this problem will be fixed soon but I think prediction is still necessary (or more so required) for a large population.
This may just be limited to American broadband services though, and I'm sure larger cities may have less of a problem.
However, I don't see how a light-cycles game could use any kind of prediction or lag comp. Since players can change direction instantaneously and at arbitrary times, there is nothing that can be predicted. And any kind of lag comp would appear as obvious breaches of the game rules.
There is a lag to tell the server when you want to move and a lag when the server tells the other player where you moved, so the lag compensation is for the server to guess where you thought the other player was when you made your move. This is used extensively in Counter-Strike, and I think it has its uses here.
http://www.virginmedia.com/images/tron2-431x300.jpg
Which appears to be kind of like snakes/nibbles then I could see you requiring some of the techniques the article describes. Since players are mostly moving in a single direction for a period of time you could extrapolate their movements by continuing their motion in that single direction until the server is made otherwise aware of where the player decided to move. Then you can reset the player back to the position they were at when they changed direction and then continue them along that path.
However, for when the action gets close-up and quick, where perhaps the two players are twitching back and forth trying to avoid or ensnare each other then yes I can see how lag compensation will be necessary so that the server can accurately figure out where each player thought the other player was when they made their move.
Here are two articles that I think will help you, and they helped me when I was working at this problem:
http://www.gamasutra.com/view/feature/3230/dead_reckoning_la...
EDIT:
the game's not particularly exciting but i'd imagine that being on the same canvas avoiding the trail of potentially thousands of players (plus your own) could be cool
EDIT2:
also if it was possible to add 3D to it (the ability to turn in the Z axis) could be pretty awesome
EDIT: Wait a moment, it wasn't GLTron, it was Armegatron
EDIT 2: See http://wiki.armagetronad.net/index.php?title=Lag
Even a lagging validation could be done. Yeah, your cheat comes off, but you're kicked out of the game and your team gets penalized.
The server can invalidate that result if it disagrees. This is why very occasionally, in high-lag situations, you might shoot a layer, see blood, but the player takes no damage.
In this case the validation is being done in real-time, and the prediction is only ever performed for feedback-critical actions (shooting, movement, reloading, etc).
This doesn't work in all instances - most games using this mechanism are fairly small in terms of player count, since the server is not of a guaranteed performance level, the connection its on is probably a home-based broadband connection at best, and it has to invest a lot of cycles into rendering the game. For larger games (say, the Battlefield series) the hardware required makes it such that the system is infeasible. Instead you have extremely beefy hardware running dedicated servers - headless, non-rendering servers that can throw every cycle it has into serving the game.
The features you build and test on your local machine or private cloud instance certainly behave differently when you have a bunch of people, with totally different internet connection speeds, and game-play behaviors, all using your app at once.
Ahh, the race conditions you never knew you had :-)
Good times.