Git Product home page Git Product logo

webquake's Introduction

WebQuake

WebQuake is an HTML5 WebGL port of the game Quake by id Software.

Online demo by SpiritQuaddicted.

Installing and running

Follow these steps to install WebQuake:

  1. Install a web server with HTTP 1.1 Range support. The project was developed and tested on Abyss Web Server on Windows, so it's guaranteed to work on it.
  2. Download entire contents of the Client folder (index.htm and WebQuake/ folder) from the Code tab and put it somewhere on your server.
  3. Get Quake resource files. The demo version containing only the first episode is enough.
  4. Copy the id1 folder from the Quake folder to the folder where you put index.htm.
  5. If you have Quake mission packs, repeat step 4 for hipnotic and/or rogue folders.
  6. If you're running a system with case-sensitive names (such as Linux), make sure that all game files except for code files have lowercase names.

To launch WebQuake, go to the WebQuake directory on your server in your browser.

To launch the game with command line arguments, add ? after the address and put the arguments after it in the same format as you use for Quake.

For Scourge of Armagon, add -hipnotic command line argument. For Dissolution of Eternity, add -rogue.

To launch mods, copy the mod folder into the folder containing index.htm and add -game MOD_NAME_HERE command line argument. Ensure step 6 of the installing instructions for the mod folder.

To use browser hotkeys (such as F5, Ctrl+T and Ctrl+W), click the address bar, and when you're done, click the game.

Playing multiplayer

If you want to join a multiplayer game, do one of the following steps, go to Multiplayer menu in the main menu, type the IP in "Join game at" field and press Enter, or type connect ws://ip:port in the console.

You can also play WebQuake games in a native Quake (not QuakeWorld) client such as WinQuake or GLQuake. Choose TCP/IP in the Join Game menu.

You cannot join multiplayer games if the client is installed on https:// protocol, however.

If you want to create a server, first, install the dedicated server by completing the following steps.

  1. Install Node.js.
  2. Download the "Server" folder from the repository.
  3. Put Quake resource files into the downloaded Server folder.
  4. Open Node.js command prompt.
  5. Go (cd) to the Server folder.
  6. Type npm install websocket (for more information, see Worlize/WebSocket-Node repository).

Then, to launch a server, open Node.js command prompt, go to the Server folder and type node WebQDS.js.

To change maximum number of players, use -maxplayers command line argument.

Remote console

To execute console commands on the server from the client or the web, set rcon_password in the server console. If you have spaces in the password, surround it with quotes.

Don't tell the password to anyone except for the server admins. Don't put the password in the command line, as everybody on the web can see your command line on your server's /rule_info page!

