CSS is DOOMed

nielsleenheer.com

236 points by msephton 8 hours ago


ec109685 - 4 minutes 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. ```
MrDOS - 6 hours 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/

rkagerer - 7 hours ago

But where can I try it out in my browser?

EDIT: https://cssdoom.wtf/

sheept - 8 hours 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/

h1fra - 5 hours ago

So impressive! Bonus, you can wall hack by just deleting a div ahah

pverheggen - 6 hours 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;
  }
0x737368 - 8 hours ago

With how these things are going, soon hackers will be challenging themselves to run Crysis on calculators and microwaves

rox_kd - 4 hours 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 ..

quantummagic - 6 hours ago

This is great. And Firefox should get kudos too, for running it the best, with fewest workarounds needed.

jsjsjxxnnd - 7 hours 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...

OrangePilled - 8 hours ago

This page could use some "Practical CSS scroll snapping": https://css-tricks.com/practical-css-scroll-snapping/

gfody - 4 hours ago

super playable on ff but I got stuck here https://imgur.com/a/6nXbPY3

AndreyK1984 - 3 hours ago

I try a simple absolutely layout (all calculated on a server), and helps me a lot. 1) no reflow 2) very few exceptions 3) WAY EASIER FOR LLMs

DarthCeltic85 - 3 hours ago

I LOVE this! You did a bang up job, is the skin change function coming in a future update?

sgbeal - 8 hours ago

It would be really interesting to see this without the texturing applied.

notnmeyer - 7 hours ago

at this point i’m more interested in what _can’t_ run doom.

malkosta - 3 hours ago

What a master class in linear algebra…

adi_kurian - 6 hours ago

Really cool!

anthk - 7 hours 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.

josefrichter - 7 hours ago

this is wild.

lysace - 7 hours 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.

sulplisetalk - 5 hours ago

Yawn.

devnotes77 - 5 hours ago

[dead]

A04eArchitect - 3 hours ago

[dead]

alcor-z - 3 hours ago

[dead]

damotiansheng - 4 hours ago

[dead]

Roshan_Roy - 3 hours ago

[dead]

fnord77 - 7 hours ago

> CSS is awesome.

No

socalgal2 - 6 hours ago

FYI: this is a cool hack and very impressive, but ... don't do this. That fact that it runs doesn't make it a good idea. Like running DOOM in Excel (https://github.com/Pranshul-Thakur/DOOM-in-excel) or making a DIV for every pixel and rendering by changing colors of divs https://news.ycombinator.com/item?id=46409359

Use 3D CSS to enhance a 2D page with some flair. But be aware, 3D CSS, it's trying to solve things that most realtime 3D rendering does not, like intersecting planes need to be subdivided in order to correctly handle transparency. This means 3D CSS has an O(N^2) or worse type of issue vs rendering yourself using WebGL or WebGPU where you'd avoid those issues. This demo probably does not intersect any planes but the browser itself has to check for those intersections anyway. TL;DR: If you're going to make a 3D web game use WebGL or WebGPU, not 3D CSS

Very cool demo though!

Levitating - 8 hours ago

Is CSS that awesome? It's still a language designed for styling webpages with 30 year of added features. I'd argue something purpose built would be a much better tool for the potential usecases people try to use CSS for now.

I guess I am asking, if modern CSS is so awesome, it's awesome compared to what exactly?