Classic PC demoscene productions running natively in the browser

(treylorswift.github.io)

61 points | by adunk 3 hours ago

11 comments

  • Retr0id 1 hour ago
    > The demo is run on an x86 emulator that records every block of code the CPU actually executes, over the whole demo.

    > That recording is translated into C - the original instructions, one for one, with the exact cycle timing of the emulated machine.

    What's the advantage of this approach vs cycle-accurate emulation? (I'd guess it can go faster, due to compiler optimization?)

    > The result is checked against the emulator event for event: every interrupt, port access and frame at the same moment of emulated time.

    It's funny how LLMs leak their test procedure docs into user-facing output.

    • bananaboy 11 minutes ago
      > What's the advantage of this approach vs cycle-accurate emulation? (I'd guess it can go faster, due to compiler optimization?)

      I don't think anyone is doing it this way because they chose to do it this way. All the AI decomp/recomp projects I've seen recently have done it this way. It just seems an easy way to have an AI brute force "port" something.

    • vardump 58 minutes ago
      Cycle accurate emulation helps little with this era PC demos, because back in 1993 PC hardware performance variation was already massive. From 386SX-16 to Pentium 66 MHz, that's over 20x difference in performance.
      • dspillett 5 minutes ago
        > Cycle accurate emulation helps little with this era PC demos

        It works, and has done for some time, surely. What more is there to add here above accurate playback?

        > From 386SX-16 to Pentium 66 MHz, that's 10-20x difference in performance.

        Yep, and some demos had specific requirements for not only minimal CPU but maximal because the assumptions inherent in small-code timing tricks would break beyond a certain speed or because of significant differences in relative instruction execution times (and sometimes the unpredictability of those execution times as the P5 architecture and some of its frankenstein-486-like competitors added branch prediction).

        But cycle-accurate emulation has this sorted to: you just need the accuracy to be matching a particular CPU running to the pace of a particular clock. And given the description of how this is being done (“The demo is run on an x86 emulator that records…”) I assume this is actually using cycle-accurate emulation!

        I'm guessing the benefit here is that the overhead of playing back the demo on each client machine is lower when playing back this recorded version, compared to each viewer's browser running the initial emulation live. That and doing something a new way was fun or otherwise intellectually stimulating for the dev(s) involved.

    • rmnclmnt 41 minutes ago
      > It's funny how LLMs leak their test procedure docs into user-facing output.

      You have to constantly fight so hard to not get this. And for the past few months it seems most people do not even care to remove it and have proper user facing docs

      • dspillett 30 minutes ago
        > You have to constantly fight so hard to not get this.

        By “fight so hard” you mean “do a bit of basic editing before publishing the text”?

        You wouldn't have thrown a junior's text straight at end users without any review in the past (at least I hope not, though obviously some teams actually were and still are that lax), why do you expect to get away with skipping the review/edit step with your clockwork colleague?

        • Sharlin 26 minutes ago
          Because we expect a junior colleague to learn from feedback and not have to fix the same problems in their output year after year.
      • christophilus 39 minutes ago
        I didn’t notice it when using Codex. Recently switched to Claude to test Opus 5.5, and it is constantly adding useless commentary.
        • rmnclmnt 35 minutes ago
          I don’t think that’s specific to Claude though. I’ve seen people use GH Copilot harneds (don’t with which models) and it was even worst
  • Martin_Silenus 28 minutes ago
    The days I gave up with demoscene. When PC killed Atari ST and Amiga scene (sorry to put you after amiguys, but life was always easier for you ;) ), all the magic of fixed hardware without tons of Mhz and RAM, when we were running after that cathode ray which wouldn't wait, exploiting hardware bugs to break those damn borders above, below and sideways, spending hours turning my head upside-down to read unreadable scrolltexts, looking at psychedelic plasma effects with bazillions colors...

    Then I betrayed you all: I bought my first ugly machine because of Doom. I was so ashamed...

    Now, only 4KB demos can at least impress me a bit.

    Feeling old.

  • meerita 7 minutes ago
    It's quiet amazing how much people did with 4kb, 64kb demos.
  • Sharlin 38 minutes ago
    If there’s no human effort behind this, what’s the point? You could just as well watch any of the zillions of video recordings of these demos. There’s no inherent value in "running natively in the browser". Never mind the vast irony in demoscene specifically being a celebration of human skill and creativity.
    • Karliss 18 minutes ago
      Not going to say anything about AI translations. But the video recording don't do justice for many of demos.

      The effects in some of the demos simply kill any video encoder, only way to properly experience them is by running or emulating locally. Not that crystal sharp upscaled square pixels on modern display or poor quality CRT filters are very representative either, but it's likely better than blurry mess you get when video encoder tries to deal with high frequency details or random noise from procedural effects.

    • Retr0id 32 minutes ago
      Well, there is a little advantage. Most recordings are not at the native framerate, and have compression artefacts (which impacts some effects more than others)
      • bananaboy 10 minutes ago
        I mean even these browser ports aren't at the native framerate. The native framerate for these demos was 70hz as they were all designed for VGA video modes.
  • joking 16 minutes ago
    bufff.... the music from second reality still gives me goosebumps.
  • gritzko 1 hour ago
    So much fun. I recently ported some old strategy games. Claude does it almost on its own http://replicated.live/blog/games
    • 1313ed01 1 hour ago
      Lots of talk of DOS, but both games that are described (Panzer General II and Imperialism II) were only released for Windows?

      If the games had been for DOS, it would probably have made more sense to just run the original binaries in DOSBox-X or some other emulator. I think there is already some debug API that can be enabled. Or adding MCP or something similar to DOSBox(-X) would probably be a lot less work than to reimplement the games.

      • gritzko 41 minutes ago
        Ah, yes, sorry. At this point, XP and DOS are almost synonymous for me.

        The entire point of the port was to add headless play for AI training. But porting the old interface and playing it in the browser was lots of fun. Can not upload that to GitHub, obviously.

        • chriswarbo 29 minutes ago
          > At this point, XP and DOS are almost synonymous for me.

          IIRC Windows 9x & ME were based on (MS)DOS; but 2k and XP were based on NT, which was quite different.

          (Note sure what those differences actually are, since I only started programming once I'd switched to Linux...)

          • bananaboy 8 minutes ago
            That's correct. Personally as an MS-DOS retro enthusiast and programmer I don't know how anyone could call XP and DOS synonymous!
    • cyclopeanutopia 1 hour ago
      So who or what ported them?
      • dspillett 36 minutes ago
        It is true what people say wrt using agentic development being like being a manager: you take an idea from elsewhere (a lot of game porting is happening right now), describe it to someone else who will do the hard work while you relax, and then at the end you as the team lead/manager claim all the credit.
      • gritzko 43 minutes ago
        Opus 5.5.
  • soltanov 1 hour ago
    Tracing the execution path and baking cycle-exact hardware state directly into C/WASM is clever engineering; it bypasses runtime emulation overhead entirely.
  • vrganj 1 hour ago
    This kind of made me sad.

    The demoscene was all about human ingenuity getting the most out of the machine. It was about showing off how good your crew was at making things from nothing but their minds.

    Now, it too, has been swallowed by the AI that is destroying this entire mode of being, the joy and creativity of writing code, of solving seemingly-impossible puzzles with ones mind.

    My favorite creative and intellectual outlet is dying off and its killer is wearing its corpse as a costume.

    • GuB-42 1 minute ago
      What makes you say this? Just because someone used AI to port some classic production to the browser (which is actually pretty cool), doesn't mean that AI has taken over.

      AI slop productions tend to be frowned upon, or even banned, writing code and using cool tricks to to what seems impossible is still a big part of it, in particular in the sizecoding, oldschool and wild categories. Clever use of AI is a debated topic, the demoscene is about pushing the limits of current technology, and AI is part of current technology. There is also the question of using AI for tooling (modelers, compressors, test harnesses, etc...), as in, will you stop using a particular IDE because it is written with the help of AI?

      But still, most productions are hand made.

    • mrweasel 55 minutes ago
      For these four demos I don't know, but part of the challenge was certainly working within the constraints of the machines of the day. The Furture Crew demo I believe comes in at 2.5MB and ran on a 1993 PC, so probably 8MB of ram at the most. Running it in the browser is probably at least 20 times the memory.

      It's really cool to be able to rewatch these demo, but the spirit in which they were created is somewhat lost.

      • KellyCriterion 20 minutes ago
        > probably 8MB of ram at the most. Running it in the browser is probably at least 20 times the memory.

        lol, that would be 160MB then, a fraction of what a Firefox Tab consumes and in todays hardware specs its a roundoff error :-D

        (while back then you were the ultimate king if you had 8 MB of RAM available at all! :-)

    • sgt 44 minutes ago
      Who's going to show up to the next big demo party (like the ones they arrange in Europe), having e.g. hand coded 68k assembly or done some highly impressive 4k demo, having been intimate with every single instruction?
      • bananaboy 7 minutes ago
        Uh, many people. There are plenty of demo parties with retro categories in the compos, and plenty of people still interested in writing their own code for those platforms.
    • pona-a 50 minutes ago
      Maybe it will just pass? Eventually maybe people will get bored of this consumerist mode of creation, of projects born with no vision or craft, made with the tastefulness of a kid smashing together their favorite toys. And when the majority finally agrees these stunts are a corrosive influence on the community, we can just approach it as a moderation problem, figure out some system of vouches and reports, or downsize and our communities until trust again becomes tractable, maybe even coming to appreciate some tactical slop as a stepping stone or a proof of concept to be eventually reverse-engineered into a maintainable human project.
    • plastic-enjoyer 1 hour ago
      It's the eternal sloptember, but for humanity.
      • blackhaz 1 hour ago
        Or an eternal heaven, our every wish coming true. The next iteration of homo sapiens will not be thinking how to do things, but what things to do. Is this the new creative space for us?
        • vrganj 57 minutes ago
          But the thinking is the valuable and meaningful part. I don't want it monopolized by a few megacorps, sterilized and devoid of human touch, only thinking of things that said corps find acceptable.

          We'll get unlimited frozen pizzas, but we'll kill off chefs in the process.

          It's not a trade I'm feeling good about.

  • melicerte 22 minutes ago
    How to skin a cat...
  • Wittie 14 minutes ago
    [dead]
  • Krisso 58 minutes ago
    I'm all for this future. Let's remove the tooling and let true creativity and diligence be what we appreciate and marvel at. If we can instruct AI well enough, it can eliminate the plumbing layer entirely, allowing us to focus on what truly matters.

    Those demos from the '90s remind me of the incredible creativity and ingenuity of the human mind. Thanks for bringing them back to life and making them so effortlessly accessible.

    • Sharlin 46 minutes ago
      Hilarious.
    • treylorswift 37 minutes ago
      You're welcome! These demos blew my mind in the early 90s and they still do today. Glad you enjoyed them!