0
\$\begingroup\$

Im going to write an MMO server for a game, however in my last attempt to do this I used mysql with xampp-server and the game-server was getting the data offline tru mysql(xampp server was offline).

I was wondering if this will be fast enough when hundreds of players are constantly sending request to the game-server and the game-server to mysql(offline) for pulling or saving data(ex. constantly saving position for each player etc etc)

If not what would be an appropriate way to archive this? Thanks

\$\endgroup\$
  • 1
    \$\begingroup\$ My guess is the positions of players are stored in memory. They are only stored in a DB when logging out. This is what also causes small rollbacks if the server crashed. I remember Horde players respawning at The Crossroads in The Barrens when a WoW worldserver crashed. \$\endgroup\$ – Felsir Nov 19 '16 at 18:16
  • 1
    \$\begingroup\$ You want your objects to live in memory and only read/write to db when really needed \$\endgroup\$ – Valerio Santinelli Nov 19 '16 at 18:22
  • \$\begingroup\$ I've worked on 20+ MMO servers (there isn't only one type of server on an MMO network). MySQL is awful. We use a custom built data store, but if you can't go that far, then you'll want to be considering NoSQL instead. \$\endgroup\$ – Luke Briggs Nov 20 '16 at 5:10
  • \$\begingroup\$ @LukeBriggs Where do I get started with NoSQL? Do I have to download a server? If so can you point one that you recommend? I read a little bit in wikipedia and i'm intrigued \$\endgroup\$ – centenond Nov 20 '16 at 14:08
  • \$\begingroup\$ @centenond NoSQL is a very broad category with lots of different designs in there - The main thing is to choose one that best suits the data you're storing rather than forcing your data to fit in it. This will generally lead to using multiple databases (for example, highscore servers uses something entirely different to profile servers) - MySQL is in there too but it's the least used. As mentioned by Josh, you'll also want to avoid hitting all the databases by doing as much in memory as you can get away with. \$\endgroup\$ – Luke Briggs Nov 20 '16 at 18:32
3
\$\begingroup\$

You'll want to store most of this data in-memory and offline, in a database.

You will need an in-memory representation on the server(s) of the data while a player is actively logged in and manipulating characters. It's easier to work with and usually more efficient.

You will also want to periodically serialize this in-memory data into the persistent database for character data, in case the server crashes, et cetera.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.