How to setup a local QuakeJS server under Windows 10
TLDR: This How To will show you how to setup a local QuakeJS server, local Play page (for users to connect to the local server), and a local content server (to provide files to the clients) under Windows 10. It is based off of my original guide using Debian. If you'd like to setup your server under Linux then check out my guide on How to setup a local QuakeJS server under Debian 9 or Debian 10.
I found myself in a situation where I was going to be on a LAN without internet access for an extended period of time along with multiple people and multiple computers. I wanted a fun, fast paced, multiplayer game for us. The catch? I didn't want anyone to have to install anything since these computers didn't belong to us. That's a pretty tall order. What I found was QuakeJS. Quake 3 was open sourced at the beginning of 2012 and some awesome dudes based ioquake3 off of it. Another awesome dude created QuakeJS around 2013/2014. QuakeJS allows you to play Quake 3 entirely in a browser.
The source code has instructions for creating a dedicated server as well as building from source & generating assets for a content server (under Linux). Unfortunately the Emscripten tool used to build the project has changed the way it operates in since 2014 and the current version of the QuakeJS source doesn't build with modern versions of Emscripten. Luckily Inolen provided the precompile .js files for those of us just wanting to run a server. Between those .js files, the QuakeJS README, some helpful discussion on how to setup a local webpage to connect to the server (as well as providing the content necessary to play) and a bit of tinkering, I've been successful in creating a server environment that I'm happy with.
If you would prefer a video tutorial, Grabisoft created a video tutorial on YouTube. It also shows you how to add in your own custom content which my guide, below, doesn't cover.
NOTE: This guide assumes your local server's hostname is "quakejs"
NOTE: currently the content server address of content.quakejs.com is hard coded into some compiled code. I'm working on being able to recompile but in the meantime there is a "hack" to redirect content.quakejs.com to your localhost address. See the "Redirect content.quakejs.com" section
Contents
Setup the Environment
Install Node.js & NPM
- Visit https://nodejs.org and download the latest .msi installer for Node.js (v12.10.0 at the time of this writing)
- Run the .msi to install Node.js & NPM
- Click Next to start the install
- Click Accept & Next to accept the license
- Click Next to accept the default installation folder
- Click Next to accept the default options
- quakejs doesn't require any of the "extra tools" but you can install them if you want by checking the box on this screen. Click Next
- Accept the Windows pop-up and wait for the install to complete
- Click Finish
- You can test this installation by opening a Command Prompt and running
node -v
Install Git
- Visit https://git-scm.com/download/win to automatically start the download of the latest Windows version of the Git client (v2.23.0 at the time of this writing)
- Run the downloaded .exe file to launch the installer
- Click Yes to start install
- Click Next to accept the license agreement
- Click Next to accept the default install location
- Click Next to accept the default options
- Click Next to allow the installer to create Start Menu links
- Select your preferred text editor (I like Notepad++ on Windows)
- Click Next to accept the default PATH option
- Click Next to use OpenSSL
- Click Next to use the default line ending option
- Click Next to use MinTTY
- Click Next to accept the default extra options
- Click Next to skip the experimental features and wait for the install to complete
- Click Finish
- You can test this installation by opening a Command Prompt and running
git --version
Install Extra Git Bash Packages
- Visit https://stedolan.github.io/jq/download/ and download the latest jq executable for Windows (v1.6 at the time of this writing)
- Make sure you get the correct 32-bit or 64-bit version for your OS
- Rename the downloaded file (either jq-win64.exe or jq-win32.exe) to jq.exe
- Visit https://eternallybored.org/misc/wget/ and download the latest wget executable for Windows (v1.20.3 at the time of this writing)
- Make sure you get the correct 32-bit or 64-bit version for your OS
- copy jq.exe & wget.exe from your Downloads folder to C:\Program Files\Git\mingw64\bin\
Setup QuakeJS Server
- Hit Windows Key + R and type "cmd" to launch the Command Prompt.
- Navigate to the parent directory of where you would like to install quakejs
- Run the following command to clone my updated quakejs repo to your Home Directory
git clone --recurse-submodules https://github.com/begleysm/quakejs.git
- Run the following command to switch into the, newly created, quakejs directory
cd quakejs
- Run the following command to install the necessary Node.js modules
npm install
- To download BASE3Q files, run the server for the 1st time by executing the following command. Hold down enter to get through the EULA, agree to the EULA by hitting y and game files will be downloaded. Once all files have been downloaded (you'll see the line ignoring setsockopt command) quit the server by hitting Ctrl+C
node build/ioq3ded.js +set fs_game baseq3 +set dedicated 1
- Optionally run the following command to download additional CPMA files. Again hit Ctrl+C to quit the server once all files have been downloaded (you'll see the line ignoring setsockopt command)
node build/ioq3ded.js +set fs_game cpma +set dedicated 1
- Edit the baseq3 server config file (C:\INSTALL\PATH\quakejs\base\baseq3\server.cfg). Pay special attention to seta sv_hostname, seta g_motd, and especially seta rconpassword
- Optionally edit the cpma server config file (C:\INSTALL\PATH\quakejs\base\cpma\server.cfg). Pay special attention to seta sv_hostname, seta g_motd, and especially seta rconpassword
- You can test (or run) your server with the following command, but there isn't much point until we setup the Content Server and Play Page.
node build/ioq3ded.js +set fs_game baseq3 set dedicated 1 +exec server.cfg
Setup the UwAmp Web Server, Play Page, & Content Server
If you want to setup a permanent installation you will probably want to install UwAmp as a program on your machine. If you are planning on using it intermittently or just want to test it out, you may want to download the stand-alone ZIP version of UwAmp. Follow either #Permanent Install or #Standalone Install based on your preference.
Permanent Install
- Visit https://www.uwamp.com/en/?page=download and download the exe installer
- You might need to download and install the Visual C++ Redistributable as described at the top of the UwAmp download page. If in doubt, download and install it
- Run UwAmp.exe to install the program
- Launch UwAmp by running the UwAmp program from the Start Menu. When Windows asks, you'll want to allow the Apache HTTP Server (and optionally mysql.d although quakejs doesn't use it) through the firewall on Private & Public networks.
- Ensure that the drop-down under Configuration -> Apache: is set to Online Mode if you want other computers to be able to connect to your web server (Offline Mode will only allow the computer running UwAmp to connect).
- You can now test the UwAmp Web Server by visiting http://COMPUTER-NAME (or http://localhost or http://127.0.0.1). You should some something that looks like this
- Now delete the contents of C:\UwAmp\www\
- Copy the contents of C:\INSTALL\PATH\quakejs\html\ to C:\UwAmp\www\
- If your computer name isn't quakejs you'll need to change your hostname
- Run the Git Bash program as Administrator by finding Git Bash in the Start Menu, right clicking on it, and selecting Run as administrator
- run the following command to move to the web root directory
cd C:/UwAmp/www/
- run the following command to move to the web root directory
- run the following command to download all of the Content Server files
./get_assets.sh
- run the following command to close Git Bash
exit
Standalone Install
- Visit https://www.uwamp.com/en/?page=download and download the zip installer
- You might need to download and install the Visual C++ Redistributable as described at the top of the UwAmp download page. If in doubt, download and install it
- Extract the contents of the ZIP (UwAmp folder) to C:\INSTALL\PATH\
- Launch UwAmp by running C:\INSTALL\PATH\UwAmp\UwAmp.exe. When Windows asks, you'll want to allow the Apache HTTP Server (and optionally mysql.d although quakejs doesn't use it) through the firewall on Private & Public networks.
- Ensure that the drop-down under Configuration -> Apache: is set to Online Mode if you want other computers to be able to connect to your web server (Offline Mode will only allow the computer running UwAmp to connect).
- You can now test the UwAmp Web Server by visiting http://COMPUTER-NAME (or http://localhost or http://127.0.0.1). You should some something that looks like this
- Now delete the contents of C:\INSTALL\PATH\UwAmp\www\
- Copy the contents of C:\INSTALL\PATH\quakejs\html\ to C:\INSTALL\PATH\UwAmp\www\
- If your computer name isn't quakejs you'll need to change your hostname
- Run the Git Bash program as Administrator by finding Git Bash in the Start Menu, right clicking on it, and selecting Run as administrator
- run the following command to move to the web root directory
cd C:/INSTALL/PATH/UwAmp/www/
- run the following command to download all of the Content Server files
./get_assets.sh
- run the following command to close Git Bash
exit
- run the following command to move to the web root directory
Redirect content.quakejs.com
Currently the content server address (content.quakejs.com) is hard coded into the compile ioq3 code. Because QuakeJS is so old, the version of Empscripten used to compile it is no longer available. I'm working on figuring out how to recompile the program. In the meantime, the easiest hack (and it is a hack) I've found to be able to run a local QuakeJS server, without an internet connection, is to edit your hosts file to redirect content.quakejs.com to your localhost. The below instructions will explain how to do this.
- Open your favorite text editor as Administrator (I prefer notepad++)
- Open C:\Windows\System32\drivers\etc\hosts
- Add the following line to the bottom of the file
127.0.0.1 content.quakejs.com # quakejs local content server redirect
- Save the file and close the editor
Extras
Make the QuakeJS Game Server run at Boot
In a permanent install you may want to make the QuakeJS Game Server run when you boot the machine and log in. Follow these steps to create a Schedule Task to run the server any time your user logs in
- Run Task Scheduler from the Start Menu
- click Create Task... on the right
- On the General tab fill in the following information
- Name: QuakeJS Server
- Description: Task to start QuakeJS server in DM mode
- check Run with highest privileges
- Configure For: Windows 10
- On the Triggers tab click New..., fill in the following information, and click OK
- begin the task: At log on
- click Specific user and select your user
- On the Actions tab click New..., fill in the following, and click OK
- Program/script: "C:\Program Files\nodejs\node.exe"
- Add arguments (optional): build/ioq3ded.js +set fs_game baseq3 set dedicated 1 +exec server.cfg
- Start in (optional): C:\Users\USERNAME\quakejs
- On the Conditions' tab optionally uncheck Start the task only if the computer is on AC power
- On the Settings tab uncheck Stop the task if it runs longer than:
- click OK
- On the General tab fill in the following information
Create a Game Server Shortcut
If you are going to run your server intermittently you may want to create a shortcut to launch it. Follow these steps to put a shortcut on your desktop that will launch the game server.
- Right click on the desktop (or in any folder you want the shortcut to live in) and click New and then Shortcut
- In the Type the location of this item: enter
%comspec% /k cd C:\INSTALL\PATH\quakejs && node build/ioq3ded.js +set fs_game baseq3 set dedicated 1 +exec server.cfg
- click Next
- enter a name like QuakeJS Game Server
- click Finish
- Note the Web Server needs to be running before the Game Server can run
Turning on and off the UwAmp Server
Simply run C:\INSTALL\PATH\UwAmp\UwAmp.exe, or UwAmp program in the Start Menu, to start the server and close it to stop it (you can also start stop with the buttons on the UwAmp GUI once it's running)
- Note the Web Server needs to be running before the Game Server can run
Turning on and off the Game Server
Run the shortcut you created on the desktop or go into Task Scheduler and run the QuakeJS Sever task manually to start the server. Close the window that pops up to stop it.
Notes on Customization
Changing the Hostname
If you want to use a hostname other than "quakejs" you'll need to update the linevar args = ['+set', 'fs_cdn', 'quakejs:80', '+connect', 'quakejs:27960']; //custom args list targeting a local content server and local game server both at the address 'quakejs'in
C:/INSTALL/PATH/UwAmp/www/index.htmlto your new hostname (instead of quakejs).
Understanding Server Settings in server.cfg
Parameter | Description |
---|---|
seta sv_hostname "DM Server All Maps" | What players will see on the join server window |
seta sv_maxclients 16 | Maximum number of players on the server |
seta g_motd "Welcome to our Quake3 server" | Message players will see while joining the server |
seta g_quadfactor 3 | Quad Damage strength. 3 is normal |
seta g_gametype 0 | Sets the type of game: 0 - Free for all 1 - Tournament 2 - Free for all(again) 3 - Team Deathmatch 4 - Capture the Flag |
seta timelimit 15 | Sets the timelimit |
seta fraglimit 25 | |
seta g_weaponrespawn 3 | Number of seconds before weapons respawn |
seta g_inactivity 3000 | Number of seconds before an inactive player is kicked |
seta g_forcerespawn 0 | Forces players to respawn: 0 - off 1 - on |
seta rconpassword "password" | Sets the password to allow client control of the server |
set d1 "map q3dm1 ; set nextmap vstr d2" set d2 "map q3dm2 ; set nextmap vstr d3" set d3 "map q3dm3 ; set nextmap vstr d1" vstr d1 |
These last few lines of this example set up a simple map rotation |
Visit https://www.quake3world.com/q3guide/servers.html for details on these settings.
Using the Full Quake 3 Game
This guide (and Inolen's original project) targets the Demo version of Quake 3. If you'd like to try your hand at hosting a node.js version of the full Quake 3 game ronfar623 over at reddit figured out how to do it. You can read his instructions at the link below. Note that he starts by following my instructions above to set up a working Demo version so you'll need to do that first.
https://www.reddit.com/r/quake/comments/cpn4rp/how_to_setup_your_own_local_quakejs_server/ezr8m3c?utm_source=share&utm_medium=web2x
Adding your own Maps
Check out this video by Grabisoft https://www.youtube.com/watch?v=m57rMXASWms
and this GitHub Issue https://github.com/inolen/quakejs/issues/19#issuecomment-570895962