3
\$\begingroup\$

I keep reading on here that I shouldn't use MySQL for game development/play on the Internet, a browser game. I understand MySQL wasn't made necessarily for that and for big relational needs. Ok. But what do I use then? I am on a shared hosting, Unix/Linux platform. What do I use to store my "stats" or other game necessities, level information, player information, etc.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Mysql can be appropriate for game data, even relatively small amounts of it, if that data is appropriate for a relational database. You should add more detail about your data, like what it is, what you intend to do it, and how frequently you record it. That will help get you better answers about what is the right choice. \$\endgroup\$ Commented Aug 8, 2013 at 0:31
  • \$\begingroup\$ @SethBattin What other options are there on a shared host? \$\endgroup\$
    – johnny
    Commented Aug 8, 2013 at 0:34
  • 4
    \$\begingroup\$ Who says it shouldn't be used? Should't you ask this to the person who said that? \$\endgroup\$ Commented Aug 8, 2013 at 3:13
  • 3
    \$\begingroup\$ I think this information is just plain wrong. There's no inherent reason why you can't use MySQL for web-based browser games. \$\endgroup\$
    – ashes999
    Commented Aug 8, 2013 at 3:39
  • 1
    \$\begingroup\$ @johnny, MongoDB, Cassandra, sqlite, memcache. These are all alternatives to using MySQL, which all are very different in the kinds of situations they can be used and the kinds of performance they provide. \$\endgroup\$
    – kurtzbot
    Commented Aug 8, 2013 at 21:47

3 Answers 3

12
\$\begingroup\$

Of Course You Can Use MySQL

Let's get this out of the way: lots of successful games and their related companies use MySQL. Riot Games (League of Legends) does, Big Fish Games has a small case-study done by Oracle about their use and optimization of MySQL, an Oracle Principle Infrastructure Architect has a slideshow of a talk they give on using MySQL for high popularity social games (one uses 1000+ dedicated servers), ad infinitum.

It's an industry standard, it's free, it's tremendously scalable, support is available all over the place...its a great system.

...But Use It Correctly

The best, bleeding-edgiest database system on earth won't save you from, say, deciding to store all the textures for a FPS game as a BLOB in the database and trying to load/unload them in real time across a server connection. You're gonna have a bad time.

RDBMS are for Storing information in an intelligent, structured way, where it is assumed that there will be Relationships between the various pools of data. There are Players, and they'll have Highscores, and they'll have Account Information, and there will be Logins, and (hopefully) Transactions and Purchases, and so forth, and that's exactly what things like MySQL was designed to handle.

The rest of the stuff really depends on the game. Graphics? It's usually just plain easier to use a regular file folder structure. Live updates of exact player xyz location as in an MMO? Probably not something to use the database for, but only if something better than using fopen is an option (which usually isn't available in shared hosting environments). But what 'zone' a player is in? Sure, why not!

The same rules apply to games as they do anywhere else - don't ask for more than you really need (avoid SELECT * without a conditional, unless that's what you really wanted), and expect to get cozy with query analyzers and profilers if things start getting sluggish.

Is MySQL the Only/Best Option

No, and of course not/maybe. It's a great system, it works. I dislike SQL, yet ORM tools make it invisible and I like some of them a lot. NoSQL solutions abound, and they have their unique strengths and weaknesses, too.

MySQL is like a chef's knife - it can get the job done. Sometimes you'd be better off with a paring knife or a cleaver, but lets face it - sometimes you just want to whack something with a reasonable-sized knife and get on with your day.

\$\endgroup\$
2
\$\begingroup\$

I personally find MySQL is ok to use for browser games but it depends on the type of game. I can't stress that enough!!!

For storing basic player information yes its perfectly fine.. just don't use mysql_* as it is no longer supported for the future.

Other things however:

For example, is your game turned based, think like civilization franchise, this using mySQL is easily doable and i see no downside if you plan your tables correctly. Same for any games that use timers rather than "real time" updates.

However im not so sure it's wise if you plan to use MYSQL to store a user's location which updates in real time for other users to see the person on a map. This needs to sync with other players constantly for every player in the given area.

Continuously updating user locations and selecting user's locations from the database like that would basically be like DDosing your server to the point it overloads and lags / crashes.

For live real time syncing between players you want to look into websockets. You don't want to store the user's exact positions but a "rough" position then let websockets fine tune in that area where the user is precisely.

Websockets is not hugely supported however, although the major players Firefox, Chrome and IE support them sufficiently.... the use of websockets can be looked into with node.js. Which is javascript but for server side.

Linking that with client side HTML5 canvas features would be the way to go.

See here for a working example and the code is freely available to look at BrowserQuest and its source code

TL;DR - it totally depends on what your game will be.....

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think you're mixing up data storage and transportation mechanisms. \$\endgroup\$ Commented Aug 8, 2013 at 13:42
  • \$\begingroup\$ I guess you're right but if your going to use live data your going to need to query the database alot... which should be taken into account surely? Anyway the info is probably going to help some people. ^_^ \$\endgroup\$
    – Dave
    Commented Aug 8, 2013 at 23:53
0
\$\begingroup\$

MYSQL is a very good tool to use due to is capability of handling lot of data storage, most especially when you're developing an internet base football manager game, it will be capable of holding your various team data.thus this will take allot of query coding......but you know the says, Persistence leads to achievement!.

\$\endgroup\$
1
  • \$\begingroup\$ I do not understand. \$\endgroup\$
    – johnny
    Commented Aug 12, 2017 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .