on Mar 21, 2006
EDIT (9/28/2008): For some reason, the images that go with this article are gone. Gone from the server, gone from my local machine. I have no idea how that happened. It will make this kind of hard to follow. Sorry.
Someone in the comments of this post asked about ping time. I sort of took a halfhearted attempt at answering it, but I thought it might be useful if I could explain why latency is such a problem for online gaming. This explanation is going to be very simplified, but should give the non-action gamer an understanding of why people are always ranting and whining about ping times. Please don’t nitpick.
Let’s assume that you and I are playing some Quake-type game. We both have a ping of 1000, which means 1000 milliseconds, or simply one second. So, it takes a half-second for stuff to go from me to the server, and another half-second to come back. Let’s say I’m in the room (green) and you (red) come in, running right-to-left
To keep this simple, let’s assume I try to blast you with some instant-hit beam weapon so we don’t have to worry about projectile speed. I just need to aim directly at you, and I should hit:
EXCEPT… That isn’t where you are. I’m lagging by a half-second, so I’m really seeing where you were a half-second ago. Here is what “really” happened:
But it gets worse. When I hit the fire button, the message takes another half-second to get to the server and tell the server I fired. By that time you are yet another half-second along.
This is a nasty problem. And it gets worse: The message that I fired takes yet another half-second to reach you. By that time, you are another half-second away.
I saw: Direct hit.
You saw: I missed by a second and a half.
The server saw : I missed by 1 second.
The problem gets worse still if we are fighting with (say) rockets that travel at a visible speed, and you realize that from my standpoint the rockets themselves are lagging by a half-second. If I’m running down the hallway firing rockets, I don’t get the message that the rocket has been fired until a second after I pull the trigger. I know it might be hard to picture, but what I end up seeing is my own rockets passing through me after being launched from where I was a second go. Doors which are supposed to open when you get near don’t seem to open right away, and you see yourself slam face-first into a closed door. A half second later (when you get the message from the server) you appear on the other side of the door, which now appears open. It’s a mess. The world doesn’t work right if you try to interact with it like this.
What really matters is what the server sees. The server is in charge, and decides if you explode or not. So the person with the lower ping sees the world more as it “really” is, according to the server.
This isn’t as much of a problem today as it was back in 1996 or so when on-line deathmatch was just catching on. Connections are, on average, much more reliable and provide for lower ping times. In addition, most games have various tricks for making the world appear more normal even when coping with a certain degree of lag.
Shamus Young is an old-school OpenGL programmer, author, and composer. He runs this site and if anything is broken you should probably blame him.