Sunday, December 11, 2011

Node.js for gaming

So I'm taking a class now that is focused on open source social/ casual games. We're focusing on creating games with javascript and html5. Because of this I've decided to use Node.js to help write my game.

Node.js is a server architecture written in Javascript that allows for very easy, fast web applications. One of the huge benefits of Node.js is it's callback structure. It wraps a lot of costly, slow operations such as file system calls and database queries in a callback that does not block. Also, everything is run on a single process so, unlike other server architectures, it's very easy to see what users are online and pass information between them or two certain groups. Both of these features make it very easy to create multiplayer games.

I recently found an awesome blog post by Daniel Baulig showing how to link a Node.js server to a libary called Socket.io. Linking the two libraries to the same session ID allows you to now send dynamic messages to the client using a socket FROM your server. Normally with no configuration these two libraries run independently and cannot be called from within one another.

I'm still not sure what I want to do for my game but I'm leaning towards some sort of MMO turned based strategy game. Maybe one where it queries popular open source websites for your user name and gives your character bonuses based on your open source contributions.

Here's some other good Node.js references:
Express.js
Socket.io
nodetuts.com

1 comment:

  1. Here is an online multiplayer boardgame using Node.js, socket.io and asp.net.

    http://kineticglobe.com/page/thegenerals/

    ReplyDelete