Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Games

Doom Ported To the Web 248

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.
This discussion has been archived. No new comments can be posted.

Doom Ported To the Web

Comments Filter:
  • 8 fps, and that's on an older work laptop without a fancy graphics card and loaded with lots of crap in the background.

    • 4 to 5 fps ("full screen" with menu bar) on Intel 8400/nVidia 9800M GTS, Ubuntu 10.4.
      Mybe ripping Joe Jackson in the background slows things down. :-P
      • Re:Not bad (Score:5, Informative)

        by KiloByte ( 825081 ) on Tuesday May 31, 2011 @03:15PM (#36301108)

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

        • by asylumx ( 881307 )
          Hmm I'm pretty sure the original didn't have strafe, either.
          • Wolf3D didn't have dedicated keys for strafe (only Alt-direction), Doom had both dedicated and alt, bound to comma and dot by default. Since it is vital to be able to turn all the time, you can't afford to use alt strafe in a fight. It's only for abusing the double-strafe bug.

        • Re:Not bad (Score:4, Informative)

          by kripkenstein ( 913150 ) on Tuesday May 31, 2011 @03:37PM (#36301336) Homepage

          However, without such basic controls as strafe, this demo is not playable.

          Actually strafe works, hold down alt.

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

          Alt=fire? You must have some strange, deformed hands. Clearly Ctrl should be fire.

          The rest is okay.

        • by SiMac ( 409541 )

          Graphics card doesn't make a difference because it presumably doesn't use WebGL. Browser makes a huge difference because Firefox 4+ has typed arrays, whereas Firefox 3.5 doesn't.

        • by tibit ( 1762298 )

          For me, everything works at ~35fps on latest Safari on OS X. Strafe, running, jumping, automap, door opening, etc. Only thing that doesn't work is sound. Make sure you focus the canvas (just click on it).

        • yeah, I got 30fps on a 2007 1.83 Ghz macbook using Safari. (integrated graphics 0.o) gotta love it.
          • I get about 35 fps under Safari on my late 2009 MacBook Pro 17" (Core 2 2.8Ghz with a 9600m) with my CPU usage pegged at about 97%. The game window is only 640x480.

            Now on the other hand, the Flash port of Doom runs noticeably better and only uses about 25% CPU when running full screen at 1920x1200 on my Mac.
    • by basotl ( 808388 )
      Just was testing and that's about what I was getting on my NookColor. Though the lack of a physical keyboard was an issue... I just wanted to check if it would run at all.
    • by blair1q ( 305137 )

      I got 8 FPS on a rather well-dressed machine.

      JavaScript is nobody's first choice for code.

      • Can't be that well dressed. I'm getting 35.
      • 8 fps? Your phone is awesome then, I'm getting only 2.8 fps on mine. Oh, wait, you meant a regular computer?

        (2.8 fps in the start room of EP 1, in busy rooms it gets down to ~1.1 fps. And the sound, well, let's skip it.)

      • 8 FPS? Are you using IE? I was getting 30-40 FPS on a crappy years-old work laptop using Opera. The CPU was chugging and made all of the fans turn on, and some textures were flickering, but it ran smoothly the entire time. The menu was only running at about 5-6 FPS though.

      • by Surt ( 22457 )

        Your poor fps is almost certainly browser choice. Try a cutting edge release and see if you don't pick up a 5x improvement.

        • by blair1q ( 305137 )

          Probably this. I don't control the SW load on this box, so it's a rev or two behind on Firefox.

    • 45fps on an almost 4 year old MacBook Pro with Core 2 Duo 2.4GHz.

      I'm not quite sure that Doom used 170MB of memory, which JS alone is using in the tab.

    • On an 8-year-old laptop, with 1.6GHz Pentium M:
      Opera: 8fps
      Firefox: 4fps
      Chrome: unresponsive
      Mind you, these results were just for viewing the static slides of the introduction. The game refused to play, giving a perpetual message loop saying "Demo is from a different game version!". Clicking on the "NEW GAME" menu item had no discernible effect.
      • You are doing it wrong, it's not GZDoom.
        You just use the keyboard to pick stuff. Use the arrow keys to move, enter (control?) to accept, space to open doors, control to fire.

        • You are doing it wrong, it's not GZDoom.
          You just use the keyboard to pick stuff. Use the arrow keys to move, enter (control?) to accept, space to open doors, control to fire.

          Thanks for the tip on keyboard use (wow, I'm not exactly a youngster and still only tried the mouse). I got 33-35fps in Opera 11.11 while running around shooting things. Of course, the game resolution sucks a little bit and looked small on my display, but it was actually sort-of playable on ancient hardware.

          Laptop: 8 year-old 1.6GHz Pentium M, with 1GB RAM and 1920x1200 Radeon 9600, running Lubuntu 10.04 LTS.

  • 34FPS on average. The only problem is the sound quality is really bad. Like, really, really bad.

    • Same here. And the canvas occasionally loses the focus, causing the browser to fal back to its regular behavior (e.g.space=scroll).

      But it's still an impressive demonstration.

  • Progress (Score:5, Insightful)

    by Anonymous Coward on Tuesday May 31, 2011 @02:56PM (#36300876)

    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.

    • Have you seen the specs required for the latest Worms game? See the bottom of http://store.steampowered.com/app/22600/ [steampowered.com] for the list. 1Gb RAM and a little over 2Gb of disk space required?! The backgrounds and sprites can't be *that* much more numerous and higher resolution can they? Needing a beefy machine to run Doom via C-compiled-to-JS-running-via-JIT-compile-bytecode doesn't seem so ridiculous when you consider that "Worms Reloaded" is running native.
  • by empiricistrob ( 638862 ) on Tuesday May 31, 2011 @02:56PM (#36300882)
    While this is impressive, it has been done before (and better): GWT Quake [youtube.com]
    • by kripkenstein ( 913150 ) on Tuesday May 31, 2011 @04:09PM (#36301742) Homepage

      While this is impressive, it has been done before (and better): GWT Quake [youtube.com]

      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.)
    • by MobyDisk ( 75490 )

      Depends on how you define "cool" - this is very different from what GWT Quake did. GWT quake is port of Quake 2. This was created by recompiling the Doom source. Granted, Doom didn't originally use SDL, but I suspect it is much closer to the original source than what GWT Quake was. The ability to take unmodified C/C++ and compile it to Javascript is fundamentally amazing.

      Take a look at their how-to [mozilla.org]

  • by kevinmenzel ( 1403457 ) <kevinmenzel@@@gmail...com> on Tuesday May 31, 2011 @02:58PM (#36300910)
    So... no music, and the sound effects are like a half second delayed from the action, AND they sound really REALLY bad. I guess it's impressive what you can do visually with Javascript these days, but at least on my setup, the sound is just.... no where near as mature. That's probably not a huge problem for many people, but personally sound is a huge part of any experience for me, and I find the web constantly disappoints. Except, generally for Flash animation/Flash games which seem to have at least gotten THAT... well, MORE right.
    • Re:Sound is abysmal (Score:5, Interesting)

      by kripkenstein ( 913150 ) on Tuesday May 31, 2011 @03:39PM (#36301366) Homepage

      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.

  • by Anonymous Coward

    Here's the link: http://www.newgrounds.com/portal/view/470460, plus: it does run with a higher framerate.

    • And that version runs faster, renders better, and has better sound.... AND it doesn't make every fan in my computer speed up to the point where I think I'm playing doom on a jet engine. Still not perfect (Gosh, native code runs better than code through a browser, who'd have thought?) but it's better than the JS version by leaps and bounds. Or it would be if you could jump in Doom.
  • by davidbrit2 ( 775091 ) on Tuesday May 31, 2011 @03:08PM (#36301038) Homepage

    I mean, it's a cool accomplishment in terms of implementation and all, but...

    Ughhhhhhhhhh.

    • Its not ughhhh. Its old... :-) You should look what lies behind the bad graphics: playability, balance, level design, enemy design, etc. IMO, this game has some of the best level designs in game history.
  • Port the iOS APIs and run apps from any webhost. Obviously there would be limitations but I wonder what Apple could do about it.
  • by Jailbrekr ( 73837 ) <jailbrekr@digitaladdiction.net> on Tuesday May 31, 2011 @03:12PM (#36301072) Homepage

    "Just because you can, doesn't mean you should"

  • Flash handles this just fine on my MacBook Pro(Core 2 9600m) full screen(1920x1200) using about 25%, where as this JavaScript version crashed Chrome at 100% CPU, then under FireFox sucked up 60% of my CPU for a little 640x480 box that could barely maintain 17fps... And the sound was completely jacked.

    Never the less, a cool show and they can say they've done it, but thankfully this isn't our only only option.
  • This is one of those, "Just because you can, doesn't mean you should" kind of things.

    Seriously, many Doom sourceports are doing it wrong, including this one. The thing is, Doom used fixed point math to simulate floating point -- now our on-chip float calculations are way faster than the code required to emulate them (that Doom uses).

    Additionally: JS does not have any numbers except 64 bit floats! Bitwise math works on the lower 32 bits of the 52 bits of precision that the floats have available, and r

    • by h4rr4r ( 612664 )

      ARM machines are not so great at floating point, so that might not be true outside of desktops.

    • by mbrubeck ( 73587 )
      Note that Alon Zakai, who published this demo, is also the person who wrote the Emscripten LLVM-to-JavaScript compiler. So I think he does deserve a cookie. :)
  • What took em so long??
  • I am a raging fan of Doom (which I keep playing via source ports to this date), and this is a great experiment, however...the sound is abysmal, and I am too used to modern controls to go back to arrow keys :P
    The FPS was OK for me, 20-30, but the sounds....sounded like...flatulence and a 2yo kid with very deep voice being recorded right next to the microphone.

    Doom is not terribly complex by modern standards, but the browser struggles to get it moving (probably because of video rendering, not sure if webGL ca

  • I loaded this up on my home server and tried it from two different systems.

    System 1 - RHEL5 8 cpu 48g RAM - Java(TM) Plug-in 1.6.0_20 - 7-8fps
    System 2 - WinXP 1 C2D cpu, 4g RAM - Java(TM) Platform SE 6 U22 - 35-45fps
    System 2 wins. Graphics card unimportant as this isn't a 3D accellerated application. Not sure why the discrepancy is what it is, but whatever.

    Sound does suck.
    • This doesn't use Java, it uses Javascript and parts of HTML 5 (canvas, audio, etc).

    • by afidel ( 530433 )
      It's javascript not java, so your browser version matters, something with a JIT compiler from the last 6 months will probably be able to display it at 30+fps (except Chrome, it doesn't render at all in either current or beta).
      • It's javascript not java, so your browser version matters, something with a JIT compiler from the last 6 months will probably be able to display it at 30+fps (except Chrome, it doesn't render at all in either current or beta).

        Ahh, gotcha. Yea my RHEL5 system is running Firefox 3, my WinXP box is running Firefox 4.

    • Amazing... Over a decade and a half and even tech-heads still get this wrong.

      I did a "RESTful webservices in java" course the other day and the instructor felt it necessary to point out that JavaScript was not Java despite the fact that you had to have years of Java experience to even register for the course.

Never test for an error condition you don't know how to handle. -- Steinbach

Working...