Problems "power turn off" - is there any?

Started by
11 comments, last by Antheus 16 years, 1 month ago
I'm interested if there is any solution in modern network games (mainly MMO) to prevent losing data? Or games like WoW, LineAge are required to run with UPS-like devices, arent't they? I ask because I write an MMO and saving all the operations to the disk will slow down all the action...
VATCHENKO.COM
Advertisement
Rather than having your server serialise data directly to disk, your server typically operates on a database (which is usually on its own, separate server), which takes care of the messy details of serialising to disk. The database is of course backed up on a regular basis, and may be distributed across several machines...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Database is a place where final data stored. If I change my position I don't need to save it to the database - in MMO it would be about 300 queries per second in this case. So I write everything when the player quits the game... While he's in game - his data is in RAM in game form (C++ structures, data types, not in database form).

And as I know every game has one login server and several game servers. That means that DB is only on login server... Game server is a C++ program... I'm right, am I?
VATCHENKO.COM
Usually it works like this:

1) update everything in memory
2) every X minutes (usually 10-15) dump the updates to the database
3) inventory always goes directly into the database (otherwise you have duping problems)

If you wait till the player quits and you lose power, then the player loses their entire play session. In the above scenario, the most you lose is ~15min. WoW clearly uses something similar because their servers used to crashed frequently and you'd only lose, at most, 10-15mins of game updates; but your inventory/gold would remain intact. This is also why you get loot lag, but not gameplay lag (loot hits the DB, combat does not)

-me
Quote:Original post by Anton Vatchenko
Database is a place where final data stored. If I change my position I don't need to save it to the database - in MMO it would be about 300 queries per second in this case. So I write everything when the player quits the game... While he's in game - his data is in RAM in game form (C++ structures, data types, not in database form).

You commit all important events to the database immediately (purchase/sale/use of items, death, etc.), to prevent duplication hacks if the server crashes. Rapidly changing attributes (such as position) will be committed at regular intervals (perhaps every minute, or when crossing into a new room, etc.), to prevent substantial loss of data.

Quote:And as I know every game has one login server and several game servers. That means that DB is only on login server... Game server is a C++ program... I'm right, am I?

there may be multiple login servers, and there may be multiple game servers. There will typically be one database (could be distributed across several machines, or could be on a single, separate machine), which all of the login and game servers will communicate with.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Quote:Original post by Anton Vatchenko
Game server is a C++ program...


Game server can be written in any language: and even a language completely different than the client. The server just parses packets and updates the world state. Typically it's easier if you share code (i.e. same language as client), but there is absolutely nothing that restricts either to C++. That is the common choice, but there's no reason for that other than that it's the current most common game dev language.

-me
I know that the server can be written in any language, but others are slower...

The last question... Is there some game database separated from login database (and if yes - is it stored on the same game server)? For example how is it in WoW? Because we have 2 million users. 1.8 million is offline. Yes, we must find every user in this 2M database, but if we need to store all inventory actions then every save will be too long.
VATCHENKO.COM
Writing a row or two in a database with 2 million rows isn't actually all that big a deal, providing you don't have massive indexes to maintain. Besides, MMO databases aren't one row per user - they typically have many different tables for different purposes.
I second the point about using any language to write the game server. And I poke my tongue out at the generalisation of them being too slow. I'm willing to bet that most server-class hardware computes simple stuff much faster than network communication happens ;)

Meanwhile; do not expect decent answers to questions like 'how does WoW do X' -- because the folks at Blizzard did not just think up the answer in a jiffy...would have been carefully considered and plotted over. You've got some suggestions -- time to start using your head -- because if you -are- making an MMO, you're going to have solve a -lot- of problems that have solutions that are dependent on how you've designed things or planned for stuff to work.

Anyway, that's my two cents, good luck ;)

~Shiny
------------'C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg.' -Bjarne Stroustrup
Quote:Original post by Shiny
I second the point about using any language to write the game server. And I poke my tongue out at the generalisation of them being too slow. I'm willing to bet that most server-class hardware computes simple stuff much faster than network communication happens ;)

Added to that the fact that C++ is not ideally suited to a parallelised event-driven programming model (which is essential to fast server code), something like Twisted on Stackless-Python may actually end up faster.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement