Doom in your browser
May 31, 2011 9:45 PM   Subscribe

Doom was a classic game, revolutionary in its time. And it took a high-end machine to run it, like a 486 running 25 MHz (ooh! aah!). Times have changed: it's been ported to Javascript, and it will run in your browser.
posted by Chocolate Pickle (47 comments total) 26 users marked this as a favorite
 
This will breed a whole new generation of killers!

Or people who remember when shooting games let you carry more than 2 weapons at a time.
posted by Lovecraft In Brooklyn at 9:50 PM on May 31, 2011 [2 favorites]


I don't know a lot about programming, but I love seeing these previously complex programs/games working in unexpected new ways. However, I was wondering how these "get X to run in a browser" or "get Doom to run on a pocketwatch" feats of programming work. For an example like Doom, is the code just re-jiggered to work within the framework of the browser? Are people finding ways to simplify a game like this down into a logic, or a smaller footprint or a concise set of steps? In other words, are people re-thinking how to create a version of Doom through a new programming language, or are they just adapting the original code to work in a different machine/language?
posted by This_Will_Be_Good at 9:57 PM on May 31, 2011 [3 favorites]


hmmm... didn't work for me - MAC - Chrome
cool concept though
posted by caddis at 9:59 PM on May 31, 2011


couple of script errors in mozFF 3.0.18. then it got running... at 2-3 FPS. Wow, just like back when I tried to run it on my 386 :D
posted by Lukenlogs at 10:00 PM on May 31, 2011 [1 favorite]


it will run in your browser.

It may run in a browser, but it's not running in my browser.
posted by obiwanwasabi at 10:01 PM on May 31, 2011


Neat, but couldn't you have picked more substance for the post than just re-linking a slashdot post?
posted by kdar at 10:01 PM on May 31, 2011 [1 favorite]


Back in the day, Quake was my game. It too can be played in your browser.
posted by munchingzombie at 10:02 PM on May 31, 2011 [4 favorites]


If I find out you misled me and this loads up Java so help me I will shit.
posted by shakespeherian at 10:09 PM on May 31, 2011 [6 favorites]


worked, sort of, in Firefox. The sound was not really working though and that was one of the addictive features of the game - hearing the report of your weapons.
posted by caddis at 10:19 PM on May 31, 2011


BFG FTW
posted by bardic at 10:20 PM on May 31, 2011 [3 favorites]


I just played through E1M1. Some clipping and sound synch issues, and no soundtrack, but I'm suitably impressed that JavaScript has reached the point where it can be targeted by a compiler for Real Code.

This_Will_Be_Good, the /. blurb says "The translation was accomplished using Emscripten, a Javascript backend for LLVM.", so in this case it's more the latter. People are figuring out how to treat browser JavaScript implementations as kind of a virtual machine, and turn other code into something they can run.

By the by, if anyone is jonesing for that soundtrack...
posted by brennen at 10:35 PM on May 31, 2011 [1 favorite]


My browser was certainly doomed when I attempted to play...
posted by smoke at 10:36 PM on May 31, 2011


Ultra-accurate port! Even the motion-sickness headaches are there.

sigh
posted by germdisco at 10:48 PM on May 31, 2011


On a similar note, here is the XNA Game Studio Platformer Starter Kit compiled from C# to javascript (with a brief sample game). This is actually working for me (vs Doom, which didn't). The game is a simple three level proof of concept, but it works pretty well.

If you want to know more, here is the reddit thread, the Hacker News thread, and more about the XNA Game Studio.

Really--compiling things to javascript. Who would have thought?
posted by flug at 10:49 PM on May 31, 2011 [1 favorite]


JavaScript is the new machine code indeed.
posted by kandinski at 11:04 PM on May 31, 2011 [1 favorite]


Who would have thought?

Crazy, sick people, that's who.
posted by ryanrs at 11:07 PM on May 31, 2011 [8 favorites]



Jeez, you can play Quake 3 in your browser, free and clear. Sure, not Javascript, but much prettier.
posted by switchsonic at 11:35 PM on May 31, 2011 [1 favorite]


For what it's worth, Doom ran fine on my 386DX/40, though I did have five megabytes of RAM and a tightly-tuned config.sys.
posted by lantius at 12:12 AM on June 1, 2011 [3 favorites]


By the by, if anyone is jonesing for that soundtrack ...

I believe the soundtrack (and SFX) can also be found with the Doom Roguelike (download the version with sound, of course).
posted by mstokes650 at 12:13 AM on June 1, 2011


Will, the game code remains mostly the same. As the game has been open sourced by id software there are a lot of things you can do with it.

According to the github page, he used a compiler to turn the C code into Javascript. The page mentions it works for C++ as well. With webGL one could probably do fancier things like this bullet physics demo

I can see this tech overtaking Flash as the default web platform for games in the future, but the tech isn't quite there yet for me to jump ship.
posted by hellojed at 12:17 AM on June 1, 2011


