Hacker News new | past | comments | ask | show | jobs | submit login
Full-fledged FPS in WebGL (timeinvariant.github.io)
221 points by rinesh on Jan 14, 2015 | hide | past | favorite | 79 comments



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...

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


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


I don't understand when you say "you don't necessarily have to write JavaScript and target WebGL only to get your game to work in the browser"

What is deployed then ? Is an executable deployed ? Is it something like nacl, or asm.js ? Or does the user have to install an executable on his system ?


The parent was referring to using gopherjs to compile golang code to Javascript.



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

http://www.quakejs.com/

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

http://kripken.github.io/boon/boon.html


Wow, I forget how classic Quake is. It's such a wonderfully simple shooter in contrast to today's overly complex AAA titles.


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.


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


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.


Compared to the Canvas 2d API, OpenGL is VERY hard to get into. It's very low level compared to the rest of the browser API's.


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


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

http://store.steampowered.com/app/308420/


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


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?


FPS games kinda suck on Mac for this reason. This little control panel widget helps a little bit:

http://smoothmouse.com/


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


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


What problem are you having exactly? Works fine here.


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.


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.


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.


Same for me, but on Windows. Otherwise it's a pretty neat tech demo but is unfortunately rendered unplayable by this bug.


I noticed this as well, but I use a trackball mouse and I can flick the ball and get good responsiveness.


No problems on Arch, just the fps was underwhelming on a 290 on Gallium / Firefox.


What's underwhelming? I was getting 38 fps on chromium/Arch on a ThinkPad X230. I guess it's slow if you're used to 60 fps, but I was quite impressed.


Average fps was 47, but this game seems to be composed of very few polygons. I mean less than Quake 1 here. It should scream at 300+ fps at least on a video card like that.

That, and it seems its either the browser or the game fps capped at 60. Which makes the experience on a 144hz monitor less appealing.


yeah but that's conflating simple with optimized, which i doubt this is. A lot can probably be done to make this run much faster. This is not a AAA title.


There's a mouse sensitivity option in the menu.


accel != sens


The OP commented on responsiveness, which is certainly a sensitivity issue.


Works fine on my 2013 MacAir


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


I think so :)


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.


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.


In the future it'll be possible to use keyEvent.code for this: 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.


Same here, and my keys are mapped at the registry level in Windows (at work, don't judge :P). So I got to shoot and look around a bit. Looks awesome though, I just recently started making an engine that targets asm.js/Linux/Windows, makes me want to work on it more once I find a new job.


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.


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


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.


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/


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


Pointer lock and left mouse click work fine in firefox.


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.


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


> "Imagine it's 1994".

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


> Doom-like movement and shooting mechanics

Doom controls a lot better. I played some Brutal Doom just an hour ago. In Doom, there is some inertia. You accelerate and there is some friction. In this game, movement is a binary on/off thing. The bobbing is also very jarring.


You can turn off the bobbing in the settings


I did. I dislike bob/pitch/roll in general. I appreciate that they added a checkbox for that. Also, having a FOV slider is great, too.

I couldn't set the mouse sensitivity high enough though.


I'm with you on this one. After seeing this running at 15-20 fps, my reaction was that web technologies have finally been shoehorned in a place where they can almost provide the same experience as 15 year old native games, while running on a modern machine. Oh well, the 'hardware is fast, overhead doesn't matter' crowd doesn't care.


It reminds me of this old game called The Colony

http://en.wikipedia.org/wiki/The_Colony_%28video_game%29

Which I never finished because it was so damn hard lol


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).


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


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


You need hardware and drivers which support WebGL. With Chrome, open "chrome://gpu/" to get some rudimentary status report. Also, try updating your drivers. The one you're currently using might be blacklisted.


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


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


That was on Windows, now I'm on Linux and it's the other way around. It won't start on Chrome, and it runs at 4 FPS on Firefox.


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)


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


Why no full-screen?


Press F11.


On OSX that makes the window hide.


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


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...


View / Enter Presentation Mode

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


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.


Not sure what you are referring to as third party, the full-screen API is a web standard.


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


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


for anyone interested, just look at the deps folder on the repo: https://github.com/timeinvariant/gorescript/tree/master/src/...


I think you've confused it with the (really cool, recently released) TwoPointFive plugin for Impact: http://phoboslab.org/twopointfive/


man this was more fun to play than call of duty


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.


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?


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.


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.


I guess you won't be playing the game then, huh? Tracking information, heh. As if that's the only use for local storage.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: