IMPORTANT: I’m moving this blog to buildfailure.co. This post is outdated, please visit http://www.buildfailure.co/running-browserquest-in-windows-7-x64/ :)
In this tutorial, I’ll walk you through the process of getting BrowserQuest and running it locally on your computer, with Windows 7 x64; which presents a few problems that you shouldn’t find if you do it on a Windows x86, much less a Linux machine. This tutorial should work for Windows 7 x86 too. I assume you know the basic server stuff, the theory is the same for Microsoft IIS, Apache, etc.
Note: for all big downloads, I suggest getting the offline installers with jDownloader instead of the web installers. This way you’ll make sure you don’t screw up if you lose internet connection while running a web installer, and won’t have to start downloads again if the installation fails.
If you haven’t already, download and install NodeJS. At the time of writting, the current public release is v0.8.14, but you’ll need v0.9.2 or newer for this to work on a Windows x64, so grab one of the releases in nodejs.org/dist/, such as v0.9.3.
BrowserQuest uses several third-party packages. One of them, websocket, requires you to install Python and MS VC++. If you don’t, you’ll get an error when installing the packages:
Native code compile failed.
Download and install Python 2.7.3, and add it to Windows Path (Start > Computer > Right Click > Properties > Advanced System Settings > Environment Variables… > System Variables > PATH > Edit).
The Fun Part
Update/Notice: you may not need to follow the steps in this section. All this is required to compile native extensions for the websocket package, but “this module DOES NOT REQUIRE the native components and will still work without them, though not quite as efficiently.”. Feel free to skip straight to downloading the source code (in the next section).
Yes, it’s sarcastic. This is going to be a pain in the neck, but we’ll get through it somehow. Download and install Microsoft Visual C++ 2010 Express, and after it’s done, follow with the SP1 (alt. iso, much heavier but more reliable). This one will take a while, so go make yourself some coffee while you wait. You may also need the Windows SDK for Windows 7 and .Net 4 (alt. web install). If downloading the ISO, make sure you get the GRMSDKX_EN_DVD.iso one. The others are for Windows x86 and Itanium. If the SDK installation fails (with a completely cryptic and useless error message), there’s a few things to try. Make sure you uncheck the C++ Redistributables and the Compilers from the SDK installation, we will install those separatedly. Finally, you will probably need to install the Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1.
Time to get the code!
Download the BrowserQuest source code from github, and extract it locally wherever you wish on your machine.
Now you’ll need to install several packages required by BQ. Node Package Manager will make this task really easy if you followed the previous steps. Open the windows console, change dir to where you have the BQ source, and enter the following command:
> npm install underscore log bison websocket websocket-server sanitizer memcacheHit enter and wait. NPM will start downloading, installing and configuring each of these packages automagically.
Starting the Game
In windows console, start the game server with the following command:
...\BrowserQuest > node server/js/main.js
Now go to the client directory, and install the http-server module which will serve the client files, same as any usual web server:
...\BrowserQuest\client > npm install -g http-server
Now navigate to
...\BrowserQuest\client\config and look for a
config_local.json-dist file. Rename it to
config_local.json (we just removed the -dist), and open it in your favourite text editor. You should see something like
"host": "Set local dev websocket host here",
We’ll change the host to “127.0.0.1”. Save and close. Same goes for
config_build.json-dist, rename and edit.
Now copy the
shared folder to the client, you should get a directory structure such as
Lastly, we need to start the http server we installed previously:
...\BrowserQuest\client > http-server
That’s it! Your server and client should be running now. Open 127.0.0.1:8080 to see if the page is properly served, you should see the same you see when you load the game from the official BQ page. To check if the game server is running correctly, you can load 127.0.0.1:8000/status in the browser, it will return a JSON array containing the number of players in all instanced worlds on this game server.
And now, I think you well deserve some time to play the game! See how far you can get, I managed to obtain a Magic Sword!
I hope this tutorial helped you. If you still get errors or can’t understand part of the tutorial, don’t hesitate to ask here!