20
\$\begingroup\$

I'm not sure if I'm in the right place or not, but I figured someone here could maybe provide a good answer. I want to know how electricity is able to flow so fast. For example videos games nowadays, you can shoot someone across the world and they die almost instantly. How is electricity able to do this? I was trying to google this question but found poor results, that's why I am here.

\$\endgroup\$
7
  • 9
    \$\begingroup\$ The circumference of the earth is about 40,000 km. Electromagnetic waves travel at the speed of light, which is \$3\cdot 10^9\$ m/s. That means it takes an electronic signal about 13 ms to circle the earth. You can add a factor of 1.5 or so because signals in optical fiber travel slower than signals in air, and another increase because signals aren't routed in straight lines. But in the end you can see the main limitation isn't how fast signals travel but how much processing has to be done to put those signals onto the wires and get them off again. \$\endgroup\$
    – The Photon
    Jul 18, 2014 at 0:00
  • 12
    \$\begingroup\$ Your calculation is off by a factor of ten, it is ~130 ms for a full circle. \$\endgroup\$
    – Turbo J
    Jul 18, 2014 at 1:01
  • 6
    \$\begingroup\$ This is not a direct answer to your question as it's more about monitors but it is John Carmack dropping knowledge on why a transatlantic ping is faster than sending a pixel to the screen. superuser.com/q/419070/2940 \$\endgroup\$
    – Dhaust
    Jul 18, 2014 at 4:12
  • 1
    \$\begingroup\$ Also, do note that network-heavy programs (especially video games) implement features that reduce the perception of latency. A trivial game example is extrapolating the position of an entity based on where it's moving. \$\endgroup\$
    – mikołak
    Jul 18, 2014 at 20:30
  • 1
    \$\begingroup\$ @Bart, you're right, I must have been commenting before coffee that day. But Turbo J already pointed it out 3 years ago. \$\endgroup\$
    – The Photon
    Aug 23, 2017 at 16:04

9 Answers 9

23
\$\begingroup\$

This isn't something that can be answered in a single post, by a single person. However, I hope this answer provides enough information and links to be helpful.

It is important to understand how signals are transmitted over the Internet. Note however that due to noise and the immense number of users, the same signal needs to be encoded, decoded, retransmitted, etc so the time needed for processing is many orders of magnitude more that the actual electrical signal needs to travel. Also have in mind at a millisecond is an very large amount of time for a computer; a GeForce Quadro K6000 graphics card can perform 5.000.000.000+ floating point operations in that much time (5196 GFlops times 1ms).

Conductive cables:

The electrons themselves don't move that fast because they bounce around inside of the conducting cables. However electricity doesn't travel based on electrons bouncing one onto the other, rather one repelling the other through electromagnetic interaction:

Say you have 3 electrons in line (assume one dimensional space). Move the first a little bit. The distance of the first to the second gets a little smaller. The electrostatic force on them gets a little larger. According to Coulomb's Law it is: $$\|F\|=k_e\frac{q_1 q_2}{r^2}$$ where: \$\|F\|\$ is the magnitude of the force, \$k_e\$ is Coulomb's constant, \$q_1\$ and \$q_2\$ is the charge of each of the two particles and finally \$r^2\$ is the distance between them.

As the first particle moves towards the second, the electrostatic force increases almost instantly. This causes the second particle to move a little bit towards the third etc.

"Almost instantly" actually means "at the speed of light" (\$c=299,792,458m/s\$).

There is an extreme number of electrons inside a conducting wire and the physics are a bit more complicated but the gist of it is a signal gets across a conductor "almost instantly" but slower than \$c\$.

Optical Fibre:

Optical fibre cables transmit signals by photons instead of electrons. Even in this case however, the photons don't travel in a straight line. However, the time needed for the photon to travel across the line is still very small compared to the processing time to encode and decode the signals, as well as packet retransmissions.

Wireless:

Finally, communication satellites as well as numerous types of wireless links are used to transmit signals, well, wireless using a great number of transmission protocols, modulations and frequencies. In this case, signals are transmitted using electromagnetic radiation. This a very complex subject and I can't possibly cover it all.

Smart ways to encode information into electrical signals:

It is not enough for a voltage pulse to reach the other end of a wire; that voltage is there to convey some information. The act of encoding information by modifying a carrier signal based on the information to be transmitted (carried, hence the name carrier), is called modulation.

Smart ways to share the same channels:

All these communication channels need to be connected and information needs to travel across this vast network in a reliable way. Initially, to have two nodes communicate with each other, they would reserve a number of cables forming a path from node A to node B. No other node would be able to use this same path. This is called circuit switching. The breakthrough that made such a vast network such as the internet possible was the ability for numerous nodes to share one particular communication channel. This sharing was enabled by packet switching. Instead of reserving a circuit just for two nodes, every node just checks if the bus is free, then transmits a packet containing data and destination info (and some other stuff) and then releases the channel. Packets need to find their destination and this is called packet routing, which is another huge subject. Routing and the need for modulation is the main reason a packet takes "so long" to reach it's destination compared to how fast electromagnetic waves travel. Routing is also necessary for all those users to coexist on the same network.

The Internet:

All these thing, along with numerous other technologies, are used together to form The Internet.

Lag Compensation:

In many applications, including competitive video games, a few milliseconds of delay would be unacceptable, especially when a server needs to register a "hit". That's where lag compensation comes into place. One of the methods used involves the server keeping a short history of each entity position and animation state. Then perform a number of tests and physics simulations to see if a "hit" would occur when a player "fires" their weapons, based on the lag, velocity, and animation state of each entity plus the world geometry.

\$\endgroup\$
10
  • 4
    \$\begingroup\$ So I guess electricity flowing through conductive cables could be compared to newton's cradle? Because the energy is transferred through all of the balls very fast to the other side. Oh and many thanks for the detailed clarification. \$\endgroup\$
    – Cam Jones
    Jul 18, 2014 at 1:33
  • 2
    \$\begingroup\$ @Skateguy, that's not a bad analogy in the sense that the electromagnetic energy propagates along the conductor much faster than the individual electrons do. \$\endgroup\$ Jul 18, 2014 at 1:42
  • 4
    \$\begingroup\$ The best analogy I've seen, if you live in a large city, is that electricity travel like gaps between cars in a traffic jam while electron travel like cars in a traffic jam. The next time you are stuck in a traffic jam note how the gap travels down the line in a ripple, in the opposite direction of car travel, much faster than your car moves. \$\endgroup\$
    – slebetman
    Jul 18, 2014 at 3:25
  • 2
    \$\begingroup\$ Nice analogy. One little thing though. c = 3e8m/s not c = 3e8km/s \$\endgroup\$
    – magu_
    Jul 18, 2014 at 8:14
  • 1
    \$\begingroup\$ I registered to thumbs up this answer. Great job, enjoyed reading it. \$\endgroup\$
    – Gintas_
    Jul 18, 2014 at 19:02
32
\$\begingroup\$

Perhaps this would be better as a comment, but it is too long. I wanted to address the fact that your statements indicate that you perceive the data to be transmitted almost instantaneously, but none of the observations you present actually prove that it is transmitted quickly at all.

You mention videogames. Game developers are WELL aware of the fact that there is significant latency between players, so they pull off several tricks. One of them is that they have the client guess about certain information that it hasn't yet received from the server/other players. For example, your client knows your opponent's position and velocity from, say, 50ms ago. So it extrapolates and says, "if his motion is like this, he's probably about here now", and you see this predicted position. Most of the time, it's pretty accurate (probably because of the effort programmers put into this), and it actually feels like there's no latency. Other times it's inaccurate, and to you, it appears that the player was shot, when really he was at a different position than what your console predicted.

On a related note, most displays run around 60Hz, and some do something called double-buffering. I won't go into the details here, but this introduces up to 33ms of latency between when the processor renders a frame and when it's actually displayed. Most people don't notice this, so I think it's reasonable to suggest that even if the network latency were equivalent to 33ms, you might perceive it to be instant, even without any programming tricks.

In summary, the internet is not necessarily "fast". But smart people do smart things to make it appear as if it's faster than it really is. If you want more information, you may consider asking the people on gamedev.stackexchange.com.

\$\endgroup\$
7
  • 2
    \$\begingroup\$ This definitely helps me think of it in a different way now thanks, I guess I was asking two questions in one. \$\endgroup\$
    – Cam Jones
    Jul 18, 2014 at 1:37
  • 1
    \$\begingroup\$ This is the real point. It's not that the information goes "instantly", it's just that as long as the scenario plays out consistently on all the connected computers, you will perceive them as instanteneous. A great example of this are RTS games - while user input simply cannot be faster than the latency of the connection (in fact, it's even slower than that), the players can't notice, because the inputs are applied at the same relative time for all of them. So if an input results in a death of a unit on my computer, it will also show the same way on my friend's computer. \$\endgroup\$
    – Luaan
    Jul 18, 2014 at 12:37
  • 1
    \$\begingroup\$ +1, as some who has worked on several multiplayer game development projects, dealing with latency issues (so that the connection to your opponents appears instantaneous) is probably at least 70% of the work in the connection code. Similar things occur in rhythm games to combat latency with your controller. In short: game developers cheat to give you a (usually) better experience. \$\endgroup\$
    – Brian S
    Jul 18, 2014 at 14:30
  • \$\begingroup\$ If I could choose 2 answers I would, but seeing as this answer doesn't mention the electrical part of it I must choose the other. \$\endgroup\$
    – Cam Jones
    Jul 19, 2014 at 0:40
  • 1
    \$\begingroup\$ Some games also deliberately show you other players' positions from ~200ms ago. Your client might know their position from only 50ms ago, but if there's an interruption of less than 150ms, then they will still appear to move smoothly. (Source Engine games do this, although I don't know the exact delay) \$\endgroup\$
    – user253751
    Jul 19, 2014 at 8:28
4
\$\begingroup\$

I'm surprised people only mention modulation (the process that modifies a higher energy "carrier" that can be radiated easily over long distances in function of the signal) as an additional factor rather than a key element in increasing the datarate of communications links. Remember those 54kbps modems at the beginning of internet? When the ADSL modems kicked in, there was an immediate twentyfold+ increase in datarate, mostly due to the modulation used: with QAM, the bitrate became higher than the symbol (clock) rate (by using various amplitudes and phases), like fitting more things in the same bucket travelling at the same speed, just by figuring out a cleverer way to arrange them. And we're not done yet, many others already exist or are being investigated...

enter image description here enter image description here

a) States map of QAM modulation, one of the RF modulations b) How symbol rate can be different from datarate, example with multilevel amplitude modulation (the ancestor of FM), one of the components of QAM (the other is the phase, very related with FM).

For your problem in particular, aside from trying to predict what the players are doing, games are typically rendered by your machine; only a small amount of vital information is transported such as coordinates, velocities etc. A single webpage probably has way more information than that, but the real problem is latency (especially for hardcore gamers), and it accumulates with the number of hubs your signals are coming through from propagation delays, among many other things (distance is also a problem as maximum reliable datarate drops with losses - which increase with distance).

\$\endgroup\$
2
  • \$\begingroup\$ To be honest I ignored it because my answer was only concerned with speed (as in latency), not bandwidth. I know that nowadays, the two are used interchangeability (speed and bandwidth that is), even though technically, they are two dimensions of data transmission. Because latency isn't really something you can do anything about as an end-user and only to a very limited extend as a service provider, it is generally ignored by all but online gamers who need 'real-time' feedback on their gameplay and financial institutions who need millisecond response times for derivatives trading. \$\endgroup\$
    – RJR
    Jul 19, 2014 at 4:44
  • \$\begingroup\$ Yes that's what my last paragraph is about, but the author of the question did ask first a general question before providing an example, let's not focus too much on the example. \$\endgroup\$ Jul 19, 2014 at 9:27
3
\$\begingroup\$

