Quake in a browser

  1. get the 4 files + pak
  2. upload them to your web server

for better peformance use gzip and Etags


alt tab fucks up your mouse

only works w firebox



<Spoike> firstly you need some html that creates a canvas.
<OneManClan> yea, like that horrot game w the screaming woman
<Spoike> secondly you need the engine’s .js code to run inside that canvas.
<OneManClan> ‘creates a canvas’
<Spoike> thirdly you’ll need the engine’s data blob (the .js.mem file)
<Spoike> congrats, you now have FTE on a web page, but it has no data.
<OneManClan> ok so were using javascipt
<Spoike> You’ll need to include the .html.fmf file for that, and name any packages the game will need from there.
<Spoike> http://triptohell.info/moodles/web/
<OneManClan> how long would it take, if you were to walk me through this now?
<Spoike> download ftewebgl.html, ftewebgl.js, ftewebgl.js.mem, ftewebgl.html.fmf from there.
<OneManClan> ok
<Spoike> shove them on your own server somewhere
<Spoike> probably rename the ftewebgl part of all their filenames.
<Spoike> (and change the s.setAttribute(‘src’,”ftewebgl.js”); line inside the .html file to match)
<Spoike> (You should probably also change the <title> line too)
<OneManClan> <Spoike> shove them on your own server somewhere
<OneManClan> IIRC there was some issue w permissions
<Spoike> then that’s your problem, not mine.
<OneManClan> yea yea im just tryin to remember
<Spoike> there’s no php here
<Spoike> you don’t NEED any .htaccess stuff or whatever your server might use
<OneManClan> i have web hosting..
<Spoike> that said, if you want to be able to connect to a server, you will need some extra http header or something
* OneManClan opens up cpanel
<Spoike> eww, web hosting.
<Spoike> sucks to be you. πŸ™
<Spoike> that means you can’t set mime types properly…
<Spoike> anyway, the javascript port of fte does NOT support zlib.
<Spoike> so you should use transfer/content encoding to compress it instead.
<Spoike> just make sure your server is set up to do that for you, and that if you’re using pk3s that those files are added to your pk3 uncompressed.
<OneManClan> ok so i rename ftewebgl.html to my-mod.html ?
<Spoike> yeahsurewhynot
<Spoike> like I say, if you know your javascript you can just rewrite all that stuff yourself
<Spoike> eg http://triptohell.info/demo splurges it from php
<OneManClan> ok i made a folder in attackersgored.com called ‘beast’ and copied the files there

