CSS is DOOMed (nielsleenheer.com)

by msephton 111 comments 506 points
Read article View on HN

111 comments

[−] sheept 48d ago
Creating 3D scenes with CSS has always been possible[0], but like this project, it's required JavaScript for interactivity.

But there's a lot more CSS features now. While in the past, Turing completeness in CSS required humans to click on checkboxes, now CSS can emulate an entire CPU without JavaScript or requiring user interaction.[1] So I wonder if DOOM could be purely CSS too, in real time.

[0]: https://keithclark.co.uk/labs/css-fps/ [1]: https://lyra.horse/x86css/

[−] captn3m0 48d ago
The author links to th CSS x86 project:

> Yes, Lyra Rebane build a x86 CPU completely in CSS, but that technique is simply not fast enough for handing the game loop. So the result is something that uses a lot of JavaScript.

[−] rebane2001 46d ago
(author of x86css)

not only do i think doom in css is possible, but both me and another css person were also planning on actually making it into reality

but it sort of feels demotivating to see js-powered css projects like this hit the frontpage, because if we do eventually make a css-only doom people will think its a repost or nothing special

edit: and to be clear, that demotivation is more of a problem of how the internet, virality, and news cycles work. the actual project here is still pretty cool!

[−] inopinatus 48d ago
I feel obliged to repeat my assertion that this evolution of CSS was inevitable and foreseeable and that the HTML Editorial Review Board should’ve chosen DSSSL in the first place.
[−] h1fra 48d ago
So impressive! Bonus, you can wall hack by just deleting a div ahah
[−] ehsankia 48d ago
Even better, since everything is well organized, you can add opacity: 0.7 to .wall specifically, and get something that looks almost exactly like how old school wallhacks looked like.
[−] hjkl0 48d ago
Is that a Doom reference? What’s a wall hack? How did it look?
[−] codethief 48d ago
A wall hack is any technique allowing the player to see opponents through walls. Googling for screenshots or videos should give you a good idea of how it looks.
[−] throwaway290 48d ago
I mean they literally just told you...
[−] yourapostasy 48d ago
While standalone CSS is not yet Turing complete, I worry about the new attack vector categories opened up by moving it towards that state. Already I believe attackers have a choice to spread the attack payload between CSS, HTML and JavaScript to evade current detectors and analysis at the network borders, and evade CSP's since we're well into undecidability territory, like using CSS attribute selectors if the CSP allows external images or fonts. But I'm far from proficient at web browser red teaming. Is this worry unfounded?
[−] codethief 48d ago

> While standalone CSS is not yet Turing complete

Looks like it is, though? https://news.ycombinator.com/item?id=47558097

[−] yourapostasy 46d ago
Oh yep, looks Turing complete just not performant enough for that use case. But that’s not an issue for APT-style attacks that take their sweet time. So am I off base here?
[−] rkagerer 48d ago
But where can I try it out in my browser?

EDIT: https://cssdoom.wtf/

[−] bethekidyouwant 48d ago
It works perfectly in Safari on mobile. this never happens.
[−] _fzslm 48d ago
My phone IMMEDIATELY got toasty as I started moving around the world :')
[−] TeMPOraL 48d ago
Never tried Doom on a phone before, this one is surprisingly fluid and very playable.
[−] nine_k 48d ago
Works smoothly in Firefox. But the default key mapping is busted: fire at Alt means that it opens and closes the menu in Firefox with each press. Also, Alt + left arrow ends the game and goes back in history.

Interestingly, it was more choppy in Chromium.

I could not find a key for moving sideways ("strafing").

All in all, quite mind-boggling.

[−] lights0123 48d ago

> Interestingly, it was more choppy in Chromium.

Firefox's WebRender is truly a great creation. While Chrome is faster at most things especially involving JS, Firefox puts so much of its rendering on the GPU so moving elements around is incredibly fast.

[−] ranger207 48d ago
Strafing is implemented on A and D at least, but having one hand on the arrows to turn and WASD to move is a bizarre mix of modern and original controls
[−] edoceo 48d ago
There are some new key-trap ApIs that can handle that, IIRC FF don't handle that part as well as Chrome.
[−] Roshan_Roy 48d ago
This feels like one of those “because we can” projects that accidentally reveals where the platform is going.

