
Doom 3 in WebAssembly - jsheard
http://continuation-labs.com/d3wasm/
======
Gab_CV
Hi! I am the guy who did this port. I am very sorry for long download times,
but the HN/Twitter buzz was unexpected and the host server - a cheap shared
hosting I barely use just for testing purposes - is currently crying very
hard. Oops...

Also, download code is dumb for now, it is downloading one big full .pk4 file
(400MB) for each visitor loading the app. I know, it should be better to only
preload necessary assets for sure! Smart streaming of game data is one
necessary step for apps on the web.

~~~
anderspitman
Have you considered webtorrent or IPFS for distributing the file? Webtorrent
in particular looks very easy to setup, and then the most your server would
ever have to handle is the equivalent of a single downloader.

~~~
Gab_CV
I think it would be better to stream only needed data, using some lazy load
mechanism. Still need to figure out what is the best approach

~~~
anderspitman
That's definitely the more permanent solution for games like this. I was
thinking more along the lines of quickly solving the immediate problem so you
don't have to spend more money on a different server. I wouldn't be surprised
if you could replace the download with a webtorrent in less than an hour of
work and be done with it.

------
jillesvangurp
Once this stuff stabilizes a bit, games wrapped up as progressive web apps
might become a thing. Could be an interesting way to get distribution outside
of the app stores via regular search engines for a lot of indie developers
using e.g. unity. Also a nice way for mainstream game developers to show of
demos without requiring cumbersome installations, lengthy detours via some app
store, etc.

~~~
roland-s
I think the problem is that nobody wants to go manually find games across the
web, then maintain a bookmark list of their games, share purchasing info with
100 different sites, throw away a central liaison for customer
support/community/developer interaction. Centralized repositories are way more
useful and convenient and manageable. Now you could still do a central repo of
webasm games but if anything I could see Steam offering a WebAssembly portal
or something.

~~~
wbl
I remember the glory days of flash games. Miniclip.com had some fun ones, and
there were a bunch of sites.

~~~
roland-s
Newgrounds.com, addictinggames.com, and kongregate.com are the three I
remember. RIP Flash and Shockwave

------
hermitdev
I tried to check it out, but it was taking forever to load. Downloading the
assets at only ~500 KBps on a 150 Mbps link. Also only got maybe 10% through
the download before I gave up, and the Chrome tab was already using 500 MB of
RAM.

This might be an interesting POC, but seems very impractical in reality.

~~~
moreira
This website might just be getting the HN hug of death if it can’t even serve
you the game at full speed. It doesn’t seem like it’s related to how practical
it is.

~~~
hermitdev
Yeah, seems likely. I'll have to come back and check this out later.

I recently found my Doom 3 CDs and tried installing it on Win10, but
apparently doesn't work out of the box on 64-bit (crashes at start) without
manually patching for using > 2 GB of RAM from the cursory googling I did.

If this does work later, will have to show it to my 11 year old step son. Was
hoping to freak him out with Doom 3 when I found my disks (he loves shooters &
scary movies, so thought he might get a kick out of it).

~~~
xirdstl
You can also get a Doom 3 Steam key right now from several places for less
than $2.

~~~
dpkonofa
That's the BFG Edition, though, which, in my opinion, isn't nearly as good as
the original. I liked the dynamic of needing to use the flashlight and some of
the other tweaks made to the BFG edition ruin the feel of the game a little.
That being said, it did also make some improvements but to each their own.

~~~
xirdstl
I believe Steam has both editions. There are certainly different store entries
for "Doom 3" and "Doom 3: BFG Edition".

~~~
dpkonofa
You are correct! I didn't realize you could get the original edition on Steam.
It wasn't on there for a while.

Sidenote: The Doom 3 BFG edition also gives you the original Doom games
although they've been nerfed a little from the original. (e.g., the stimpacks
no longer have the little crosses on them because of a lawsuit from the Red
Cross)

------
dschuetz
This demo doesn't include shaders, it's mostly just polygons and textures and
lightmaps. It was the shaders which made the game impressive back then.
However, for a port to WebAssembly it's really a big deal.

~~~
sneakernets
To think, those were the old fixed pipeline ARB-style shaders, too. I still
have trouble with games using those on modern cards.

------
rafaelvasco
Only thing we need now is presentation/distribution. Download this stuff one
time for the machine as a standalone progressive hybrid native/web app, and
run as an exe from there on. With auto updates. No browser involved. HTML5
games don't take off because of the presentation/distribution. The browser is
the problem. Now that we have WebAssembly, performance is much less of a
problem.

~~~
Klathmon
I absolutely disagree.

The browser is the solution to the presentation/distribution problem. I don't
need to worry about installing the game, or worry about what OS I'm on or
where it was installed to or anything else.

I go to the URL, and the game downloads if needed, then plays. Updates, local
caching and storage, and more is all taken care of. If I want to play with a
friend on some multi-player game, I send them the link, and they go to it and
start playing themselves.

