Slashdot Mirror


Doom Ported To the Web

kripkenstein writes "Ever since Id Software released the Doom source code under the GPL, it's been ported to platform after platform. Now, you can play Doom compiled to JavaScript on the web, using standard web technologies like Canvas and without any plugins. If your browser has trouble running it, here's a screencast." The translation was accomplished using Emscripten, a Javascript backend for LLVM. As per the GPL, full source code is available. Pretty neat.

8 of 248 comments (clear)

  1. Progress by Anonymous Coward · · Score: 5, Insightful

    So instead of a 40MHz 486 and 8MiB of EDO RAM, we now require at least a 2,5GHz dual core with 1GiB of DDR3 SDRAM to accomplish the same thing on a web page.

  2. Re:Wow by Necroman · · Score: 4, Informative

    If you want real graphics performance out of a browser, you should be using WebGL (assuming Flash is not an option). WebGL lets you execute OpenGL code on the video card of the machine, which will be a ton faster than Canvas.

    You have to remember that Canvas is just an image rendering platform. From my understand of Canvas in Firefox, it actually renders every frame as a PNG and displays it to the screen. There is no GPU acceleration. That's what WebGL is fore.

    --
    Its not what it is, its something else.
  3. Re:Not bad by KiloByte · · Score: 4, Informative

    Video card hardly makes any difference, browser does. 35 fps full-screen on Firefox 7.0a1, 34 on Firefox 4.0, slideshow on Firefox 3.5. This is on a cheap-ass 2.8Ghz Phenom II. It uses no OpenGL, about any graphics card can handle shoving such bitmaps around. It's single-threaded, too, so what you're ripping on your other cores doesn't matter.

    However, without such basic controls as strafe, this demo is not playable. No mouse input hurts but DOS versions had unusable mouse anyway so it's just a throwback to the old times. I estimate I've clocked around 4000 hours those days so I'd cope :p Heck, even comma/dot might be acceptable if they don't want to allow redefining keys, although I'd really prefer a sane setup like Z/X=strafe, alt=fire, shift=run (assuming no autorun like in the original).

    --
    The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
  4. Re:Sound is abysmal by kripkenstein · · Score: 4, Interesting

    So... no music, and the sound effects are like a half second delayed from the action, AND they sound really REALLY bad.

    I agree, the sound is terrible, sorry about that. I don't know much about how sound stuff works, that is the best I could do in a few hours of hacking something together with the Audio Data API.

  5. Re:Is it just me... by Nimey · · Score: 4, Informative

    No. My 486SX-25 would run Doom at 20-some FPS (mainly dependent on how many monsters were within visual/acting range), and after an upgrade to a DX2-50 Overdrive it would usually be 30-something -- and the original DOS executable had a hard limit of 35 FPS.

    Don't forget this is running as interpreted code in what amounts to a virtual machine.

    --
    Hail Eris, full of mischief...

    E pluribus sanguinem
  6. Re:This proves the old adage by david.given · · Score: 4, Informative

    "We do what we must, because we can."

  7. Re:Not as cool as GWT Quake by kripkenstein · · Score: 5, Informative

    While this is impressive, it has been done before (and better): GWT Quake

    I think that Quake demo is awesome! I'd just like to mention though that this Doom demo is very different from a technical standpoint, and I think both are interesting:

    • The Quake demo compiled Java to JavaScript using GWT, the Doom demo compiles C through LLVM into JavaScript using Emscripten.
    • The Quake demo uses WebGL to render, the Doom demo translates a 100% software renderer. It's much more challenging to get good performance with a software renderer in JS, especially given that the original renderer was heavily optimized for the CPUs of the day (for example, it uses fixed-point math).
    • The Quake demo was a major effort, with rewriting and fixing. The Doom demo is a straightforward port, no new code (only a few tiny tweaks), took only a week to do. (Btw, speaking of the timetable, sorry for the sound quality - I just spent a few hours on that part, and I had never used the Audio Data API before.)
  8. Re:Is it just me... by shutdown+-p+now · · Score: 4, Informative

    No, it's not bytecode. Most (all) modern JS engines actually JIT-compile to native code.

    It's still slower than C version simply because native code doesn't mean fast - if it has to do dynamic dispatch over method names, for example (because the compiler couldn't infer types deep enough), it's still slower than a direct or virtual call.