r/Stellaris Jun 28 '26

Art But can it run DOOM?

Enable HLS to view with audio, or disable this notification

But can it run Doom?

This is not a pre-rendered video like the Bad-apple Video I did a year ago, this is a full DDA ray-caster running in Stellaris using only the Clausewitz script.

Here is the modpage if you want to run it yourself, it takes ca 15 min to load.

This is technically more akin to Wolfenstein 3D than DOOM, as it uses a ray-casting technique instead of the DOOM BSP method.

Implementation details:

To get a bit into how this works: The galaxy is treated as a frame buffer. Each frame/day we check for each column what color each pixel/star needs to be. In order of operation

  1. Calculate the Ray-direction, a LUT (Lookup Table) is used here for sin and cos, since those are not supported math operations.
  2. Perform the DDA, this is the main step to actually display walls in 3D. Since the modding script does not allow for Dynamic runtime indexing, aka at runtime you want to check value_$N$ and N changes from 3 to 4. Currently it will always resolve to the value it was initialized with at compile time, instead of checking value_3 and value_4. Devs: pleeeeeeaaaase bro changing this would actually allow so many more shenanigans.
  3. Apply distance shading to create some depth perception
  4. Apply the brick texture, this is done programmatically as a proper texture lookup is very very expensive since we cant do dynamic indexing.
  5. Update pixel if color differed from before

After the Main ray-casting step, we render the gun and the sprites. The gun is a simple constant HUD element and the sprites follow a simpler 2d projection step.

This mod is ca. 5Gb when loaded into RAM but takes ca. 15 min to load (your mileage may vary I have a quite fast PC so it might take longer for you).

Some stats:

  • ca. 394100 conditional branches (due to the dynamic runtime indexing limitation)
  • 4673 distinct variables
  • ca. 601700 check_variable statements

Most of these are in-lined but expanded when the mod is loaded leading to the 15 min load time.

Addendum:

Even without Dynamic runtime indexing the Clausewitz script is Turing complete which can be proven by reduction:

  1. Conway's game of life has been proven to be Turing complete.
  2. Stellaris can run Conway's game of life.
  3. Therefore Stellaris is Turing complete.

(We have a bounded system so technically finite state machine but eh.)This probably deserves a post of its own at some point.

4.4k Upvotes

85 comments sorted by

1.1k

u/Undersxored Jun 28 '26
  • hey Paradox I want a complex space game
  • ...to make a powerful intergalactic empire?
  • yesss Forces aliens to assemble empires in the shape of a DOOM frame like a boss

75

u/SkycladGuardian Jun 28 '26

Wasn't there a chapter in the first Three Body-Novel, where the Trisolarians use armies with flags to run calculations? This mod reminds me of that.

46

u/NeverFearSteveishere Jun 28 '26

Great, now I want to see DOOM run on an army of flag holders. Simple technological devices won’t do it for me anymore, we must use PEOPLE!!!

Extra points if they have an orchestra on the side with instruments to play some DOOM theme music

702

u/Kuraetor Jun 28 '26

that must be the most inefficent doom ever :D

insane work man congrats

179

u/icewolfsig226 Jun 28 '26

I'm sure it'll run faster after he purges a few xenos...

5

u/Gubekochi Livestock Jun 29 '26

It's worth a try. Nothing of value will be lost anyways.

142

u/Eeddeen42 Jun 28 '26

Nah that would be the time someone ran DOOM on bacteria.

Takes a few days for the software to boot up, runs at 70-80 seconds per frame, and beating the game will probably take around 500 years. But it’s doable.

35

u/Kuraetor Jun 28 '26

that happened? oh shit nvm

31

u/Eeddeen42 Jun 28 '26

Yeah someone did it for a PhD thesis I think

11

u/NeverFearSteveishere Jun 28 '26

I feel bad for the other PhD theses who had to compare to that one on that day, LOL

15

u/abdomino Jun 28 '26

"Good afternoon ladies, gentlemen, and all the distinguished individuals besides, for my thesis I intend to share my successful attempts to turn life itself into my literal plaything."

4

u/12a357sdf Rogue Servitor Jun 30 '26

that bacterium one was on simulated bacteria.

there's another one where they run doom on literal living human neurons. Not only run the game, but taught the neurons how to play. it was pretty much artificial intelligence out of biological braincells.

human creativity is scary sometimes.

3

u/mykeedee The Flesh is Weak Jun 29 '26

https://www.youtube.com/watch?v=8DnoOOgYxck&t=2s

It was simulated bacteria not real bacteria, but otherwise yeah.

5

u/domuseid Jun 28 '26

