Installing BrowserQuest on Amazon EC2

March 30, 2012

BrowserQuest, the OpenSource MMORPG that was realeased this week by the great Mozilla Foundation. They brought us not only the Firefox but also a variety of other great software  projects. This time they sponsored the french developers Franck and Guillaume Lecollinet from Little Workshop to create very cool multiuser game. Their work proves that they not only speak french and english but also JavaScript fluently, as the state on their website.

I am not sure if this game really passes as Web3D but it is 3D enough for me at least – and it’s fun to play. Also the design is wonderfully retro-ish – before you ask: the art wasn’t ripped elsewhere but created by themselves. Also, these guys managed to solve a few technical problems that I wasn’t sure that you could solve in a browser game.

The game is written in JavaScript on the client side (obviously) and the obvious choice for the server side was nodejs, and that was  only one of a few clever design decisions to get this thing done:

– their installement runs on 6 servers each handling 10 worlds with around 75 players; one can check the status of the instances via a status page.  So one server could host 750 players, all of them 4500. When I was on, the number was around 2000.
– the ‘save game’ is stored locally in the browser, so they dodged fancy identity management.
– there is no database – all is handled by nodejs.
– (I am sure I forgot many, meh)

So I wanted to roll my own MMORPG on EC2, yay!

One lonely Dirk and a NPC ...

(Caveat: they created the map with the tiled map editor plus a special converter which they didn’t release yet. So creating you own map is complicated to say the least at the moment but I hope someone comes up with a solution.)

It took me some time to find out how to install it (embarrassing, I know) so I thought I’d document this here. The one piece of information that I missed is that you basically start two servers – one as a static server that only serves all the media including html/js/css and the other one is the node server. The latter is located in the server directory while the former is in a folder called client. I was somehow expecting that the static files are also served by node (like in Express for example) but I was wrong.

So here’s the scoop – if you need more detail, please leave a note in the comments.

To roll my own MMORPG I chose a Ubuntu t1.micro instance (AMI ID ami-349b495d) which is the first one in the Quickstart menu of your Amazon AWS page. After it launches you want to add a rule to the security group opening port 80/TCP (or 8080/TCP) and attach an elastic IP.

Then you install nodejs and npm and git the code from github. Then follow the instructions here except that they forgot memcache, so read this. Then you start the node server. Now – important – start another server from the ‘client’ or ‘client-build’ directory, serving the static files. I used Marak Squiers http-server with port 80.

If everything worked, you point your browser to the elastic IP DNS name and you see your own RPG!
(if not, either you or me did something wrong :-) )

So here is my daughter and a friend of hers saying ‘cheese’ on EC2!Yay! with friends!

Again – if you need more info, drop a line in the comments.

EDIT: here’s how to install in a Gist.
EDIT2: here’s an updated script.


More WebGL

March 27, 2012

(note: most of the links in this entry need a webgl enabled browser and somewhat decent hardware.)

Some time ago I posted this entry, stating that the combination of Node.Js and especially WebGL would be a possible Web3D solution of the future. Indeed 2011 brought us many exciting developments and especially ‘The Wilderness Downtown‘ and then ‘3 Dreams of Black‘ from Ricardo Cabello (aka Mr.doob) with a little help from Google.

But it didn’t stop there. CubicVR.js even sports physics now and comes along nicely. The ‘competitors’ – if I may say so – are not lazy either.

Scene.js calls itself a ‘3D Scene Graph Engine for WebGL’ and appears to be under heavy development.

On htmlgamedevs.com I found this entry that leads to a great blog called cyborgdino.com; they create a tutorial for those who want to get their hands dirty on a game engine with webgl.
There are two tutorial steps online already:
step #0
step #1

There are several other developers out there with outstanding demos. Besides the notoriously outstanding mrdoob one has to mention AlteredQualia and I also like the demos from Einar Otto Stangvik a lot.

It’s also a good sign that there are a couple of new blogs out there that deal with webgl and spread the news.

New entries on my watchlist is the beforementioned http://www.html5gamedevs.com/ and http://www.webgl.com/.

Also check out this beautiful demo for the js1K competition!