GFS Future: HTML5, Node.js, MongoDB
James Simpson
 · 
September 21, 2011

It has almost been a month since my last post, and there is good reason for that. I've been learning. A lot. I began my learning a few months ago when I decided to use MongoDB as the primary database for Leet Media. My learning continued about a month ago with the first installment of Friday Freedays, where I made an HTML5 Snake Game in order to get a taste of the technologies surrounding HTML5. Since then, my focus has been on Node.js, which is essentially Javascript on the server-side.

Node.js and MongoDB have been a pretty drastic departure from my way of doing things since I was in middle school all those years ago (wow, now I feel old, it has already been 10 years). Since I built my first game, I've been programming with PHP and storing data with MySQL. I've gotten quite good at using those two technologies, but I've finally decided to move on. From this point forward, GoldFire Studios will be developing exclusively in Node.js and MongoDB (with more and more HTML5 mixed in as browsers catch up). This is a big change that can't be taken lightly, but it is something that I think will pay dividends down the road in the form of greatly enhanced user experiences and faster development cycles.

HTML5, Node.js, and MongoDB

Performance

I seem to have come down with the Google Syndrome over the last few years and have been steadily become more and more obsessed with speed. I've put a lot of effort into tuning the MySQL databases and PHP scripts on all the sites in the network, but it is never quite enough. One of the great things about Node.js and MongoDB is that they are both designed with performance as a top priority. Both are able to scale to massive proportions (great for online games) and they are able to do individual operations at an order of magnitude faster than MySQL and PHP (in general, there are obviously exceptions to every rule).

Modern

PHP and MySQL are getting up there in age as far as web technologies go. Now don't get me wrong, this can often be a good thing, since the technologies have been refined and perfected over the years. However, an unfortunate side-effect goes along with this that backs up the performance claim even more -- bloat. Node.js and MongoDB are only a few years old, so they are quite lightweight compared to PHP and MySQL. They have also been designed in a more modern era of web development, with the needs of more modern applications in mind. There are pros and cons to this (as with everything), but I'm convinced that in the context of online game development, the pros far outweigh the cons.

Unified Syntax

I've come to love Javascript over the years, which is one of the reasons why Node.js and MongoDB caught my eye in the first place. One of the problems with using PHP and MySQL is that they use different syntaxes from the front-end development of Javascript (the stuff you see). However, like I said earlier, Node.js uses Javascript on the server-side, and MongoDB's queries and data are all Javascript and JSON (well, technically BSON, but we won't get into that). This means that the data that is passed between the server-side, the client-side, and the database can stay in the same format. It also means that my brain doesn't have to work as hard to switch contexts when developing the front-end, back-end, and database. So, faster development time, more portable code, and probably more bug-free code.

The Community

I'm just going to be completely honest and say that I first got attracted to these new technologies because of the excitement surrounding them. I'm not the only one that thinks these technologies are cool and useful, and so vibrant communities have grown around them. It is fun to work with a technology that people are excited about and that lets you do new things in ways that you were unable to before. It also means that a lot of great modules are available to make development easier and more efficient.

After working with MongoDB for several months, I'm just as excited as on day one. I've been working with Node.js for about a month now and I get more excited each day. I even recoded the part of Project Agora that I had done in PHP over the past few days, and it was fun. To be honest, PHP has gotten somewhat boring over the past few years, it was just time for a change. Oh, and speaking of Project Agora, there will be more information on it very soon. I'll just tell you that it will change how you play games on the GoldFire Network forever (in a really awesome way, I hope!).

This post isn't trying to say that PHP and MySQL should stop being used or that they are bad technologies. They aren't, I've had great experiences with them over the years (although plenty of bad experiences as well). There is no language or technology suited to every use-case, and in this context (web-based games), Node.js and MongoDB are vastly more suited than PHP and MongoDB.

Update (12/09/2013): We have now been developing exclusively with this stack for over 2 years, and we couldn't be happier. All of the points I hit on above have been hugely successful for us, and a lot of the issues and concerns expressed have worked themselves out as a function of maturity through time. In fact, we are currently running an open beta test of CasinoRPG, which is a full hTML5 game built on Node.js and MongoDB.