The internet is a network of interconnected routers which forward internet traffic (packets) between them using a routing protocol that, generally, tries to take the shortest/fastest route.
Most routers are nowadays connected via optical fiber - especially when the distance between the routers if more than a few 10's or meters or so, or when the speeds between the routers are high (1, 10 or even 40 Gb/s) - this nowadays includes almost every router that is part of the internet. The notable exception is probably your home router/modem etc.
Either way, the propagation speed of the signals through the fiber or electrical calbe is close to the speed of light. As such, in theory you can get a packet from Melbourne, Australia to Angra de Heroismo, Azores (these are almost antipodes) in about 70ms. Now lets have a look at a real-world example. There a utility call 'traceroute' that traced your packets from router to router and conveniently output the approximate delay between each 'hop'. (Note the time im ms is 'round-trip' - so one-way is half this in theory):

  7   127 ms   143 ms   139 ms  i-0-1-0-0.sydp01.bi.telstraglobal.net [202.84.220.218]
  8   111 ms   113 ms    64 ms  i-0-5-0-2.sydp-core02.bi.telstraglobal.net [202.84.220.217]
  9   167 ms   201 ms   210 ms  i-0-3-0-6.paix-core01.bx.telstraglobal.net [202.84.140.194]
 10   156 ms   158 ms   188 ms  i-0-0-0-5.paix02.bi.telstraglobal.net [202.84.251.18]
 11   204 ms   206 ms   175 ms  80.157.128.205
 12   537 ms   512 ms   593 ms  mad-sa3-i.MAD.ES.NET.DTAG.DE [217.5.95.173]
 13   554 ms   552 ms   579 ms  80.157.129.10
 14   544 ms   569 ms   545 ms  10.255.26.254
 15   568 ms   568 ms   538 ms  catvaweb.cabotva.net [81.20.240.40]

(I've left out the hops that go over my company's intranet).
You'll notice the delays are much longer than what you'd expect just from the 'speed of light'. This is the delay introduced by the routers forwarding your packets. Sometimes they're fast, sometimes they are slow, especially when they are under load.

