Massive Fun: Building Scrabb.ly

Julie Choi (joolzvrn)

This is a guest post by Grant Goodale, one of the makers of Scrabb.ly, a massively multiplayer online crossword.

“One thing I know: I don’t want to write a chat app.” Four of us — @railsjedi, @aviel, @dacort and me — were sitting around the founders co-op offices, trying to decide on a project for Node Knockout, a 48-hour programming competition designed to showcase the features and inherent scalability of Node, a server-side Javascript application server based on Google’s V8 and designed from the ground up for speed and high concurrency. All four of us had day jobs working with Ruby on Rails, client-side Javascript and MongoDB in various fields. We all spent our days worrying about compatibility with older browsers, customer-centric feature roadmaps and business-oriented products – the bread and butter of startups and contractors alike. But this was our weekend, damnit. We wanted to build something fun.

In the end, despite our collective ignorance of game design we decided on a massively multiplayer crossword game similar to a very popular board game. Thanks to the magic of HTML5 WebSockets, everyone playing the game would be playing at once, on a single enormous board. Everyone would see everyone else’s tiles as they were played. Naturally it had to work in any modern HTML5-compliant browser, too – we’re picky that way. We spent an afternoon playtesting using a large collection of physical game boards cut to uniform size. (The looks one gets at a store when buying five copies of the board game are, I suppose, justifiable) A few tweaks to the playing board, some paper UI wireframes and we were ready for code.

Scrabbly is a Javascript rich client written in jQuery, communicating via a JSON-based API to a pure-Javascript back end running on Node. The game world is stored in MongoDB hosted at MongoHQ – Scrabbly makes heavy use of the geospatial indexing features MongoDB provides. In order to provide a real-time play experience, Scrabbly notifies game clients of tile and word plays via small JSON messages pushed via Pusher, a hosted websocket push service. The generous support of service providers meant we could focus on the app itself rather than installation and setup. Pusher integration was particularly easy – we went from nothing to fully implemented in approximately fifteen minutes.

One of the advantages of working with Node was the ability to use code in both the client and on the server. We implement most of our game rules in a module that’s also included in the Javascript we send to each client, which allows us to push some gameplay checks out to the client. We reduce the load on the server by rejecting plays that are known to be invalid before they’re sent. (We double check all plays on the server, so cheaters can’t modify the game code in the browser to allow invalid play.)

Scrabbly went on to win the Popularity prize in NodeKO, missing the top spot by only a fraction of a percent. We’re still actively developing the game; we’ve added a minimap to help players navigate the game world, complete with radar–like pings when players place a tile or word. I highly recommend programming competitions as a means of exploring what’s possible with new technologies. You might be surprised what you can build.

For a bit more information on Scrabbly, check out the talk I gave at Seattle’s Google Technology User Group last month (thanks to TechFlash for recording the video).