CSS started as purely declarative styling, but between things like conditionals, math functions, and now these rendering tricks, it’s slowly creeping into “programmable system” territory. Not because it’s the right tool for it, but because browsers are becoming the real runtime. The interesting question isn’t “can Doom run in CSS”, it’s how much logic we’ll keep pushing into layers that were never meant to handle it.

[−] rhdunn 48d ago
The question is really about where the boundary between presentation (CSS) and interactivity (JavaScript) lies.

For static content like documents the distinction is easy to determine. When you think about applications, widgets, and other interactive elements the line starts to blur.

Before things like flex layout, positioning content with a 100% height was hard, resulting in JavaScript being used for layout and positioning.

Positioning a dropdown menu, tooltip, or other content required JavaScript. Now you can specify the anchor position of the element via CSS properties. Determining which anchor position to use also required JavaScript, but with things like if() can now be done directly in CSS.

Implementing disclosure elements had to be done with a mix of JavaScript and CSS. Now you can use the details/summary elements and CSS to style the open/close states.

Animation effects when opening an element, on hover, etc. such as easing in colour transitions can easily be done in CSS now. Plus, with the reduced motion media query you can gate those effects to that user preference in CSS.

[−] dgb23 48d ago
The design of CSS has always been weak IMO. What we needed were general, simple primitives that can describe layout relationships and a compositional layer that includes some common defaults.
[−] titzer 48d ago
It's abstraction inversion at its finest. Declarative styling sounded like a good idea, but it jumped the shark long ago. It's begging to become a real programming language but for some reason the design ethos behind CSS seems to have been avoiding programming at all costs--maybe that's to keep the browser renderer in control (and hopefully responsive), maybe it's because they didn't want designers to have to learn to program, maybe they just hate JS. Whatever the reason, it's clear that CSS took a wrong turn and mutated into absolutely the wrong abstraction.
[−] efilife 47d ago
LLM generated comment
[−] ticulatedspline 47d ago
My first thought along these lines was "do I now need a NoCSS plugin along with NoScript"

at what point is CSS powerful enough to become a malware vector.

[−] pverheggen 48d ago
Seriously impressive, especially the viewport culling trick, not seen that one before.

FYI if you want to use inspect element, the viewport div consumes mouse elements, you can get rid of this with

  #viewport {
    pointer-events: none;
  }
  #viewport * {
    pointer-events: initial;
  }
[−] b0ner_t0ner 48d ago

    IDDQD
and

    IDKFA
did not work unfortunately.
[−] ec109685 48d ago
Great example as to why people are yearning for CSS in TypeScript. Something as simple as if() only works in Chrome and there's not a good shim story for CSS versus a more complete language, so you end up with this:

> The problem: CSS can compute a number – 0 for visible and 1 for hidden – but you can’t directly use that number to set visibility. There is a new feature coming to CSS that solves this: if(), but right now it only just shipped in Chrome.

> So I used a trick called type grinding. You create a paused animation that toggles visibility between visible and hidden. Then you set the animation-delay based on the computed value to determine which keyframe is used:

  animation: cull-toggle 1s step-end paused;
  animation-delay: calc(var(--cull-outside) \* -0.5s);

  @keyframes cull-toggle {
    0%, 49.9% { visibility: visible; }
    50%, 100% { visibility: hidden; }
  }
