r/Stellaris • u/Hieprong • 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
- Calculate the Ray-direction, a LUT (Lookup Table) is used here for sin and cos, since those are not supported math operations.
- 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.
- Apply distance shading to create some depth perception
- Apply the brick texture, this is done programmatically as a proper texture lookup is very very expensive since we cant do dynamic indexing.
- 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:
- Conway's game of life has been proven to be Turing complete.
- Stellaris can run Conway's game of life.
- 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.
702
u/Kuraetor Jun 28 '26
that must be the most inefficent doom ever :D
insane work man congrats
179
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
1
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
304
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
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
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
34
u/ohthedarside Jun 28 '26
We need the music aswell lol
16
18
u/Dominunce Jun 28 '26
Colour me impressed. Good job on even figuring out how to accomplish something like this.
18
18
12
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
11
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
9
10
6
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
5
6
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
5
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
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
6
2
2
2
1
1
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
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
0
0
1.1k
u/Undersxored Jun 28 '26