no "launchers" needed, no app stores which take a cut, no platforms which can
decide that the game isn't suitable for their system, no app stores which can
decide that the app is too close to something they offer and removing it, no
expensive publishing costs, and you have multiple browsers to choose from if
you don't like any one in particular.

~~~
krapp
> I don't need to worry about installing the game, or worry about what OS I'm
> on or where it was installed to or anything else.

Most people don't worry about that in any case. If I'm on Windows, I download
the Windows version of whatever, and the installer does whatever. In a
browser, you're just "installing" software to the cache. It's the same thing
in a different wrapper.

>I go to the URL, and the game downloads if needed, then plays. Updates, local
caching and storage, and more is all taken care of. If I want to play with a
friend on some multi-player game, I send them the link, and they go to it and
start playing themselves.

This is a good argument for HTTP as a distribution system, but you don't need
a web browser for any of that.

>no "launchers" needed, no app stores which take a cut, no platforms which can
decide that the game isn't suitable for their system, no app stores which can
decide that the app is too close to something they offer and removing it, no
expensive publishing costs, and you have multiple browsers to choose from if
you don't like any one in particular.

Except the browser is the "launcher" and the site you download from being an
"app store" for all intents and purposes, entirely capable of curating or
charging money.

~~~
Klathmon
>Most people don't worry about that in any case. If I'm on Windows, I download
the Windows version of whatever, and the installer does whatever. In a
browser, you're just "installing" software to the cache. It's the same thing
in a different wrapper.

I agree, except for the magnitude difference in time required in most cases.

A web-app that takes more than 10 seconds to load is consitered broken to
many. A desktop app that can go from "discovery" to "using" in less than a
minute is consitered fantastic. Plus then there are update headaches.

I genuinely believe one of the major reasons why the web is taking over is
because every other platform makes the process of "installing" code such a
difficult slow process.

Not to mention the security issues with giving code access to desktop systems
which traditionally are difficult for the average user to secure. And the fact
that I don't ever think i've had a piece of installed software ever completely
"uninstall" itself correctly. They always leave stuff behind. In a browser, a
single "clear browsing data for this domain" gets rid of all of it, entirely.

>This is a good argument for HTTP as a distribution system, but you don't need
a web browser for any of that.

But you do. Some platforms (like iOS) don't allow distribution over any
methods other than their app store, or a browser. Still more heavily
discourage distribution over HTTP (most linux distros). And most users will
download the "installer" for a game via a browser in the extreme vast majority
of cases, so why not cut out the middleman and just allow the game to be
playable in a browser?

There are also other benefits of a web-platform game, like the ability to
"deeplink" inside the app. I can not only share a link to the game, but can
easily share a link to a specific screen in the game, or can share a link to
allow you to connect to my game. And that whole process is crawl-able for
search engines, and easy to implement. Sure, it's possible to do with desktop
software, but it's much harder in most cases, especially when you throw cross-
platform into the mix.

>...the site you download from being an "app store" for all intents and
purposes, entirely capable of curating or charging money.

While of course a specific site can act as a gatekeeper, that's not what I was
talking about. Time and time again we see stories about how Apple removed some
app from the app store, or some company pulls their subscriptions from being
allowed to sign-up on iOS devices, or how some game makes their own app-store
to get around the limitations on android, or even how most "app stores" don't
allow adult content.

That is the kind of stuff that the web-as-a-platform gets you away from. You
aren't going to have Google removing your app because it's too adult, or Apple
charging you a 30% fee for all subscriptions made on their platform.

I'm all for streamlining this process to allow users like yourself that want a
"local install" to get it, but I don't think we should throw the baby out with
the bathwater here. Browsers give us a shitload of benefits, and the discovery
and "install" process (or the lack of) is second to none. I think we can work
with those benefits, and give users and developers the options needed for
other formats if they want.

For example, The microsoft store has started allowing PWAs to be listed,
browsers could work with the OS and define some APIs that allow you to choose
where to "install" a PWA or web game, possibly even allowing you to simply
move it or uninstall it after the automatic "install" happens.

We are finally getting away from the days where it would take tens of minutes
to download and install software on a computer, where it would require you to
give a considerable amount of trust to that software once you run it, and
making it really hard to share content within apps with others. I don't see
why you would want to go back.

But now that I said all of that, I realized that I don't really know why
someone would want to not have it. So I guess my question is why do you want a
traditionally "installable" code? Is there something I'm missing here, or some
assumption that one of us is making that is getting rolled in with this
conversation?

~~~
krapp
I believe webassembly offers the opportunity to democratize and decentralize
software, but I don't believe that can happen as long as "web applications"
remain in the browser, or as long as runtimes are tied to specific languages
or platforms (as with java and flash.) I want the line between "native" and
"web" to be eliminated as much as possible, so that every application has a
URL and can be run from there in a browser _and_ installed natively from it.

>I think we can work with those benefits, and give users and developers the
options needed for other formats if they want.

That's literally what I'm advocating. Not getting rid of webassembly
applications in the browser, but _also_ having native runtimes that are
optimized for running the same webassembly applications.

Every benefit that the browser as application model provides could improve the
way native applications work as well - there could literally just be a button
or an option in the browser to "install as native" and the Webassembly binary
in the browser could just be copied somewhere, maybe with some metadata, and
an icon generated for the desktop. Native runtimes could sandbox them just as
a browser might, and the uninstallation process need be not much more complex
than dumping a cache or deleting a folder.

~~~
Klathmon
Ah, so it sounds like we are on the same page, but just call it different
things. (what you call a native runtime I call a browser with some UI
differences)

Your last paragraph basically describes a browser with a special "install"
flow. Mobile Chrome already has a flow like that for PWAs where it will ask
you "do you want to add this to the home screen?" and it will add the icon to
your app drawer on android just like any other app, allow you to "uninstall"
it just like any other app, and when you launch it it launches fullscreen just
like any other app.

I'd love to see this expanded to cover desktop as well. And with some
additional work (like giving the option to move storage data to different
drives or manage apps based on their hostname more easily), it could become a
very powerful system.

If you want to learn more, take a look at the google developers page for PWAs.
It seems to be what you are looking for in some ways!

[https://developers.google.com/web/progressive-web-
apps/](https://developers.google.com/web/progressive-web-apps/)

------
sonofgod
I get some weird lighting bugs -- one side of everyone's face has massive
shadowing from the centreline...

... but yes, surprised how well it ran on my old laptop!

~~~
Thaxll
For a game that released 15 years ago?

~~~
rubbingalcohol
Getting something like this running in a web browser at acceptable performance
is a significant technical achievement.

~~~
nicoburns
Is it? Web browsers aren't that much slower than native (around 2x with web
assembly and WebGL I think).

It's much harder for apps that are trying to render to the DOM (which is very
slow). But WebGL apps should be perfectly fast in browsers...

~~~
johndough
All WebGL implementations have significant overhead compared to native GL. For
example, just clearing the screen at 60 fps taxes my CPU at 10% on Windows
(30% on Linux) while a C program that does the same uses 0% CPU.

The reason for the performance penalty with Firefox on Linux is that the
framebuffer content is copied from GPU to host memory, compositing is done and
then it's copied back to GPU.

For other platforms I'm not sure.

Further, SIMD support has been removed from Javascript and not been added back
to WebAssembly yet, so that's another factor 4-8 for computation-heavy code.
Experimental pthread support is only available in Chrome experimental for now
due to the Spectre and Meltdown exploits. And general GPU compute apparently
is really tricky to implement in a secure way, although DOOM does not use it.

~~~
floatboth
> copied from GPU to host memory, compositing is done and then it's copied
> back to GPU

Shouldn't happen with GPU compositing in Firefox (layers.acceleration.force-
enabled), right?

------
lostgame
I’m wondering for kicks if this would run on my iPhone 7S, but I think it
being at the top of HN is terrorizing the download speeds.

~~~
saagarjha
> iPhone 7S

Not trying to be rude, but this phone doesn't exist,

~~~
aerovistae
could be an apple employee testing a new device who briefly forgot himself

------
potiuper
Redistributing game assets like this is legal how? [https://github.com/id-
Software/DOOM-3/blob/master/neo/sys/li...](https://github.com/id-
Software/DOOM-3/blob/master/neo/sys/linux/setup/image/License.txt)

~~~
sneakernets
It's the demo.

~~~
ChrisSD
Do the demo assets have a less restrictive license?

~~~
sneakernets
If you wanted to be pedantic, probably not, but given how easy it is to just
download the shareware version yourself and open the WAD files or whatever,
what's the point? Would be a silly restriction.

~~~
ChrisSD
Sure but it wouldn't be the first time a rights holder sued over a "silly
restriction". If someone wants to take that risk then more power to them but
they should be aware it is a risk unless they have a specific assurance.

------
jdlyga
Is your browser ready for Doom 3?

~~~
brink
More like is Doom 3 ready for my browser? This is taking forever to load.

~~~
torh
But are you keeping up with the Commodore?

------
andreimatei1
Hi Gab_CV, this is really cool! Congrats! Are you planning on writing any
notes about what the port took? You commits are quite clean, but still some
narrative would be really interesting.

------
jk_danson
I haven't played through the demo. But this is very impressive.

------
leowoo91
Took about 10 minutes to download and start, I also had half face rendering
issue + lost some audio play randomly. FPS was low and cpu was hottie but it
worked.

------
km3k
"Site not installed". I think we killed it.

~~~
Gab_CV
Yes, it is dead just now. I guess I have to take another hosting option :)

------
Thaxll
Loading data...

------
LyalinDotCom
Took a long time to download but it does work, really amazed here

------
cm2187
Interestingly it defeats Firefox's disable autoplay videos setting.

~~~
zamadatix
It's not a <video> element.

~~~
cm2187
Yeah, but if it can be done for a game, it can be done for obnoxious
advertising.

------
ndz
404 now