> A negative animation delay on a paused animation jumps to that point in the timeline. So a delay of 0s lands in the visible range, and -0.5s lands in the hidden range. It’s a hack, but a functional one. When CSS if() gets wider support, we can replace this with a clean conditional. ```
[−] jsjsjxxnnd 48d ago
In recent years CSS has become closer to a full programming language through experimental features, for example in 2025 they added if statements and some math functions like modulo

https://www.simplethread.com/new-and-upcoming-css-features-i...

[−] amelius 48d ago
The only thing missing is the ergonomics of a real programming language.
[−] cafebabbe 48d ago
I like the declarative nature of it. It makes it so easy to debug anything, with "simple" introspection tools. I feel that many horrors will be created when we introduce control flow to CSS.

And this project kinda show how far you can go, still, if you really want it :D

[−] senfiaj 48d ago
It's not just closer. Someone wrote an x86 emulator with CSS (it uses JS only for clock to make it more reliable). https://lyra.horse/x86css/ . So, CSS is officially Turing complete (which is a bit scary IMHO).
[−] 0x737368 48d ago
With how these things are going, soon hackers will be challenging themselves to run Crysis on calculators and microwaves
[−] oopsiremembered 48d ago
I think we're going to get to the point where AI will try to run Doom on humans.
[−] OrangePilled 48d ago
This page could use some "Practical CSS scroll snapping": https://css-tricks.com/practical-css-scroll-snapping/
[−] division_by_0 48d ago
I was amazed when I first came across CSS scroll snapping. It's great for creating immersive experiences where one part of the page fills the entire screen while native browser scrolling still works.
[−] OrangePilled 48d ago
When done right, I oddly find it immersive too. But know some people aren't fond of scrolling being tampered with.

The post here could really use it though. The main content is pushed to the bottom of the page!

[−] division_by_0 48d ago
Yes, and in most cases it's perfectly valid not to interfere with scrolling. The nice thing about CSS scroll snapping is of course that the browser still handles it (instead of it being taken over by JS).
[−] ogghostjelly 48d ago
Personally, I find it to be a little disorienting. I get a bit of motion sickness with scroll snapping and I'm not exactly sure why.
[−] larnon 48d ago
The live demo doesn't work in Brave.
[−] division_by_0 48d ago
The demo really does not work in Brave. I use vertical scroll snapping on the landing page of one of my projects (enabled for screens with a min width of 768px and a min height of 600px - should work in Brave): https://cybernetic.dev
[−] x099999 48d ago
The fact that Claude is killing CSS officially means we need to switch back to IRC or something. AI is a parasite we cannot integrate but only avoid. (P.s. if you work in AI, stop, you are literally destructive to humanity.)
[−] brettermeier 47d ago
How is Claude killing CSS? I don't get it.
[−] AyanamiKaine 48d ago
Its incredible how far concepts like CSS can be pushed. But sometimes I wonder what if CSS would be just JavaScript i.e both concept are merged.

Would that be better or worse for webdev? I don't know. But I like to ponder.

[−] tgv 48d ago
I think it would be too easy to create an uncontrollable cascade of function calls, causing terrible performance. IMO, it's best to keep concerns separated. Perhaps the current JS/DOM interface is a bit cumbersome, but it gets a lot done. What is your reason for merging?
[−] senfiaj 48d ago
Someone wrote an x86 emulator with CSS (it uses JS only for clock to make it more reliable). https://lyra.horse/x86css/ . So, CSS is officially Turing complete (which is a bit scary IMHO).
[−] MrDOS 48d ago
In 2006, Ars Technica published an April Fool's article[0] declaring that the perennially-forthcoming Duke Nukem Forever would finally see the light of day... as... a browser game! Ho ho, how droll.

Crazy to see how far we've come.

[0]: https://arstechnica.com/gaming/2006/04/forever/

[−] w-ll 48d ago
Quake Live did come out as a browser NaCl game a year or so later.
[−] swyx 48d ago
thats wild that you can still link to a 2006 blogpost. kudos, ars technica.
[−] batisteo 48d ago
I remember when we needed 4 gifs to make rounded corners on a div
[−] rox_kd 48d ago
Couldn't agree more ... Especially how platforms like Stitch 2 are eliminating the barriers for non-technical individuals to actually get pretty decent UI/UX experience ..
[−] TZubiri 48d ago
While running Doom on X is typically a show of personal hacking skills, and a display of the turing completeness/power of X,

I think that running Doom on X can also be a criticism of X, certainly the opposite of the intention in some cases. Consider a config mechanicsm, if I prove that I can run Doom on .md or .ini, or notepad.exe, most people should be concerned, not just for bloat, but for security reasons.

The value of some tech is precisely in what it cannot do, not just what it can do.

[−] ionwake 48d ago
I feel there should be a gov dep where all the "i turned this into DOOM" folks get hired, to build the next spicy interplanetary propulsion systems. They are clearly needing an exotic task to stop twiddling their fingers.
[−] art0rz 48d ago
They would just end up making the thing they're building run Doom.
[−] SuzukiBrian 48d ago
Within a week they would have a rocket prototype where you can plug in a mouse and keyboard and play doom on the exhaust flames by mixing different fuel chemicals.
[−] saidnooneever 48d ago
just a small note on this very cool implementation and write up. you wrote modeling tools and animation stuff has camera that moves around.

i think ultimately, there also the world moves aroun the player and cameras are just a concept to make the frustrum etc (maybe modern tools do it differently, im a little out of date)

[−] quantummagic 48d ago
This is great. And Firefox should get kudos too, for running it the best, with fewest workarounds needed.
[−] anthk 48d ago
https://freedom.github.io

Use Deutex, GNU make and Pillow for Python to compile.

Then wou will have up-to-date IWADS to be used aywhere. No need to put ID copyrights, just a mention to FreeDoom creators.

[−] virtualritz 48d ago
CSS is /the/ spec to look at to understand how awful something designed by committee gets.

In web specs closely rivaled by SVG.

You can pick which one is uglier and you'll be right.

[−] creesch 48d ago
Be honest, did you just reply to the title and the title along even skipping the other comments?
[−] Levitating 47d ago
Crazy that the future of software development now looks like we'll all be making UIs with specs that just a few years ago didn't allow you to trivially center a widget in a container.
[−] Dwedit 48d ago

> "I used Claude to create an approximate version of the game loop in JavaScript based on the original DOOM source"

This is the real horror here, Uncanny-Valley gameplay Doom. It's like those Doom maps where people tried to recreate the game levels from memory, but still made a few mistakes and got some details wrong. This is like that, but for the gameplay rather than the level layouts. It's different enough to be wrong.

We have Green Armor that sets your armor to 200%. Health Bonuses that reset your health to 100% if you exceeded that number, too bad if you recently collected a Soul Sphere. Switch-activated doors that are supposed to stay open, but instead automatically close, but then the secret wall unexpectedly activates like a manual door.

[−] yakazaki_10 48d ago
The fact that CSS has evolved enough to pull off 3D rendering is wild. Makes me wonder where the ceiling actually is.
[−] lysace 48d ago
The game logic runs in JavaScript

Also: a modern CPU is around 10000x faster than the 486 CPU Doom was designed for. Per core.

[−] DarthCeltic85 48d ago
I LOVE this! You did a bang up job, is the skin change function coming in a future update?
[−] sgbeal 48d ago
It would be really interesting to see this without the texturing applied.
[−] gfody 48d ago
super playable on ff but I got stuck here https://imgur.com/a/6nXbPY3
[−] notnmeyer 48d ago
at this point i’m more interested in what _can’t_ run doom.
[−] gigatexal 47d ago
Never ceases to amaze me what people will port doom to
[−] phplovesong 48d ago
But can it run crysis?
[−] kuberwastaken 48d ago
Beautiful. Art.
[−] adi_kurian 48d ago
Really cool!
[−] AndreasMoeller 48d ago
Perfect!
[−] malkosta 48d ago
What a master class in linear algebra…
[−] nickcageinacage 48d ago
soooooooo cooool thank you
[−] mikax 48d ago
thats really cool
[−] josefrichter 48d ago
this is wild.
[−] mcparchtect 48d ago
soo good
[−] x099999 48d ago
itt: web developers continue to get more dumb
[−] sulplisetalk 48d ago
Yawn.
[−] devnotes77 48d ago
[dead]
[−] A04eArchitect 48d ago
[dead]
[−] alcor-z 48d ago
[dead]
[−] damotiansheng 48d ago
[dead]
[−] pugchat 48d ago
[dead]
[−] h1fra 48d ago
[flagged]
[−] fnord77 48d ago
[flagged]