Multiplayer tutorial 1: concepts

1

Index

Taggé

Statistiques

15,273 visites, 25,618 vues

Outils

Partager

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 11 Oct, 2015. Last updated 25 Feb, 2019

The chaos of the Internet

Suppose now that some peers have joined the same room, successfully connected to a host, and a multiplayer game has begun. We can now ignore the signalling server: it is no longer involved from this point.

As described earlier, the multiplayer game itself runs with the host acting as the server. Peers only send data to the host, whereas the host can send data to anyone. This means if two peers want to communicate, it must be relayed through the host.

Multiplayer games would be a lot simpler if all transmission over the Internet was near-instant. This is generally the case on local area networks (LAN), such as your home or office network. However the Internet is phenomenally complex. Between any two players on the Internet, there could be 10-20 network devices (such as routers). The devices along this route will be different for each pair of players. For every single message sent, each device along the route must receive an incoming packet of information, read and understand its destination, determine where to forward it on to, and then re-transmit it. On top of that if you connect to a player overseas, your data will most likely be travelling through undersea cables, which deal with extraordinary amounts of traffic over large distances.

Amazingly, each device on the route can often forward on an incoming packet within milliseconds. However with lots of devices along a route, this adds up. If any device along the way is experiencing high load, it could slow down resulting in longer transmission delays. These devices, like any computers, can also crash, run out of memory, shut down for maintenance, lose power, run in to bugs that affect service, and so on. Due to much impressive engineering, routers can often re-route data around devices that have gone offline, or even re-route data down faster alternative paths. All of this can add temporary or permanent changes to the time it takes a message to travel from A to B.

The laws of physics must also be taken in to account. If a player from London in the UK connects to Sydney in Australia, the data must travel approximately 17,000km. Travelling in a straight line at the speed of light, this would take around 57ms. It is physically impossible to get data there faster than that. Then the cables along the way probably aren't perfectly straight, and over such a long distance there are likely to be many more routing devices.

  • 0 Comments

Want to leave a comment? Login or Register an account!