How can people interact with each other instantly in games?

128 views

Someone can be in New York and another person in Sydney or something like that and be interacting with each other instantly from across the world. How can we connect so fast and how does the connection know to keep that connection with just me and him and not get interrupted

In: 0

4 Answers

Anonymous 0 Comments

The thing is, it is not quite instant but it is fast enough to seem that way, because electricity travels fast enough to cover the distance in microseconds.

If you have 50ms ping, you have a delay of about 1/10th of a second due to the channel being both ways. So hardly perceivable in a moving environment.
Most connections are much faster than this so even less perceivable.

You say “Hi” or press a button.

1/20th of a second later, they see/hear your action and start to react to it.

1/20th of a second later, you see/hear their response to your action.

Back in the good ol days before broadband was a thing, audio delays could be roughly 1 second depending on how good your line was (attenuation). This was very noticeable when speaking to people at any moderate distance.

To answer the HOW IT KNOWS part…..

When you play a game together, you are both logging in to a server which sets up the connection to hold you/them in the loop.

Like when fortnite is loading and it says “Establishing Connection”.
It is doing just that, and the server then monitors all actions in real time between all parties.

Anonymous 0 Comments

These days, games connect to a server that acts as middle man for all people in the match. The server not only keeps track of who scores, when the game starts etc, but also relays messages between players.

If you type in chat within a game, that message goes to the server into a message “pool” that is continuously checked by all the other players. Did a new message enter the pool? Then all other (or the addressed) players running game will grab that piece of text and display within their running game.

With audio it’s different. The sound is often peer-to-peer; meaning it does not go to a central pool but it will be sent to one or more people directly just like a telephone line. It does so by your (and their) IP address; a unique number ID of your system on the internet. Kinda like a phone number.

There is a small delay between sending and receiving, and it’s called latency. This is usually between 0.1 sec ~ 1sec and has to do with the data traveling through the internet at lightning speeds.

Anonymous 0 Comments

Electricity travels at a significant fraction of the speed of light – scientists think now that it is less than previously thought, but still somewhere in the range of 60-80% of the speed of light. To keep things easy, we can go with 50% of the speed of light because dividing by 2 is easy.

The speed of light is 299,792.458 kilometers per second. If we want the math to be easy we can round that up to 300,000 km/s and then halve it to 150,000 km/s.

The earth’s equator is about 40,000 km in circumference.

To go around the earth will take an electrical signal somewhere close to 4/15 of a second, which is somewhere between 1/3 and 1/4 of 1 second.

There are other factors that can slow down that speed, but we’re still dealing in really fast speeds over comparatively short distances, which leaves the delay shorter than is really noticeable to most people.

As for how the connection knows to stay between you and him: in the old days, that would be the job of switchboard operators – they would literally plug the end that connected to your line directly to theirs, or in the case of long distance calling assign one of the lines that goes between areas for however many hops you needed to go (and back then the equipment was worse and there was more interference so there was appreciable delay) – nowadays that is controlled by computer software and hardware specifically designed to handle that transfer of data. More than likely your data packets are being sent out with either a TCP/IP wrapper or a UDP wrapper, which contains the IP address information of the place you’re connecting to.

The specifics of TCP/IP and UDP are a bit beyond this ELI5 needs to be, but they are different protocols that will let computers talk over the internet, by telling the computers connected between them how to route that data based on what IP address it is going to and other rules that programmers built to handle all that routing information.

Anonymous 0 Comments

In addition to the data signals being quick as other people have said, games will “cheat” to reduce the amount of back and forth.

For example, in the case of you running, and your friend shooting at you, the game may only send the signal of you running sideways.

But, in terms of animation, it’s possible that your right leg is in front, but on your friends screen your left leg is in front due to unsynced animation.

Furthermore, hit confirmation is usually only handled on your friends computer. When firing the gun, the bullet collision and math is only your friends computer. You only get “I was hit” recieved on your end.

This is why sometimes you might think you’re hidden behind a corner, but got shot. On your computer you made it around the corner, but on your friend’s end, you had not yet made it.

This is also where rubberbanding and other weird net code artifacts come from.