Then, you have 4 ways to execute server commands:

  • In the game, when not connected, in the console, type rcon_address ip:port (without ws://), rcon_password server_RCON_password (surround the password with quotes if you have spaces in it), and then execute the commands by typing rcon your_command_here.
  • In the game, when connected to the server, do the same as in the previous way except for settings rcon_address.
  • Go to the server IP in the browser (for example, if your server is at ws://192.168.0.2:26000, go to http://192.168.0.2:26000). On the Rcon line, enter your command in the left field and the password in the right field and press Send.
  • Go to http://ip:port/rcon/your_command_here in the browser. Login as "quake" with your RCON password.

Server info API

You can retrieve some server information in JSON format by going to special addresses on your server IP.

  • /server_info — returns an object containing the server name hostName, current level name levelName, number of connected players currentPlayers, maximum number of players maxPlayers and API version protocolVersion. Gives 503 when server is off.
  • /player_info — returns an array of objects with the info about a player, where # is player number starting from 0. Contains name name, shirt/pants color colors, shirt color is upper 4 bits, pants color is lower 4 bits), number of kills frags, time since connected connectTime and IP address address. Gives 503 when server is off or 404 if the player is not found.
  • /player_info/# — returns single player info object for the player under the number #.
  • /rule_info — returns an array of all server console variables (like movement variables), in {rule:"variable name",value:"variable value"} format.
  • /rule_info/variable_name — returns single server console variable in the same format. 404 if the variable doesn't exist.

Adding game music

To add music to WebQuake, you need to get the music off the Quake CD and convert it into .ogg format (Audacity is great for this).

The .ogg files should be called quake##.ogg, where ## is CD track number minus 1 with trailing 0, so the main theme is named quake01.ogg and the last track on the Quake disc is quake10.ogg.

Then you should configure the server to return audio/ogg MIME type for .ogg files.

After that, create "media" folder in the "id1" folder (or, for the mission pack music, "hipnotic" or "rogue") and put the .ogg files into it.

Browser support

The port has been tested on the following browsers (results from 2013):

  • Firefox (Windows) — Very good — developed on it.
  • Chrome (Windows) — Very good — no "loading" image.
  • Firefox (Android) — Okay — very low performance (canvas is locked at 12 FPS), no mouse support. Keypresses are incorrect, not tested with Windows keyboard.
  • Chrome (Android) — Not Good — no "loading" image, sound is broken (launch with ?-nosound -nocdaudio), no mouse. Requires Windows-compatible keyboard for Esc and F1-F12 keys.
  • Opera (Windows) — Not Good — low performance, nothing is drawn in water (type r_waterwarp 0 in the console), no mouse.
  • Internet Explorer (Windows) — Unsupported — bad TypedArray support, but likely many more issues.

Mouse support is currently available only on Chrome and Firefox. Stereo positional audio is supported on Chrome and Safari.

Tips

If the sound randomly doesn't play, go to console (press ~ or Options > Go to console in main menu), type stopsound and press Enter.

You can delete saved games by pressing Del in the load or save menus. This only works for the saved games created in WebQuake.

Contributing

If you want to contribute to WebQuake, feel free to fork the project and make a pull request. Pull requests and issues will be reviewed by the developer.

webquake's People

Contributors

pmatyja avatar triang3l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webquake's Issues

Entering commands in the server console truncates the last character

$ node WebQDS.js
(...)
stuff scrolling by
(...)
map dm1
FindFile: id1/progs.dat
FindFile: can't find maps/dm.bsp
Couldn't spawn server maps/dm.bsp
quit
Unknown command "qui"


The last character is truncated/ignored or something. As a workaround one can simply add any character at the end.
I mean the "console" in the terminal I launched the server in, not RCON.

Mouse jump glitchy problem with Chrome Win10 360 spin keep moving mouse to right.

A problem that can happen when spinning around is that the position suddenly jumps a lot in Chrome.
There may be a fix for this that they have not pushed into Chrome yet.

I am only listing this issue here because I noticed it in WebQuake in-case others have this problem and think WebQuake is to blame, it is not related to WebQuake.

Possible work around, lerp the delta by some constant not ideal.

function lerp(v0, v1, t) {
	return (1 - t) * v0 + t * v1;
}

function getChromeVersion () {
    var pieces = navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);
    if (pieces == null || pieces.length != 5) {
        return undefined;
    }
    pieces = pieces.map(piece => parseInt(piece, 10));
    return {
        major: pieces[1],
        minor: pieces[2],
        build: pieces[3],
        patch: pieces[4]
    };
}

var usePointerLock360BugWorkaround = false;
var chromeVersion = getChromeVersion();
if (chromeVersion) {
	usePointerLock360BugWorkaround = true;
	IN.mouse_delta_x = 0;
	IN.mouse_delta_y = 0;
}

IN.onmousemove = function(e)
{
	if (document[IN.pointerLockElement] !== VID.mainwindow)
		return;
	if (usePointerLock360BugWorkaround === false) {
		IN.mouse_x += e[IN.movementX];
		IN.mouse_y += e[IN.movementY];
	} else {
		// Workaround Chrome mouseMove "sudden jump" bug.
		IN.mouse_delta_x = lerp(IN.mouse_delta_x, e[IN.movementX], 0.75);
		IN.mouse_delta_y = lerp(IN.mouse_delta_y, e[IN.movementY], 0.75);
		IN.mouse_x += IN.mouse_delta_x;
		IN.mouse_y += IN.mouse_delta_y;
	}
};

Related links:
http://www.html5gamedevs.com/topic/34516-pointer-lock-bug-on-chrome-with-windows-10/
https://bugs.chromium.org/p/chromium/issues/detail?id=781182
https://bugs.chromium.org/p/chromium/issues/detail?id=461373
https://bugs.chromium.org/p/chromium/issues/detail?id=411634
https://bugs.chromium.org/p/chromium/issues/detail?id=784122

Possible work around to lerp the delta values found here, going to try adding this as a work-around.
mrdoob/three.js#12757

White screen only pops up.

I've tried restarting my computer, deleting the app and re downloading it, and waited about 10 mins to see if it was just loading. I am not a computer wiz so i won't understand technical terms. I am using a MacBook Air to play. It was working yesterday but not now.

Issue connecting from WinQuake

I just tried hosting this on my local server and it works great. Server runs great and so does the client.

I've also read here that the server accepts connections from WinQuake and GLQuake. So, I fired up WinQuake and tried connecting. It fails 5 seconds in with only a "client to server keepalive" message. Looking at the server-console, it displays the message SV.ReadClientMessage: unknown command char and proceeds to remove the player.

I don't know if this is an issue with the server or my setup!

Beeping on E1M1 in Chrome

Does anybody hear the "beep beep" sound when touching certain doors on e1m1 in Chrome?

I had an issue when the game displayed "player" text in the center of the screen when touching some doors. I thought I fixed it by changing string indices from int16 to int32, and I actually fixed it in Firefox, but it looks like something is wrong in Chrome.

Mouse not working

Tested on latest versions of Chome and Firefox. Mouse is not captured by the web browser

How do I use this on a Chromebook?

After following the steps, I double clicked the .htm file to start Quake. A notification then showed up saying, Protocol is file, not http: or https:

auto-connect to multiplayer server at launch

If a multiplayer server (ip:port) is set in the configuration file -- automatically connect to this server at startup / launch.

If this is already possible, how to configure such a setting is not readily findable in the documentation.

Game not loading, stuck on "Starting Quake..."

Hello,
Upon loading index.htm, all I get is "Starting Quake...". I also get a pop up that says: "Protocol is file:, not http: or https:"

image

I would also like to know how to configure a server.
Thanks,
James

What each file is for?

Hello. A few questions:

Where are the entry point and main loop?

What each file is for? What's is your recommended order of reading them? What are dependencies between them?

Please add answer to README.md. I don't know if I'm stupid for asking this, other people seem to navigate in this code somewhat ok.

Chrome Packaged app

Hej!
I created a fork and put it in the chrome web store
https://github.com/kzahel/WebQuake

I am super impressed by your code. Did you write it from scratch by looking at the original source code? Did you use some kind of automatic translator?

I was wondering if you had done any work with quakeworld client / quakeworld server. I grew up playing those and would love to see them revived in a packaged app (which have UDP socket support, btw!)

Map Rotation

I know this is a long shot, but is there any way you could implement map rotation? I am aware that this feature is not available in vanilla Quake, only in QuakeWorld via localinfo, but maybe you have an idea how it could be done?

Thanks a lot for this port, i got it running on my server to frag a bit whenever i feel like ;-)

