Top
Best
New

Posted by msephton 23 hours ago

CSS is DOOMed(nielsleenheer.com)
https://cssdoom.wtf/
466 points | 108 comments
sheept 22 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/

captn3m0 21 hours 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.

inopinatus 16 hours 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.
b0ner_t0ner 9 hours ago||

    IDDQD
and

    IDKFA
did not work unfortunately.
h1fra 20 hours ago||
So impressive! Bonus, you can wall hack by just deleting a div ahah
ehsankia 14 hours 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 11 hours ago||
Is that a Doom reference? What’s a wall hack? How did it look?
codethief 5 hours 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 11 hours ago|||
I mean they literally just told you...
rkagerer 22 hours ago||
But where can I try it out in my browser?

EDIT: https://cssdoom.wtf/

_fzslm 17 hours ago||
My phone IMMEDIATELY got toasty as I started moving around the world :')
TeMPOraL 22 hours ago|||
Never tried Doom on a phone before, this one is surprisingly fluid and very playable.
bethekidyouwant 20 hours ago|||
It works perfectly in Safari on mobile. this never happens.
nine_k 21 hours 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 20 hours 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 20 hours 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 16 hours 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 18 hours 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.

ticulatedspline 3 hours 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.

dgb23 5 hours 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.
rhdunn 10 hours 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.

titzer 7 hours 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.
batisteo 7 hours ago||
I remember when we needed 4 gifs to make rounded corners on a div
_joel 6 hours ago|
div tags? pah, I remember when all this were tables lad.
vardump 1 hour ago||
Tables? Bah. I remember when all of this were image maps instead.
pverheggen 20 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;
  }
ec109685 15 hours 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. ```
ionwake 8 hours 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 7 hours ago|
They would just end up making the thing they're building run Doom.
andyjohnson0 6 hours ago|||
And then they would find a way to make that embedded Doom run the thing that they are building [1]. Possibly inside a cellular automaton.

[1] Can Doom Run It? An Adding Machine in Doom https://blog.otterstack.com/posts/202212-doom-calculator/

afferi300rina 6 hours ago||
At this point, I’m just waiting for someone to implement a CSS-only browser inside this CSS-only Doom, so we can achieve full recursive insanity. The 'Can it run Doom?' meme has officially transcended hardware and entered the realm of pure Turing-complete masochism.
SuzukiBrian 6 hours 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.
AyanamiKaine 13 hours 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.

senfiaj 4 hours 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).
tgv 12 hours 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?
AyanamiKaine 10 hours ago||
> What is your reason for merging?

Good question, I personally think that seperating by concerns is good. But when problems arise like boundaries that get crossed or compilers implementing language features into css like Sass, maybe it proves that those things are actually not two concerns but one.

Lately I am using Catch2 (a c++ testing framework) and wanted to benchmark some code. My first instinct was looking for a benchmark framework. But to my surprise Catch2 does also have a benchmarking framework included!.

Most people would argue that a testing framework should not include a benchmarking framework. But using it myself it showed me that both concerns of benchmarking for performance regressions and testing are similar.

Similar enough that I would prefer both of them together.

Most people, me included, are asking: "Should this be split into more?" But seldom, we ask: "Should this be merge into one?"

More comments...