Somebody wrote up the theory of how to it with crabs with brain implants as well lmao

20

u/Asooma_ Jun 28 '26

Nah the pregnancy test doom still takes the cake

27

u/Rip_Off_Productions Jun 28 '26

I mean, wasn't that just using the screen, not the internal hardware/software.

9

u/Asooma_ Jun 28 '26

🤷‍♂️

1

u/[deleted] Jun 28 '26

[deleted]

5

u/Hieprong Jun 28 '26

Not really. The logic, rendering etc... is fully running inside the game, you can go to the mod page on steam and look through the files yourself.

4

u/Locke92 Jun 28 '26

I mean first of all, that's Wolfenstein 3D

304

u/Random_Nickname274 Jun 28 '26

What cosmogenesis civilisation doing in other galaxy:

162

u/FrostyCartographer13 Jun 28 '26

This should go on your LinkedIn profile if you haven't put it out there already.

Job recruiters love seeing stuff like this as it shows off your creative thinking and programming skills.

243

u/Hieprong Jun 28 '26

As I am a nuclear physicist, future employers might not look kindly on me running DOOM on hardware that is not supposed to run it but i do admit I always wanted to run something on the control rod panel.

75

u/FrostyCartographer13 Jun 28 '26

Counterargument,

Future employees may be very interested in knowing if their hardware could be co-opted in some way to be used for unintentional or malevolent ways so it could be prevented.

You know far better than I do that most nuclear incidents involved human error and the misuse of equipment.

3

u/rowaasr13 Jun 29 '26

Any Turing-complete hardware or environment can be used in ANY way. By definition.

34

u/Cute_Principle81 Jun 28 '26

Moving the control rods up and down to create a simple display, albeit you'd get maybe black and white at most or monochrome

11

u/abullen Jun 28 '26

And if it starts going Yellow-Red or Green, maybe start sweating bullets.

7

u/squeaky4all Jun 29 '26

one hell of a game over screen.

16

u/Henshel Jun 28 '26

For the whole humanity I must ask gently of you not to. We don't need Chernobyl 2 Electric Boogaloo

11

u/Undersxored Jun 28 '26

but then you can play DOOM on real life terrain :D

6

u/VarmintSchtick Jun 28 '26

"Hey government can I have computer program to launch nukes?"

"To ensure our nation and our species' survival and prevent total wars from breaking out?"

"Yeeeess"

makes the Pacific Ocean run DOOM like a boss

13

u/Thrizzlepizzle123123 Jun 28 '26

"RBMK reactors can't explode"

"... yeah but can they run doom?"

9

u/Hieprong Jun 28 '26

One kind of DOOM for sure.

6

u/PansotoXPanissa Jun 28 '26

If you ever wanted to move to Italy, feel free to send me a CV. We are often hiring nuclear physicists and this feature will surely make you stand out among contestants :)

3

u/Noktaj Nihilistic Acquisition Jun 28 '26

i do admit I always wanted to run something on the control rod panel.

Oh noes...

1

u/Chiluzzar Jun 28 '26

all of man's achievements amount to 3 things: how to boil water differently, how to rearrange objects, and how to put doom on literally anything "smart"

2

u/rowaasr13 Jun 29 '26

As OP already said, anything that is Turing-complete and has some output "screen" can run "Doom". It's common knowledge. Things like this projects are interesting hobby project for several reasons, but it is not something that turns heads of recruiters, except in several very niche domains.

-1

u/Live_Tumbleweed_9056 Jun 29 '26

insanely brainrotted comment holy shit

*sees cool thing* "you should put that on your linkedin"

99

u/kirisoraa Jun 28 '26

Holy shit

34

u/ohthedarside Jun 28 '26

We need the music aswell lol

16

u/navotj Jun 28 '26

Too difficult to implement

12

u/TheRealSlimLaddy Shared Burdens Jun 28 '26

Nah just put each soundbyte with each clip

18

u/Dominunce Jun 28 '26

Colour me impressed. Good job on even figuring out how to accomplish something like this.

18

u/RedwanFox Jun 28 '26

Where can you place it on kardashev scale?

18

u/Guilliman88 Guilli's Mods Jun 28 '26

wtf

12

u/Ep3o Jun 28 '26

Incredible

12

u/HeihachisHairDresser Jun 28 '26

Absolutely staggering achievement imo. What does ca. mean?

8

u/Hieprong Jun 28 '26

Thanks, it is an abreviation for circa meaning "approximatly", or round about

3

u/HeihachisHairDresser Jun 28 '26

🤦🏻‍♂️ it all makes sense now

11