As you can see, the majority of the delays are due to router forwarding, not propagation delays. If you play around a bit with the traceroute tool (there are numerous web based ones you can find online), you will find that the route isn't always the same and even where it is, the delays are all over the place.
Online gaming companies host their servers in places where they have a good connection to the internet and can have deals with service providers to give their packets priority over others. Also, some internet service providers might do the same and give priority to gamers (at a price!). This is possible because as you can see, the main delays are in the routers, not in the fiber. For streaming video's this doesn't matter, for games it is critical. As such, service providers can prioritize internet packets based on their content - give video more bandwidth but a but more delay, while gaming (which doesn't need much bandwidth) can be given priority in the router's queue for minimum delays.

\$\endgroup\$
2
  • \$\begingroup\$ Traceroute yields RTT (round-trip-time) which is approximately 2x the delay. \$\endgroup\$ Jul 20, 2014 at 8:59
  • \$\begingroup\$ @generalnetworkerror good point, I've added that to the answer. \$\endgroup\$
    – RJR
    Jul 20, 2014 at 10:09
2
\$\begingroup\$

and they die almost instantly

According to what? The fastest speed with which an influence can propagate is \$c \approx 186,000 \$ miles-per-second. Data packets travel slower than that across the fiber and there's delay inside routers, switches, etc.

For a data packet to propagate through the internet infrastructure to the other side of the Earth takes, probably, several 10s of milliseconds or so but, in fact, that's an 'eternity' compared to instantaneous.

For example, some of the particles created at the large hadron collider decay in roughly \$10^{-23}s\$.

In other words, it takes about 100,000,000,000,000,000,000 more time to 'kill' your 'enemy' across the world than it takes for some particles to decay at the LHC.

Almost instantly? Compared to the time scales of some fundamental particle interactions, it's much much longer than the calculated age of the cosmos compared to a year on Earth.

I thought you might want to ponder this sometime.

\$\endgroup\$
12
  • 1
    \$\begingroup\$ According to my eyes and according to the kill feed. and I never said instantly, I said almost instantly, So yes I was already somewhat aware of what you speak of. And isn't it kind of relative and dependent upon the subject at hand? I do much appreciate you answering though. Sorry I'm not more educated on the subject but would you mind explaining what the C and the funky equal sign stands for. I learned in school but have long forgotten I have no problem looking them up just figured it couldn't hurt to ask. \$\endgroup\$
    – Cam Jones
    Jul 18, 2014 at 0:48
  • 11
    \$\begingroup\$ I don't understand how this discussion on semantics is an answer to the question. You've just confirmed that, yes, packets traveling 'through the internet' only take mere 10's of ms. The OP asked how that is so. I think this merits a bit of explanation of how data packets are converted from electrical to optical and vice-versa, and how routers forward packets at high speeds. \$\endgroup\$
    – RJR
    Jul 18, 2014 at 1:09
  • 8
    \$\begingroup\$ You gave an answer with an undercurrent tone of elitism with regard to his definition of "almost instantly". The guy came here to ask a simple, clear, and honest question about electricity. There's no reason to belittle him for his perception that a few milliseconds can be described as "almost instantaneously". I'm always amazed at how I can dissect some trace on an oscilloscope and then realize that the interaction I was observing occurred in an imperceivably short period of time. I'm glad someone else can marvel at that too. \$\endgroup\$
    – kjgregory
    Jul 18, 2014 at 3:33
  • 2
    \$\begingroup\$ It's quite easy to interpret condescension here, actually -- whether it's there or not, intended or not. I had to squint just right in order not to see this post as useless nitpicking about the OP's choice of words. And even that took a couple of tries. \$\endgroup\$
    – cHao
    Jul 20, 2014 at 1:40
  • 2
    \$\begingroup\$ @Alfred: Mostly to let you know that the wording of your post makes it easy to misread your intentions. Do with that info what you will. But don't pretend to be amazed when people misunderstand. \$\endgroup\$
    – cHao
    Jul 20, 2014 at 5:56
1
\$\begingroup\$

Electricity basically travels at the speed of light. in the internet, the only things that are going to slow this down a little are the network hardware that routes internet traffic between your home and the home of your opponent across the world: this hardware includes things like routers, switches, and things that convert electricity into light (fiber) and back. These things are based on technology that is also very fast (transisters, silicon chips, and whatnot) and so the effects are minimal. So what you have is a slight delay in information that is translated at the speed of light. light from the sun takes 8 minutes to travel 93 million miles to reach earth, so when you put it in this perspective, it makes sense that the information from your gaming console "almost instantly" appears a few thousand miles away in the home of your opponent.

\$\endgroup\$
1
\$\begingroup\$

It's mostly relative to lightspeed.

Theoretical limit of Amsterdam New York = 40ms
Internet limit of Amsterdam New York = 82ms

Theoretical limit of Amsterdam Adelaide = 130ms
Internet limit of Amsterdam Adelaide = 320ms

From Paris to NYC as a bird flies, light takes about 20ms. so a perfect Ping time would be 40ms. In optical fibre glass, light is slower by 31 %. Furthermore, light in an optical fibre bounces like this \ / \ / \ / which makes the route longer. Add to that the routing equipment times. the fastest ping from Paris to new York is currently about 82ms.

Amsterdam to Adelaide is 320ms, in 100 years, perhaps it will be closed to the theoretical limit allowed by the laws of physics, i.e. 130ms, for 1550km, it's close to theoretical limit already.

Here is a list of internet speeds: https://wondernetwork.com/pings

Add to that, the notion of bandwidth.

The latency of equipment within your computer, screen, peripherals, sound, keyboard, is normally about 10ms. So the fastest response time for an event occuring on your PC, to your router is always less than 20ms by DirectX for any data transfer.

\$\endgroup\$
1
\$\begingroup\$

The ultimate reason why online video games have such fast response times is because everything is done on your computer. When you shoot someone, your computer decides you killed your opponent, and instantly displays you the corresponding picture. It also notifies your opponent's computer about this event, but you don't get to see that this happens with a delay. Typically, the calculations are also performed on a central server a second time, to prevent cheating. If the server decides you didn't in fact kill your opponent, you will see them come back to life after half a second or so.

Network delivery time can be as high as 300+ ms between remote locations, and fast-paced games would be unplayable if such delays were incurred on every player action.

\$\endgroup\$
0
\$\begingroup\$

As I read the statements, there are two (related) questions, with the same answer: 1) the internet is able to transmit data "fast" because it uses various forms of electromagnetic (EM) energy transmission, and EM propagates very fast (approximately 186,000 miles/s), 2) electricity is able to "flow fast," because it is electromagnetic energy, and EM propagates very fast.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.