I've got this and Rise of the Triad on my iPhone. Sometimes I am amazed.
posted by Splunge at 12:31 AM on June 1, 2011 [1 favorite]


Jeez, you can play Quake 3 in your browser, free and clear. Sure, not Javascript, but much prettier.

Yea, and in my opinion it plays as well or better than the original. I am spectating a game in another tab right now, and despite being different in that it runs on a fancy plugin it is still the best way I've found to get a quick FPS fix.
posted by Lorin at 1:10 AM on June 1, 2011


Crashed not only the tab it was running in, but also the two tabs adjacent to that tab (but not any other tabs). That's different. (Chrome / Ubuntu)
posted by chmmr at 1:12 AM on June 1, 2011 [1 favorite]


This_Will_Be_Good, the /. blurb says "The translation was accomplished using Emscripten, a Javascript backend for LLVM.", so in this case it's more the latter. People are figuring out how to treat browser JavaScript implementations as kind of a virtual machine, and turn other code into something they can run.

Basically the way LLVM works is this:
Language specific compilers turn the input code into an intermediate language.
A common optimiser operates on the intermediate language, this is actually designed as a series of discrete "passes" that can be configured depending on the language and target scenario.
Then an assembler turns the optimised intermediate code into suitable machine code based on target definition files for each processor. In this case, the output "machine code" is javascript.

So to build something like this, all you need to do is write a new backend assembly definition for LLVM, and fix a few I/O issues.

Apparently this took the guy a week to do, part time. If you wanted to improve performance you could do so easily, but this is a great demo of how a fully automated toolchain can get you from nothing to working in an insanely short amount of time.

A chapter from Architecture of Open Source Applications on LLVM architecture.
posted by atrazine at 2:08 AM on June 1, 2011 [3 favorites]


