They don’t.
In a bit of a simple term you have this architecture:
A game client connects to a server, server keeps current state of the game in own memory, and sometimes write stuff to the database (e.g. writes your position every 10-20 seconds or on your logout, but immediately writes your money or inventory into db).
The database keeps track only of stuff that is important not to lose, so a lot of dynamic stuff like mob health or cooldowns are not written to it.
So then what you can do is split players into different servers, or _shards_. The exact flow is dependent on the game. For EVE Online, each star system is independent, and can be hosted on separate server, and the load balancer will move star systems between physical servers to optimize costs. But because players don’t shoot at each other across star systems – there is no need to share realtime data or state between them.
For Star Wars The old republic – each planet is own shard. One planet might even have multiple shards, and you are assigned to the one with lowest players when you fly to the planet.
So TLDR:
– split the persistent data and data that you can lose easily. Write to DB only important stuff
– split world into independent chunks that don’t interact with each other, host those chunks on different servers
Latest Answers