How do online video games work?

61 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

Start with a server/host and clients/players in mind.

Run everything that matters on the server in slow ticks. Run everything that doesn’t matter on the client, like particles.

The player, even in single player, sends it’s inputs to the server, the server does stuff, and sends back the result. The client interpolates between states for what it displays. Stuff that doesn’t matter, like walking forward, can be pre shown on the client, but if anything changed on the server you will rubber band back.

The client can run the same code as server for collision checks and stuff for movement, instead of purely waiting for the server to send back confirmation that you could walk forward. But the server state always overrides.

All that’s sent from client is what they are trying to do. Server sends back the effects, and other changes, like other player positions, bullet positions, placed blocks, etc. Generally you limit this to absolutely necessary information, like just enough to reconstruct on the client. 

Maybe player pos, orientation, a list of actions

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