wow its loading something at http://attackersgored.com/beast/ftewebgl.html
<OneManClan> OMG
<OneManClan> thats fuikin amazing!!
<Spoike1> bah, your stoopid site requires me to enable javascript! the nerve!
<OneManClan> !
<OneManClan> it already looks like FTE… and i doidnt do anythign yet!
<Spoike1> because it IS fte.
<OneManClan> ok, what do you mean by:
<OneManClan> <Spoike> that said, if you want to be able to connect to a server, you will need some extra http header or something
<Spoike1> but yeah, you gave it the exact same fmf file, and your browser’s CORS stuff means that the request for the pak failed.
<Spoike1> so you’ll need to host your own copy, or create your own from scratch (either way, you’ll need to edit the fmf)
<Spoike1> browsers are quite restrictive when it comes to loading content from other domains
<Spoike1> including other ports on the same domain
<Spoike1> which makes websocket stuff annoying as hell
<Spoike1> if you set up your fmf file properly and create a webrtc broker, your users can connect to a game using just connect rtc:///foo
<OneManClan> ok, uploading pak0 to β€œ/home/adonisp1/public_html/attackersgored.com/beast”.
<OneManClan> and I edit this line: package id1/pak0.pak – “http://triptohell.info/fteassets/id1/pak0.pak”
<Spoike1> yeah
<Spoike1> (the minus is a placeholder for a hash. you don’t really care for web ports)
<OneManClan> or am i supposed to compress pak0.pak?
<OneManClan> Spoike> so you should use transfer/content encoding to compress it instead.
<Spoike1> you ideally should set up your server to serve a compressed copy of it, yes.
<Spoike1> generally with a ‘Content-Encoding: gzip’ http response header.
<Spoike1> the same is true of the .js file
<OneManClan> so the last line of ftewebgl.html.fmf should be: package id1/pak0.pak – “./pak0.pak”
<Spoike1> and its .mem
<OneManClan> (or something?_
<Spoike1> those files are BIG.
<Spoike1> the last arg is a url.
<OneManClan> so i put the whole path
<OneManClan> ok
<Spoike1> drop the ./ and it’ll use foo.com/beast/pak0.pak
<Spoike1> drop just the . and it’ll use foo.com/pak0.pak
<Spoike1> otherwise you can give it a full url if you want
<OneManClan> drop the “.” .. so its: package id1/pak0.pak – “/pak0.pak”
<OneManClan> ?
<Spoike1> yeahsurewhynot
<Spoike1> or just use a full url and hope that everyone uses only http and not https
<OneManClan> I assume this is normal: https://www.flickr.com/photos/60268498@N06/43754651612/
<Spoike1> no
<Spoike1> also, IE?…
<OneManClan> hm
<OneManClan> in any case i clicked ‘yes’ and: https://www.flickr.com/photos/60268498@N06/29933054688/in/dateposted-public/
<Spoike1> yeah… don’t click yes.
<OneManClan> basegame id1
<OneManClan> basegame qw
<Spoike1> what you just did there is basically try to run it as something like a .bat file
<OneManClan> I dont have these folders on my server
<Spoike1> you don’t need htme
<Spoike1> the client only downloads files its told to find. those are not files, so it won’t download them
<OneManClan> ok, in www.attackersgored.com/beast
<OneManClan> i have the 4 ftewebgl files, and the pak
<Spoike1> “/pak0.pak” == http://www.attackersgored.com/pak0.pak
<OneManClan> ah, thats why i put the . earlier
<OneManClan> . means ‘the current directory’ IIRC
<Spoike1> its not a directory, its a url
<OneManClan> ahh
<OneManClan> package id1/pak0.pak – ” http://www.attackersgored.com/beast/pak0.pak”
<Spoike1> if you must
<Spoike1> I’d strip the scheme+domain, but hey
<OneManClan> package id1/pak0.pak – “/beast/pak0.pak”
<OneManClan> ?
<Spoike1> and yeah, you should probably consider naming the html file as index.html (and thus also index.html.fmf too)
<Spoike1> aye
<Spoike1> don’t bother renaming the .js* files
<OneManClan> ok
<OneManClan> “no games or mods known”
<OneManClan> nice!
<Spoike1> erk
<Spoike1> its trying to load .fmf
<Spoike1> boo hiss!
<Spoike1> that’s my fuckup
<OneManClan> https://www.flickr.com/photos/60268498@N06/28867083257/in/dateposted-public/
<Spoike1> yeah, that’s what I said
<OneManClan> without a dat … it will load … shareware quake?
<Spoike1> it might be loading index.html but the browser doesn’t know that so its using the wrong path for the fmf.
<Spoike1> without a dat you get noclip movement
<OneManClan> <Spoike1> its trying to load .fmf … ok, so i need to edit something?
<Spoike1> undo the rename! πŸ™
<OneManClan> ah
<OneManClan> https://www.flickr.com/photos/60268498@N06/43086733924/in/dateposted-public/
<OneManClan> (i dont know why thr first line has what looks like “f tewebgl..”
<OneManClan> theres no space in the file name
<Spoike1> a shit font
<Spoike1> but yeah, you added www.
<Spoike1> that means different domain
<Spoike1> that means CORS
<Spoike1> that means shit’s broken.
<OneManClan> !!!!!!!
<OneManClan> its dling the pak!
<OneManClan> fuck im at the quake console!
<Spoike1> fuck?
<OneManClan> new game!
<OneManClan> loading client
<OneManClan> receiving game state
<OneManClan> .. is this actually gonna run quaske?
<Spoike1> if you gave it the shareware pak, then yeah.
<OneManClan> seems to have stalled.. or is it still loading?
<Spoike1> I really have no idea
<OneManClan> “loading client 100%”
<OneManClan> https://www.flickr.com/photos/60268498@N06/43086733924/in/dateposted-public/
<OneManClan> oops
<OneManClan> bad paste
<OneManClan> i meant
<OneManClan> hm
<OneManClan> cant right click copy from the web fte console
<OneManClan> Introduction
<OneManClan> Server ended
<OneManClan> client “player” removed
<OneManClan> oh,k nm
<OneManClan> thats what happenes when i start a new game
<Spoike1> works for me, innit
<OneManClan> https://www.flickr.com/photos/60268498@N06/42899895905/
<OneManClan> i can hear the sound of start
<Spoike1> try it in firefucks
<OneManClan> ok
<OneManClan> hm i only have tor browser version
<OneManClan> tryu ti anyway
<OneManClan> “downloading”
<OneManClan> “preparing”
<OneManClan> Message from Mr Spoike?: https://pastebin.com/Ru2s0Gzy
<Spoike1> πŸ˜€
<OneManClan> lol
<Spoike1> yeah…
<Spoike1> a fun little message…
<Spoike1> webgl can be used to fingerprint people, etc
<OneManClan> um i clocked ok.. and its continuing
<Spoike1> so its disabled in anything security concious, like a privacy-focused browser like tor’s fork of firefox
<OneManClan> YES it worked!!
<OneManClan> wow
<OneManClan> ok no sound
<OneManClan> initiating webaudio (NULL)
<OneManClan> could not start audio device “default”
<OneManClan> lemme try reg firefox
<OneManClan> yes, reg firefox has sound!
<Spoike1> they must have blocked it or something
<Spoike1> sound works for me. I switch it off, obviously, but hey
<OneManClan> ok cant look around
<Spoike1> click on it to give it mouse focus?
<OneManClan> i think you have to click and drag?
<Spoike1> no drag queens!
<OneManClan> hm theres some mouse issue
<OneManClan> wont shoot w mouse (even though ive configured attack = mouse1)
<OneManClan> whcn i click and drag, not it moves the player
<OneManClan> even though “move left” and “move right” are set to the arrows
<OneManClan> it seems to insist on movement w mouse
<Spoike1> you’ve not allowed it to do mouse grabs.
<Spoike1> get a newer browser dude.
<Spoike1> hell, use IE11 if you must
<OneManClan> i just downloaded this firefox
<OneManClan> ie new as can be
<Spoike1> get an older firefox then! :\
<OneManClan> hm, turn left and turn right arent working
<OneManClan> i assigned to them to left and right arrow… but
<OneManClan> they control movement now (?)
<Spoike1> don’t you just love it when stuff works first time?
<OneManClan> whats ‘windowed mouse’?
<Spoike1> its a cvar…
<OneManClan> whats the address of your horror map? w the BIG SCARE?
<OneManClan> iirc that worked fine w mouselook
<Spoike1> http://triptohell.info/moodles/web/
<OneManClan> i do have 2 mice connected – is that it?
<OneManClan> (not an issue w FTE normally)
<Spoike1> no? no idea
<OneManClan> hm.. works prefectly
<OneManClan> holdon…
<OneManClan> … NO IT DOESNT
<OneManClan> i alt tabbed…
<OneManClan> and that must have ‘done something’
<OneManClan> otherwise…
<OneManClan> sensitivity 25
<OneManClan> contrast 1.5
<OneManClan> and were Quakeing!!!
<OneManClan> looks fukin great
<OneManClan> ok retested mine.. and it works as well
<OneManClan> (ie as long as you dont alt tab)
<Spoike1> so don’t loose focus!
<OneManClan> is it an easy fix?
<Spoike1> nothing is easy in browsers.
<OneManClan> (because otherwise the whole thign works prefectly)
<OneManClan> btw “prefectly” is an actual typo, im not being ironic πŸ™‚
<Spoike1> I didn’t notice.
<OneManClan> it seemed pretty fast as well
<OneManClan> ie is there a ‘disadvantage’ to putting ones (100% original) mod on a webpage?
<OneManClan> is there data stored, or re-doanloaded every time?
<Spoike1> browsers fucking shit up
<Spoike1> and yeah, browsers have a limited cache for downloaded crap
<OneManClan> ah
<Spoike1> and you really ought to ensure that your files are getting cached properly
<Spoike1> both the .js and the paks anyway
<OneManClan> well holdon, last i checked AGR was 70mb
<OneManClan> hat was a few years ago
<OneManClan> under 100 anyway
<Spoike1> that’s when compressed?
<OneManClan> yes, compressed IIRC
<Spoike1> well, a pak.gz should give better compression than .pk3
<Spoike1> hurrah for solid archives.
<Spoike1> just don’t expect that much.
<OneManClan> so i just A: compress it B upload it, and C: the Client does the rest?
<OneManClan> also not sure what you mean by ” getting cached properly”
<OneManClan> ie how to ‘ensure’
<OneManClan> ill do a dummies guide’ for this btw
<OneManClan> add it to my other (VERY *rough*) notes: http://www.attackersgored.com/?cat=30
<Spoike1> https://varvy.com/pagespeed/enable-compression.html
<OneManClan> thanks, readin’
<OneManClan> wow, a brilliant read, even *I understood it!! ie completely!!
<Spoike1> …
<OneManClan> ok i edited htaccess, and tested w the Gzip compression test
<OneManClan> its working
<Spoike1> now get it cached too
<OneManClan> .. how?
<Spoike1> you think I have a clue?
<Spoike1> I hate browser tech
<OneManClan> caching is what the browser does, yea?
<OneManClan> i have no idea how to control it via html (or whetever)
<Spoike1> http
<OneManClan> <Spoike1> now get it cached too
<OneManClan> ^ meaning the pak file>
<OneManClan> ?
<Spoike1> and the .js file
<OneManClan> https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
<OneManClan> (reading)
<Spoike1> what you want is for the browser to cache everything so that you don’t have to send all that data constantly.
<OneManClan> understood
<Spoike1> basically, what I’m saying is that you probably want to use ETags
<OneManClan> ok


Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.