Performance issues with WebQuake build 54 (1.09)

So I decided to Mirror WebQuake on http://h3ll.x10host.com/WebQuake/

I couldn't help but notice that the version on Quaddicted seems to be way better optimized than the latest on here, I tested on a Chromebook to confirm this (huge random performance drops on the latest version on here even with a performance-increasing autoexec)

I'm sure this is due to optimization, and I'm willing to fix this myself if I had a pointer on where to start on this

My target is Chromebooks due their wide usage in schools

Forked WebQuake supports Async IO

Figured I'd write a note to let you know that I created a fork off this project that uses promises and recursion to support JS's async functions. The main reason for this is support indexed db, which requires async support to retrieve files. Also, synchronous IO functionality will be deprecated at some point anyway.

I was planning on extending your source further, adding some modern features (from proquake or qrack) and hosting a web based gaming environment. This requires users to specify their own local pak1 file (for licensing reasons).

Just wanted to get your thoughts on this project, and if you had any ideas for performance improvements

cant run mod files

Hi there. i cant run mods. got the error everytime "Corrupted data file."
Even when i try to add not existing dir error is the same.
examles:
http://domain.tld/webquakedirwithindex.htm/?-game qr - dir exists, all files renamed to lowercase
http://domain.tld/webquakedirwithindex.htm/?-game airquake - dir exists, all files renamed to lowercase
http://domain.tld/webquakedirwithindex.htm/?-game notexist - dir not exists

