Game server software – An overview of node.js

I’ve been doing some research into the type of solution used for server-side software – code that runs on a server, responding to multiple users requesting services/information/data from it at various times. In a game development scenario, this would be to respond with world information, game play logic changes, and downstream assets and resources as needed by the client software. This kind of software needs to be highly scalable, as well as designed to prevent lag and slow response.

One solution is the node.js language/framework. Based on Google’s V8 JavaScript engine, the architecture is designed around an event loop that triggers code to an event. Rather than the traditional programming model of waiting for a response from a slow service (disk I/O, database, network connection, etc.), node.js instead encourages non-blocking behaviour by requiring you to specify functions that will be triggered when the event is ready/finished.

By avoiding using threading systems in other concurrent programming models, the problems of mutex’s, blocking, race conditions and others are avoided. Interestingly, the node.js itself only utilizes one thread – internally it is highly concurrent, but at the OS level it is simply one thread doing a job. Multiple node.js threads can be used behind a load balancer to make the most of a modern multi-core machine, however.

I’ve been tweaking about with node.js, mostly reading up on the programming paradigm required to make the most of it – it’s an interesting server solution, and one that I think I will continue to experiment with. My intention is to use it to start experimenting with a generic game logic application layer, and use this to build a MMO-style game server.

Leave a Reply