Oh, and they also used Google's Closure JS optimiser on the LLVM output. Ironically, the game doesn't work on Chrome because of an issue with V8 (Chrome's JS engine).
posted by atrazine at 2:15 AM on June 1, 2011


Guys if you're having problems running it just hit F5 for a smoother gameplay experience.
posted by tumid dahlia at 4:30 AM on June 1, 2011


I too make sex noises when I try to open locked doors.
posted by TheAlarminglySwollenFinger at 4:31 AM on June 1, 2011 [5 favorites]


I remember when the fancy, new, top-of-the-line computers at the computer store used to have Doom running on them, to show off their amazing capabilities. I marveled at that mountain scenery outside the compound.

Truly, Javascript has reached 1993.
posted by Jimbob at 4:38 AM on June 1, 2011 [5 favorites]


Then:

c code -> C compiler (machine code) -> 386DX/40Mhz bare metal CPU

Now:

c code -> C compiler (p-code) -> code gen (JAVASCRIPT) -> interpreter (JAVASCRIPT) + JIT (machine code + dynamic web page generator) -> web page renderer (machine code) -> bare metal 2-3Ghz CPU that isn't enough.

This is not something to be celebrating, it's a bear dancing to the tune of the failure of web technology. Why? Because this is the only standard-based way to run Doom in a browser.

Sun and Adobe will be judged harshly by future generations for breaking the web by convincing the W3C that a properly defined low level VM standard is apparently not possible. So what we get instead this is mess, where javascript is opcodes.
posted by vanar sena at 5:32 AM on June 1, 2011 [10 favorites]


Huh? It's Sun's fault no one used Java?
posted by smackfu at 5:42 AM on June 1, 2011


I'm pretty sure we can blame Sun for the crappiness of browser JVMs, since it's not like they provided assistance to people writing OSS JVMs until it was way too late.
posted by vanar sena at 5:46 AM on June 1, 2011 [1 favorite]


I don't want to do it. It's too far. Too far to go back. It can never be the same. I'd play the original "Unreal" again, though.
posted by Decani at 6:08 AM on June 1, 2011


Decani : "I don't want to do it. It's too far. Too far to go back. It can never be the same. I'd play the original "Unreal" again, though."

Ultima.
posted by zarq at 6:58 AM on June 1, 2011


Crashed Safari on my iPhone, but ran pretty smoothly in Fx 5 beta on my 2007-era MacBook Pro. Well, aside from the sound anyway.

I have Doom on CD. (Demo, though, not full... which stinks)

Doom 2 as well (full version).

There is no reason to tell you this other than seriously how many people do you know who have it on retail disc?
posted by caution live frogs at 7:28 AM on June 1, 2011


I'm afraid I have, frogs. And - my God, it's coming back - wads, was it? Lots of wads. On floppy disks, probably.
posted by Segundus at 7:39 AM on June 1, 2011


Jeez, you can play Quake 3 in your browser, free and clear.

Yeah, Quake Online takes the wind out of a lot of sails. It's pretty slick.

Ultima.

Ultima IV
posted by mrgrimm at 7:55 AM on June 1, 2011


> I marveled at that mountain scenery outside the compound.

OMG how badly I wanted to escape from the moonbase and explore the moon.
posted by jfuller at 8:05 AM on June 1, 2011 [3 favorites]


"Built using standard web technologies like Canvas." Isn't Canvas just kind of giving up and saying, "fine, you want to put individual pixels on the screen, whatever, do what you want."
posted by smackfu at 9:03 AM on June 1, 2011


I don't want to do it. It's too far. Too far to go back. It can never be the same.

For me, this is not true, and I'm saying that as someone wary of revisiting old favorites. I got the iPhone version, and that was enough fun that I dug my xbox out of the closet. I had to pry the cd tray open with a knife, but I got the Doom 3 disc in there and played through all of Doom 1 and most of Doom 2, absolutely having a blast.

The reason it holds up well is because there's some really brilliant level design, I think. It wasn't just that it was the most atmospheric game of the time, doing a bunch of things that hadn't been done before, but that it was also really good. And it still is.

I was obsessed with Doom. I once freestyled a spontaneous poem about the rhythm of the shotgun that had my friends applauding. I used to want to make a film called Short Films About Doom that started with the Doom guy in the washroom with shaving cream on his helmet and a razor poised to begin another stroke down one metallic cheek when he gets interrupted by an intruder - an intruder who must be dealt with violently. It got dumber from there. (His only spoken bits were him sing-humming the Doom theme, you know - doooo dee doo de doo dadoodaloopaloopa).
posted by neuromodulator at 9:43 AM on June 1, 2011 [2 favorites]


Isn't Canvas just kind of giving up and saying, "fine, you want to put individual pixels on the screen, whatever, do what you want."

Kind of, but with JAVASCRIPT!
posted by thsmchnekllsfascists at 10:01 AM on June 1, 2011


mrgrimm: " Ultima IV"

It's freeware now, and downloadable online.
posted by zarq at 10:05 AM on June 1, 2011


Isn't Canvas just kind of giving up and saying, "fine, you want to put individual pixels on the screen, whatever, do what you want."

Well, yes. Because sometimes you want individual pixels.

I know, generally, you really should be working at the document level. That works fine... until you're building an application whose reason for existence is to manipulate pixels, or that has a display model that doesn't neatly fit the built-in document concepts. So I think it's pretty nice that there's a native fallback.

I also think the "canvas is giving up"/"you should be working with document-level abstractions" attitude is partially related to the "clipping and sound synch issues, and no soundtrack" complaint. The audio standards seem focused around the idea of playing back one or two pieces of long-ish pre-rendered media. Most implementations seem to have some issues with low-latency or synchronized playback. This means playing lots of bits of audio to what's happening elsewhere is painful and limited, and writing generative stuff arguably more so.
posted by weston at 10:09 AM on June 1, 2011 [1 favorite]


Why? Because this is the only standard-based way to run Doom in a browser.

But see NaCl (as summarized here).

Basic idea (as I understand it): C/C++/ code gets compiled to a subset of x86 that has the additional property that it can be verified by the browser at load time. As such, you can write browser-side applets in C and they will be perfectly sandboxed with almost no performance hit.

There's some really interesting stuff in the pipe these days.

posted by suetanvil at 12:28 PM on June 1, 2011 [1 favorite]


Well, yes. Because sometimes you want individual pixels.

Right. Just reminds me that we are basically at QBAsic levels of code sophistication. Like 1993-ish. In fact, I bet Javascript benefits from a lot of the tricks that made Doom fast on non-FPU systems.
posted by smackfu at 12:49 PM on June 1, 2011


Huh? It's Sun's fault no one used Java?

I'm honestly not sure who else to blame for Java in the browser (which was all the Java most people were exposed to during the Era Of Java Hype) sucking so god damned hard, although on reflection I imagine there is blame to be shared with browser vendors.

Right. Just reminds me that we are basically at QBAsic levels of code sophistication. Like 1993-ish. In fact, I bet Javascript benefits from a lot of the tricks that made Doom fast on non-FPU systems.

Well, except not really. I mean, yes, one might be spraying pixels around in canvas. But one's also doing it in the context of a globally accessible, mostly open hypertext network full of rich media, inside of a "document" model that supports enough interface & structural primitives that it's rapidly supplanting almost every other interface layer as a target for new applications, while somehow remaining simple enough that your average sixth grader could probably be taught the basics.

QBasic might not be the worst metaphor here, in terms of how simple a lot of the simple stuff is (and things like canvas are pushing it more that direction), but along a certain axis of complexity and sophistication and powerful abstraction, things have gotten one helluva lot more ramified.
posted by brennen at 1:15 PM on June 1, 2011


Not trying to miss the point there or be really argumentative. I just feel like the context makes a lot of difference.
posted by brennen at 1:22 PM on June 1, 2011


Works fantastically in Firefox Nightly. Chromium is a no-go, or I didn't wait long enough.
posted by tatma at 5:35 PM on June 1, 2011


« Older The Wikipedia of symbology.   |   "The girls who were detained were not like your... Newer »


This thread has been archived and is closed to new comments