console log output:
Host.Init
COM.js:301 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
COM.LoadPackFile @ COM.js:301
Sys.js:25 FindFile: qr/gfx/pop.lmp

Sys.js:44 Added packfile id1/pak0.pak (339 files)
Sys.js:44 Added packfile id1/pak1.pak (85 files)
Sys.js:44 Added packfile qr/pak0.pak (131 files)
Sys.js:44 Added packfile qr/pak1.pak (23 files)
Sys.js:44 Added packfile qr/pak2.pak (5 files)
Sys.js:44 Added packfile qr/pak3.pak (74 files)
Sys.js:47 Uncaught Error: Corrupted data file.
at Object.Sys.Error (Sys.js:47)
at Object.COM.CheckRegistered (COM.js:124)
at Object.COM.Init (COM.js:172)
at Object.Host.Init (Host.js:292)
at window.onload (Sys.js:144)

FirefoxOS packaged app

This will require making webquake work with local files instead of websockets to fetch the paks and implement touchscreen controls.

I have verified that webquake runs fine on FxOS (2.2 at least), quite fluent in Flame, so it will be a great addition to the marketplace.

How do I enable mouselook ?

I tried the old trick of issuing +mlook in the console.
As well as trying to bind +mlook to a key.

Nothing works... please help !

Can you describe the issue with HTTPS?

From the docs:

You cannot join multiplayer games if the client is installed on https:// protocol, however.

Can you describe the technical issue with this, as I'm interested to see if there is a workaround.

Using node.js as a server?

Hi! I found your work pretty impressive!
For web server you use abyss web server, but why not simply use node.js, like in Server/ part?
It would be much more uniform.

I think you should make Client/ as private npm module, like Server/ in my last Pull Request

Can't connect from the same machine twice

I'm opening up the client with Chrome and Firefox simultaneously and trying to connect to the same WebQuake server. Once I'm joining the game in the second browser window, the server kicks out the first. Why is this happening?

I've started the server with
-port <custom_port> -maxplayers 8
switches and if i open up http://<server_ip>:<custom_port> i can see the game is really limited to 8 players. Does the server allows only one connection from the same IP address?

Error compiling shader: null

Tried running it on a server and after fidding with it to get it work (btw you need to tell people they need people they will also need gfx.wad and they need to be lower case if using a Linux server) and I am getting the error: Error compiling shader: null

Any way to add the full game files?

First of all, just wanted to say you guys have done a fabulous job so far. I've been running this on a chromebook, very stable, running at 100% speed. This is actually my first time playing it, and I would like to continue playing it on chrome. How's the full game feature coming? I would be willing to donate if you could assure me it would be coming in some reasonable amount of time.

Can someone tell me if I have this correct in the server?

quake1
quake2

Thanks again,

When I launch from just the index file, I get this screen:

quake4

I am not sure of the file structure, or the instructions are somewhat vague on how to implement the game.

I found some information on the original discussion:

2013-02-11

20:12:14
Spirit
Administrator

Paul: For example like this

/dir/
/dir/WebQuake/
/dir/WebQuake.htm
/dir/id1/
/dir/id1/pak0.pak
/dir/rogue/
/dir/randommod/

Make sure everything is lowercase (unless you are on a Windows server).

Andrew, mods work. :) Try http://www.quaddicted.com/stuff/WebQuak … me%20qdqst or http://www.quaddicted.com/stuff/WebQuak … me%20czg07 (that one crashes after the start map) or http://www.quaddicted.com/stuff/WebQuak … me%20quoth (I have not tested that one yet).

This looks similar to what I have, but it still throws an error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.