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
A simple way to think of it is that the server is running the game too just like you’re running the game on your machine and other players are running the game on their own machines.
When you make your character jump on your machine, it sends data to the server to make your character on the server jump, and the server in turn sends data to the other players to make your character jump on their games.
Internet communication is very fast, even in the slowest conditions it will only take a few milliseconds to communicate between two computers at opposite ends of the world. And even when a fraction of a second is still too slow to make smooth gameplay, there are ways to hide the lag, such as predicting what happens before it actually happens on the server (for example, when you shoot a projectile it will look better if you shoot it immediately instead of telling the server to shoot and waiting for the server to tell your character to shoot. The trade-off is that your projectile might not follow the same flight trajectory as the actual projectile that was shot on the server, so it all depends whether you want more accurate results or smoother gameplay)
Latest Answers