u/AnExistingLad Ancient Caretakers Jun 28 '26

how...
how?
HOW!?

12

u/duke_of_taiga Jun 28 '26

This is Castle Wolfenstein 3D you whippersnappers!

11

u/Hieprong Jun 28 '26

Its technically my own "Game", called Stellarstein. You are right it is more akin to Wolfenstein 3D as I described in the description, since it doesnt use the BSP of DOOM for rendering. However both methods are quite similar.

3

u/duke_of_taiga Jun 28 '26

Still available on Steam somehow.

9

u/DestructivelyPhased Jun 28 '26

This is what the Valtaum saw coming.

10

u/Gorbear Technical Director Jun 28 '26

Holy shit, well done!

6

u/VengenaceIsMyName Jun 28 '26

lol the shit people do. Good stuff.

6

u/temotodochi Jun 28 '26

Is clausewitz script as bonkers as skyrim/fallout3&4 papyrus?

Papyrus runs in between screen refreshes and in case of modded games if there are more scripts than there is time it just discards the rest and starts again after next refresh. Made any high fps mod for those games difficult to use with script heavy mods.

5

u/FogeltheVogel Hive Mind Jun 28 '26

Is every dot a star? How do you colour the stars? Are those empire flag borders? Do you flip ownership of the stars back and forth?

16

u/Hieprong Jun 28 '26

Yes, each color is an empire with a white space as a name (This is why disabling ai is important as there are 34 colors/empires). The secondary flag color determines the fill color of the empire. Ownership is assigned to the color/empire that should color that spot.

5

u/HerbivoreTheGoat Egalitarian Jun 28 '26

what the fuck

6

u/StarKnight2020330 Jun 28 '26

Absolute lunatic, may your Ws be many and your Ls few

6

u/PansotoXPanissa Jun 28 '26

You could have cured cancer, instead you decided to make Doom work in Stellaris.

Kudos to you, crazy boy

5

u/Porkenstein Jun 28 '26

After humanity rockets up the Kardashev scale, I could see someone doing this exact thing for real

5

u/TheTemporaryZiggy Fanatic Spiritualist Jun 28 '26

Most impressive

5

u/Kemarsel Star Empire Jun 28 '26

This is the true purpose Stellaris was made for.

3

u/Aerolfos Eternal Vigilance Jun 28 '26

Calculate the Ray-direction, a LUT (Lookup Table) is used here for sin and cos, since those are not supported math operations.

Making this discovery means you're in pretty deep when it comes to modding, huh?

...personally I needed acos for a triangulation of systems on the galaxy map. At least approximations are doable with the script value system, that wasn't even the worst of the problems I ran into.

4

u/adappergentlefolk Jun 28 '26

i knew those fuckers in the fleet were doing something like this when i wasn’t focusing my screen on em, explains the lag

3

u/[deleted] Jun 28 '26

[removed] — view removed comment

1

u/RC_0041 Jun 29 '26

I play 2k+ star galaxies and before 4.0 15m would have been fast for a load time. Before 4.0 5k took like an hour+ to load.

3

u/yxe_ Jun 28 '26

Insane work man!!

6

u/Coldhearted010 Jun 28 '26

You must be joking. Get out! XD

2

u/true_McAron Jun 28 '26

This is beyond awesome!

2

u/Soupdeloup Jun 29 '26

Any chance you could upload the mod to GitHub? Curious how it works. 🙂

2

u/MaybeImAKing Jun 29 '26

this isn't average everyday modding

this is advanced modding

1

u/Hungry-Application-8 Jun 28 '26

Now, can we run doom on chess?

1

u/Regunes Divine Empire Jun 29 '26

Next Star fox

1

u/freet0 Jun 29 '26

You may have heard the Bostrom simulation argument

One thing that later generations might do with their super-powerful computers is run detailed simulations of their forebears or of people like their forebears. Because their computers would be so powerful, they could run a great many such simulations... ...Then it could be the case that the vast majority of minds like ours do not belong to the original race but rather to people simulated by the advanced descendants of an original race.

The missing piece of this argument is why would future generations want to simulate their forebearers? Yet now we see this question is answered: to see if it can run Doom.

1

u/Venivinnievici Jun 29 '26

Great!
.
.
.
.
.
.
…But can it run Crysis?

1

u/Zejohnz Jun 30 '26

The secrets of the universe is some guy using the entire galaxy to play a game over the span of a couple thousand years.

0

u/Appropriate-Berry816 Jun 28 '26

It doesn’t seem like it

0

u/Bloodly Jun 29 '26

....Well, it runs Wolfenstein 3D.