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.
Answer
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.
No comments:
Post a Comment