Sunday, December 11, 2011

My first bug fix!

So I just pushed a bug fix to the Tweepy library. I found a bug here: https://github.com/tweepy/tweepy/issues/41 that seemed like low hanging fruit. The loop that was reading information from the server response was very naive and basically assumed there would be no problems. I changed it to check the server status before each loop. This should solve the problem.

Pull Request: https://github.com/tweepy/tweepy/pull/139

Diff: https://github.com/tjr1351/tweepy/commit/d459ab929b18409534f15920e32ff35d0adc36f7

Although the change itself is not huge, I had to do a bit of research to figure out how to get the server status and then what status numbers to look for.

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