Blog ♥ Fun and games with node.js

I'm giving a talk today at Nodevember, a Javascript and node conference taking place in Nashville. My talk, titled "Fun and games with Node.js," makes two key points:

  1. If you want to learn or refresh your skills in Javascript, you should make a game using Node.js.
  2. If you're already a Javascript developer, you should teach others how to make a game in Node.js.

One of the difficulties with learning Node.js is that there’s a lot of assumed prerequisite knowledge. Most Node.js tutorials and books you’ll find expect not only a familiarity with Javascript but a robust understanding of best practices for writing and organizing code, how servers and HTTP traffic works, and the latest Javascript features. They toss around jargon like "asynchronous" and "client-side," words whose meanings are not self-evident. Overly-ornate verbs lead to confusion and intimidation. "Invoke," "execute," "hoist," and "instantiate" are just a few twenty-dollar words, to poorly paraphrase E. B. White, that obscure simple verbs like "make" and "do."

If you’re a Node.js developer, you might be thinking, "Well... of course you have to know basic Javascript before you can jump in to Node.js! That’s not an unreasonable request, is it?" Yet the new possibilities that Node.js has opened up have made Javascript all the more interesting to beginners, and those beginners may arrive to the scene and find little scaffolded learning. There are also many Javascript developers who, like myself, have real-world Javascript experience yet don’t come from a traditional computer science background. The terminology and analogies to other languages found in Node.js learning materials (...just like you’d do it in a traditional .NET backend!") can still provide barriers.

So how can beginners and the scrappy self-taught among us overcome the challenge of learning new vocabularies and concepts in Node.js? Perhaps by making a game. Games are familiar, fun, and engaging. They get your creativity and problem-solving skills going, and they are a great opportunity to create and learn on your own in your free time. If you make a game and it sucks, congratulations: you have completed the most important rite of passage, and you are now officially a game developer.

I encourage more seasoned Node.js developers to make a game and share the code with others who are just starting out. Your fun project might be just the push someone needs to advance through the self-paced learning process.

Here are links to two fun Node.js projects I built this year. The source code is available for these projects as well.

  • ConnectedNES: a WiFi modem peripheral and twitter stream for the original NES game console.
  • the dealwithit bot: A web app that uses computer vision to drop pixelated shades on everyone in a photo.

Deal with it

If you're interested in trying your hand at making a Node.js game, here are a few other open-source games and amusements to get you started. Most of these are accompanied by step-by-step tutorials.

Real-time chess by David Washington

Many of these examples also involve socket.io, an easy-to-use Javascript framework for sending data between a Node.js server and clients in real time. The socket.io website has a tutorial that walks through building a browser-based, real-time chat client that can be helpful to go through if you're just getting started with websockets and real-time communication.

And last but not least, here are a few of my favorite developer resources for getting started with Javascript and Node.js.

I also keep a running list of coding bookmarks—all languages, all skill levels—in the Resources section of No Bad Memories. Do check it out!

Working on a game with Node.js? Reach out on twitter if you do that sort of thing. I'd love to see what you're working on!

Posted November 20 at 8:48 AM while hanging out in Nashville.