
Full-fledged FPS in WebGL - rinesh
http://timeinvariant.github.io/gorescript/play/
======
shurcooL
I think this is awesome! As John Carmack said [1], you can hop in and enjoy in
seconds.

What is even cooler, IMO, is that you don't necessarily have to write
JavaScript and target WebGL only to get your game to work in the browser. You
can write using Go and use packages with 2 backends, WebGL/OpenGL and
GLFW/Canvas, to abstract out the platform differences behind a common API.

Then your game can be a single codebase that can either run as a native binary
on desktop, or inside the browser.

See a working demo of what I'm describing here:

[https://github.com/shurcooL/play/commit/e53557dd9c070ce0ec52...](https://github.com/shurcooL/play/commit/e53557dd9c070ce0ec5251108249e5fa85333ae0#commitcomment-9101168)

[1] -
[https://twitter.com/ID_AA_Carmack/status/553720089674260480](https://twitter.com/ID_AA_Carmack/status/553720089674260480)

~~~
tesmar2
Given Carmack's view of JS, I am surprised he was so positive. Good for him!

------
ncza
You can play Quake at
[http://webquake.quaddicted.com](http://webquake.quaddicted.com) or
Sauerbraten at
[https://developer.cdn.mozilla.net/media/uploads/demos/a/z/az...](https://developer.cdn.mozilla.net/media/uploads/demos/a/z/azakai/3baf4ad7e600cbda06ec46efec5ec3b8/bananabread_1373485124_demo_package/index.html)

~~~
azakai
And here's ioquake3 (id tech 3-based),

[http://www.quakejs.com/](http://www.quakejs.com/)

and (free-)doom (free, due to copyright),

[http://kripken.github.io/boon/boon.html](http://kripken.github.io/boon/boon.html)

------
agentultra
This is great!

Other than for very specific OpenGL ES features or platform-specific
acceleration I have a harder time recommending indie developers starting out
to use anything other than the web as their platform these days. And with time
I'm sure WebGL will catch up (and surpass?). I've played my part in making it
happen and will continue for that push. It beats telling people to install
this, link that, and all the tooling involved in packaging a game. It even
beats an engine: it's free, distribution is built it, the network effects are
there.

The developer tools need to catch up but it's only a matter of time.

 _Update_ : "platform specific acceleration" being a broad term for targeting
platform-specific features; consoles for example or optimizing for specific
features of a particular touch interface.

~~~
jameshart
What about monetization? Still harder on the web than in the appstore or
steam, surely?

~~~
agentultra
If anything it's probably easier. There are a glut of payment processors
willing to help you out that would take a fraction of your profits compared to
a curated download-only marketplace like Steam. There are, admittedly
immature, marketplaces for web-based games such as itch.io

However it's still possible to deliver a platform-specific download with the
many web-wrapping runtimes out there (cordova, apollo, etc).

It's not perfect _right now_ but it's where the action will be in the next few
years.

------
Crito
I really wish retro-style FPSes like this were more common. There is no
shortage of retro platformers, but it seems like not many people are making
shooters that harken back to Doom or Quake.

Cover systems, realistic weapons, online ranks, etc is all fine; I just wish
there were more games like this. I could play this game all day.

The author links to this essay about Doom which I think really gets to the
heart of it:
[http://vectorpoem.com/news/?p=74](http://vectorpoem.com/news/?p=74)

~~~
JimmyM
Have you played Ziggurat? It's a fantastic FPS/roguelike-like. Shades (well,
more than shades) of Heretic.

[http://store.steampowered.com/app/308420/](http://store.steampowered.com/app/308420/)

------
hardwaresofton
I have no idea how this doesn't have way more upvotes. I just played through
the first level, this game is amazing, I am thoroughly impressed. Maybe I'm
easy to impress, but I think it's amazing

------
zacwitte
Kinda cool that Chrome added pointer lock, but the responsiveness of moving
the cursor around the screen is pretty shit. Maybe it's mac mouse
acceleration's fault?

~~~
hardwaresofton
Not trying to convert you to FF, but it works great on FF 35 for me

~~~
_almosnow
I actually just came here to say how shitty was cursor lock on Firefox.
Firefox just keeps getting worse and worse.

~~~
rockdoe
What problem are you having exactly? Works fine here.

~~~
_almosnow
Cursor 'snaps out' of the window if I move a lot to the left/right.

And Firefox IS going to shit, whether the HN community likes it or not.

~~~
hardwaresofton
It doesn't do that for me, I played the game pretty spasticly...

I don't know in what way you mean Firefox is going to shit, but here's the
great part about it: you can file bug reports, and submit code so it ISN'T
shit.

~~~
_almosnow
At least you could justify Chrome's bad design decisions with "that's what's
good for Google". And that's what makes it even worse for Firefox. US$311
-->MILLION<\-- a year ("not-for-profit"), lot of developers working for free
on it and they can't come up with a decent web browser, shame on them, and
shame on the guys that believe their bs.

------
Retra
Ah, is it doing the old "move sqrt(2) faster on diagonals" thing?

~~~
davesque
I think so :)

------
nighthawk454
Really cool! Was pulling 60fps in Chrome on a retina MacBook Pro. Doesn't work
in Safari, as Safari doesn't seem to support the Pointer Lock API.

------
cordite
It is rather annoying that I can't bind my own keys in the same location since
it does not allow binding to symbols like ',' or '.' (I use Dvorak)

Please, don't be like mirror's edge, let my bind whatever I want.

~~~
mstange
In the future it'll be possible to use keyEvent.code for this:
[http://www.w3.org/TR/DOM-Level-3-Events/#keys-
codevalues](http://www.w3.org/TR/DOM-Level-3-Events/#keys-codevalues)

It's supported in Firefox Nightly + Dev edition. I don't know whether other
browsers support it yet.

------
merlish
Pretty cool. How do you get other weapons? Maybe I've just missed it, but I've
played two levels and have been picking up ammo for other guns but am unable
to switch to them with the numeric keys.

Movement system is good and the music & sound effects have grown on me, but
the shooting speed is pretty slow. (Again, I still only have the basic pistol
though.)

Edit: Never mind, just found a shotgun on the third map. I maintain that the
pistol is a bit slow considering the pace of the game otherwise.

------
bane
That was pretty awesome. It's basically a doom remake, tearing everything down
to just the basics, but executing really well on them.

------
davesque
Love it! I'm an old-school FPSer and have been thinking about taking up a
hobby project involving WebGL. This might just give me the inspiration.

------
jbevain
The «immediate» experience is pretty awesome. You just open the web page and
you're playing.

It takes longer to download, probably the size of the engine and the assets,
but I've been very much impressed with the Unity3D WebGL export of this FPS:

[http://beta.unity3d.com/jonas/DT2/](http://beta.unity3d.com/jonas/DT2/)

------
rikkus
Pointer lock working for me in chrome, but left mouse to fire only works
intermittently. Assigning space to fire works though.

~~~
disordinary
Pointer lock and left mouse click work fine in firefox.

------
ferongr
Some suspension of disbelief required for that "full-fledged" claim (whatever
that means). The mediocre performance, low complexity graphics and Doom-like
movement and shooting mechanics are not comparable to any of the "full-
fledged" FPSs I've been playing since 2000.

~~~
Normati
You might have missed the instructions - "Imagine it's 1994".

~~~
pimlottc
> "Imagine it's 1994".

Is that why it feels like there's some homework I should be doing instead?

------
lectrick
It reminds me of this old game called The Colony

[http://en.wikipedia.org/wiki/The_Colony_%28video_game%29](http://en.wikipedia.org/wiki/The_Colony_%28video_game%29)

Which I never finished because it was so damn hard lol

------
stelonix
Just tried it on Aurora on Linux and it runs great. Loved the Doom-esque feel
to it.

I did notice performance issues when too many enemies were "loaded" (not
necessarily being seen on screen though).

------
Geee
Neat, but there's lag every second or so, making it unplayable.

------
cbd1984
What browsers does this work in? I tried it in both Firefox and Chrome and
neither showed anything other than a black screen.

~~~
mod
Chromium on linux worked great, 60fps, pretty beefy laptop.

~~~
Narishma
It worked terribly on my not beefy laptop (i3 330M) on Chrome (12 fps) and
won't even start on Firefox.

------
tech-no-logical
nice. loved the pac-man monsters :) the pointer-lock doesn't seem to work in
chrome, but works in firefox (with a bit of a hassle from the context-menu
that also pops up)

------
pheo
absolutely awesome. This is how far we've come.

------
Touche
Why no full-screen?

~~~
ars
Press F11.

~~~
Touche
On OSX that makes the window hide.

~~~
Raphmedia
Well, on OSX, simply put your window as fullscreen by using the full screen
button at the top right of the window...

~~~
Touche
Still shows browser chrome. There's a fullscreen API that puts an element into
the full screen: [https://developer.mozilla.org/en-
US/docs/Web/Guide/API/DOM/U...](https://developer.mozilla.org/en-
US/docs/Web/Guide/API/DOM/Using_full_screen_mode)

~~~
Raphmedia
View / Enter Presentation Mode

No need to install any third party to have full screen without the top bar on
OSX.

~~~
roryokane
Are you saying to toggle the menu item “View” > “Enter Presentation Mode”?
There is no such menu item in Firefox 35, and there hasn’t been for many
versions. There is only “View” > “Enter Full Screen”, which enters full-
screen, but with the top bar always showing.

------
MrBoomixer
I'm pretty sure this is made using ImpactJS for anyone that is interested.

~~~
tamerito
It's not. Retro first-person shooter, written in JavaScript using three.js.

~~~
touristtam
for anyone interested, just look at the deps folder on the repo:
[https://github.com/timeinvariant/gorescript/tree/master/src/...](https://github.com/timeinvariant/gorescript/tree/master/src/deps)

------
curiously
man this was more fun to play than call of duty

------
Animats
The page reports "Your browser does not support HTML5 local storage", because
the browser here is configured to block that.

Your game doesn't need local storage. It doesn't get to plant tracking
information.

~~~
captainbenises
Have you looked at the source? Maybe it caches a bunch of expensive to compute
stuff? Or are you just assuming it wants to track you?

~~~
FreezerburnV
It seems to be caching game assets. After loading the game once (which took a
while), the subsequent loading times were dramatically reduced. Though this is
purely based off of quickly opening and closing the website, so I can't
completely verify anything.

~~~
sfjailbird
The browser already caches most things, and caching binary assets (like
graphics) in localStorage would require base64 conversion, adding 30% of bloat
to data size, not to mention computational overhead.

