How do online video games work?

51 viewsOtherTechnology

I know how building a solo game works, with models and interactions coded, but how are games made so that those interactions happen on many players screens with just tens of milliseconds of difference. Is it code or is it putting your game files (models + code + whatever else I am missing) on a server that can be accesed by peoples devices?

In: Technology

7 Answers

Anonymous 0 Comments

Essentially it’s like when you’re loading a movie on a streaming service: it buffers between you and the server. The servers are located depending on where the gaming company hosts them (typically several servers around the country), and you connect to the server that is closest to you geographically. When you’re in one area of the game, it loads the code/models for that area of the game in packages, which are temporarily downloaded to your PC/console. When you move to another area of the game, it downloads the packages again for that area and either deletes the previous area’s packages or keeps them on to reduce buffering/redownloading if you go back to that area (depending on how the game is coded).

It’s a constant connection between you and the server, that’s why when a lot of people are online and playing/connected to any one server, it may exceed the server bandwidth and cause lag in the game. You’ll be disconnected if the server is overloaded, and when you reconnect, the game may choose a different server location depending on the ping (server response time between you and it, with lower millisecond ping being favorable for a faster response) to reduce lag.

You are viewing 1 out of 7 answers, click here to view all answers.