Multiplayer Monopoly(tm)

So it transpires that my friends are of the ultra-competitive sort (who knew?), and thus was borne a fanatical addiction to the board game Monopoly. Unfortunately, as anyone who has ever played Monopoly knows, it is characterised by two widely acknowledged truths:

  1. It destroys relationships
  2. It takes approximately 322 times too long than it should to play

Fortunately, online multiplayer Monopoly was invented, thus resolving #2. Well, kinda. Online variants (the best being Pogo.com) do play a lot quicker — but then you lose some of that time again sitting through adverts. And if you don’t play, you don’t get to customise basically anything, meaning you’re stuck with their own house rules. Hence was born the idea for us (me and Austin Wellbelove) to “roll our own”. Before any lawyers pick up the phone, this was strictly an academic exercise and I doubt we’ll ever actually finish it. But it was fun trying. Here’s our stack:

  • A Node.js installation (I’m approximately 5 years too late to that party, but better late than never)
  • Concurrently running a cutting-edge websockets server (using socket.io) and a basic HTTP server
  • JavaScript in the client (again using socket.io, but also plenty of jQuery)

The basic design principle is low-latency, so we have all the clients storing their own state information. Websockets are then used to ping incremental moves around (client to server, server rebroadcasts), keeping the whole game moving really fast. And I have to say, it works. One regret is that we didn’t try to incorporate <canvas>, instead going with a pure HTML+CSS3 design (though that was also fun in its own way).

I’ve blogged about PHPStorm before, and I have to say, I love it. Despite there being no PHP involved, I easily installed the NodeJS plugin, retained the ability to a public server if I wanted to, and use the fact that I already had Node.js running to use the (Google-developed) Closure Compiler to drastically compress the client-side JavaScript. Overall, it was a fun way to get a sense of the power of NodeJS and develop a love of Websockets that I’m sure I’ll retain for some time.

2 thoughts on “Multiplayer Monopoly(tm)”

Leave a Reply

Your email address will not be published. Required fields are marked *