r/programming • • Sep 23 '26

We ported the original Doom to SQL

https://cedardb.com/blog/sqldoom/
855 Upvotes

89 comments sorted by

148

u/EliteACEz Sep 23 '26

Have you no shame...

94

u/Yaruxi Sep 23 '26

Well, I tried to find out if I could - it never came to mind to ask myself whether I should...

8

u/UnexpectedAnanas Sep 23 '26

Welp, we're doomed.

18

u/ArtOfWarfare Sep 23 '26

I’m disappointed that this isn’t standard SQL and so it’s tightly coupled to your specific SQL implementation, but otherwise thoroughly impressed.

Doing the rendering in the DB is cool but obviously stupid. But you have me wondering whether, ie, RTS games should have all their non-rendering portions done in a database.

23

u/Yaruxi Sep 23 '26

Fair! But It’s standard postgres sql - the only nonstandard thing is the cedarscript tic driver which could be ported to plpgsql pretty easily - unfortunately CedarDB doesn’t support that one yet. I guess your llm of choice could make it fully Postgres compatible in half an hour.

But yea, my colleagues laugh at me but I seriously think expressing game logic in sql is very performant, natural, and elegant!

9

u/scrdest Sep 23 '26

SpacetimeDB guys were making that exact case a good while back already.

"ECS architecture is already trending heavily towards something shaped like a columnar DB, so might as well stop pretending we're not doing SQL" is the general shape of the argument.

14

u/wasdie639 Sep 23 '26

But... why?

48

u/Yaruxi Sep 23 '26

tbh I was mostly annoyed that someone claimed my earlier implementation didn't use BSP trees so I had to fix that.

19

u/illyay Sep 23 '26

Yeah fuck them

818

u/Hip-Death-Goddess Sep 23 '26 • Bravo Mindblown

Doom and SQL. A natural combo.

One is a demon-infested hellscape where hope is dead, and even the strongest wills turn to dust overwhelmed by the neverending swarms of unnamed tormenting horrors.

And the other is a game by id software.

232

u/Amlethus Sep 23 '26

Could be worse. Could be Sharepoint.

54

u/bulbousgrandpa Sep 23 '26

I still haven't recovered from being forced to become SharePoint admin on top of SQL duties at my last job

29

u/Amlethus Sep 23 '26

Well consider it this way, maybe you did something really bad in a previous life, and it's just the long arm of karma smacking you down 🥲

12

u/kinggoosey Sep 24 '26

Some of us come back as worms, others SharePoint admins.

7

u/superxpro12 Sep 23 '26

Writing a SharePoint wiki. Only once

6

u/NecessaryIntrinsic Sep 23 '26

I had a decent systems admin job, I quit because they wanted me to beat SharePoint admin.

I interviewed with a big government contractor and they didn't tell me what they wanted me to do.

It was SharePoint development/administration. I wasted 8 years there and went to another job, more of a developer position, but still SharePoint. They laid me off when SharePoint started drying up even though I can develop on any platform.

Fuck SharePoint.

My new job has no Microsoft. They even got me a MacBook to develop on. No teams, no office.

SharePoint has been a rock dragging me down for decades and I'm so happy to finally be free of it.

3

u/bulbousgrandpa Sep 23 '26

Yeah I was working for a state government position and they basically told me that as the new guy i would have no choice but to become the sole SharePoint admin and power platform dev of a 1000 person department to replace the contractor that were paying to build it. I had to help her build out the sites and automation while simultaneously having to be the main data engineer building out the medallion architecture for the entire place within Google Cloud and all the ETL, devops etc too. Worst part was that I only got paid $50k a year for this and didn't get any raise after I got switched from being the IT PowerShell scripting and AD admin guy for the first 6 months I worked there. Thank fucking god I left. I understand your pain, I specifically pivoted to the data engineering side more heavily when I realized how limited SharePoint jobs were becomin.g

15

u/gamers542 Sep 23 '26

Could be even worse. Silverlight.

9

u/Amlethus Sep 23 '26

I live a privileged life such that I don't even know about that one.

24

u/RobespierreLaTerreur Sep 23 '26

Think Flash, but Microsoft.

7

u/Amlethus Sep 23 '26

Oh lordy. I think I remember this from cheap microsoft games from the late 90s or early 2000s.

3

u/Front_State6406 Sep 24 '26

We could run silverlight in sharepoint :)

3

u/falconzord Sep 24 '26

Silverlight wasn't worse than SharePoint

8

u/nomaddave Sep 23 '26

Sharepoint has been running Doom for a long time via goofy injections that are technically supported, as far back as with Flash/Actionscript. A few years back it was running fine via TS/JS on a webpage component.

2

u/Abject-Kitchen3198 Sep 23 '26

That's a good point. Can I share it?

2

u/BlokeInTheMountains Sep 23 '26

Could be worse, could be Javascript.

1

u/neoyagami Sep 23 '26

Access still roams my nightmares

1

u/Mordiken Sep 24 '26

NO.

1

u/Amlethus Sep 24 '26

What? It isn't like saying it three times is going to summon the Sharepoint demon. Sharepoint Sharepoint Sha

1

u/TheSneederOfSeethe Sep 24 '26 edited Sep 24 '26

You know technically you can access all .Net libraries including OpenGL wrappers in PowerShell. So if you want to shred the last of your sanity MS is there for you.

1

u/Kellar21 Sep 25 '26

Don’t say that name!

1

u/error1954 Sep 25 '26

My employer decided to switch us all to SharePoint instead of our previous document sharing platform. We now have 3 different alternative systems implemented in house to avoid using SharePoint. Everyone heard we were going to switch and multiple engineering teams thought "fuck that we will make something better"

1

u/conipto Sep 28 '26

You just gave me an idea...

1

u/FeanorBlu Sep 30 '26

Could be even worse. Could be a Power BI report built on top of SQL and SharePoint!

1

u/Amlethus Sep 30 '26

...who puts these ideas in your head I'm gonna wash your hard drive out with soap.

16

u/Abject-Kitchen3198 Sep 23 '26

SQL is a bliss. Try doing what it does best using any other tech.

19

u/captain_obvious_here Sep 23 '26

One is a demon-infested hellscape where hope is dead, and even the strongest wills turn to dust overwhelmed by the neverending swarms of unnamed tormenting horrors.

Tell me you've used MS SQLServer extensively, without telling me you've used MS SQLServer extensively.

Or Oracle.

6

u/foxsimile Sep 23 '26

I wouldn’t burn microsoft share certificates to stay warm.

11

u/codewario Sep 23 '26

You jest, but the reality is there was a Doom RPG for flip cell phones back in the day that actually made you learn a tiny bit of SQL in order to progress through the game

So a bit of a recursion joke there

4

u/NinjaMidget76 Sep 23 '26

This is the comment of ths year, right here.

2

u/illyay Sep 23 '26

I saw this coming lol

86

u/Sipike Sep 23 '26

After the TypeScript type implementation, I'm not surprised anymore.

137

u/ketralnis Sep 23 '26

Every day we stray further from god’s light

10

u/nonzero_ Sep 23 '26

Can it run Doom?

1

u/DualWieldMage Sep 24 '26

Yes, Akhetonics is making optical chips and they ran doom: https://youtu.be/9tqOPS6x9l8?si=Qm01ld90FcfNLsmn&t=885

45

u/_f0CUS_ Sep 23 '26

  As you can see it encodes the behavior of the clip above

No. I cannot see that... I will take your word for it :D

18

u/Ok-Bit8726 Sep 23 '26

I’ve never heard of CedarDB, but this is very impressive. Seeing the bytecode comparison was pretty cool.

16

u/Raknarg Sep 23 '26

has society gone too far?

12

u/codewario Sep 23 '26

A SQL TOO HIGH?

8

u/Abject-Kitchen3198 Sep 23 '26

Can I DELETE DEMONS ?

1

u/lunchmeat317 Sep 24 '26

DROP TABLE E1M1;

7

u/madsdyd Sep 23 '26

This is wonderful.

One point: Carmack at some point (2011?) wrote something like that the core of every game engine iteration always was to make sure the engine has the data it needed next readily available. It seems you are on the same path somehow.

6

u/LooseEthernet Sep 23 '26

cant wait for the first sql injection to spawn a cyberdemon lol

6

u/Dry_Cauliflower_5016 Sep 24 '26

is this the official Doom sequel?

5

u/Junglebook3 Sep 23 '26

Thanks that was an interesting read!

5

u/BrewedDoritos Sep 23 '26

I'll wait for the NoSQL version ... it will be web scale

5

u/LookAtYourEyes Sep 24 '26

Nothing will beat the guy that built doom in TypeScripts types

5

u/[deleted] Sep 24 '26

Every year someone ports Doom to a new platform and every year I think we've hit the limit. Doom in SQL. The queries are firing at 60fps and I'm questioning everything I know about databases.

4

u/Delta-9- Sep 24 '26

Things like this make me painfully aware of how much I don't know about programming.

4

u/this_knee Sep 24 '26

Some men can’t be bothered with: what or why. Some men just wanna watch the world burn.

4

u/Claimh Sep 25 '26

For some men it's apparently the where

3

u/Madsy9 Sep 23 '26

This is awesome! Reminds me of a turn-based isometric strategy game I used to love, Fallen Haven: Liberation Day. All the game data was an Access 97 database, even the save files if I remember correctly. Though unlike this Doom port, those databases were a nightmare. Everything was crammed into a dozen tables or so, with each table consisting of ~100 columns, all nullable. Instead of table joins and normalized tables, most rows were sparse with a couple of columns set and the rest being NULL. This was back in the Windows 95 days.

3

u/admalledd Sep 23 '26

On the section

Where using a database is actually a good idea

That everything is data, is actually a generally recommended method for game dev if you can. Further this also leans into the split of game engine vs game data, such that things like mods become more easy. I am not always sold on "full SQL database in my game" (even via SQLite) but the patterns are useful for ECS and such where more of the game is data-driven.

3

u/GameFreak4321 Sep 23 '26

I'll say what I said about running doom in typescript's type system: Doom is a game about what happens when you do this.

3

u/shoot_your_eye_out Sep 24 '26

How the hell do people have this much spare time

3

u/ElegantApartment1325 Sep 24 '26

SELECT * FROM demons WHERE alive = TRUE

4

u/HoratioWobble Sep 23 '26

Thanks, I hate it

6

u/Nyadnar17 Sep 23 '26

.....Look.....look I understand we didn't become engineers to ask why.....but sibling. Oh sibling how far you have strayed.

2

u/uniquesnowflake8 Sep 23 '26

At this point I’m only clicking if it’s Crysis

2

u/atomic1fire Sep 24 '26

I wanna ask why but I feel like that answer has already been written a hundred times over with some variation of "Because they can" or "To prove it's possible to do so."

2

u/AdditionalTerm732 Sep 26 '26

I just posted about my own mental asylum over at r/vba. Parallel to your project, I've been building a 120 FPS space shooter in pure Excel using 1985 GDI WinAPI.To make it worse, I'm hooking it up to a Spring + MySQL backend. Seeing Doom running on SQL queries makes me feel so much less crazy. We definitely found each other. Massive respect!

1

u/PanicInTheSkreet Sep 23 '26

damn that's pretty fucking cool! the input lag is a bit much, but it's still fun and playable.

1

u/NoOrdinaryBees Sep 23 '26

I once wrote a web service in pl/pgSQL to drive a Slack bot that mocked a coworker. I thought that was cool until 8 seconds ago.

Bravo, I applaud your SQL monstrosity. Take my upvote and this slow clap.

✋🏻 … ✋🏻

✋🏻 … ✋🏻

1

u/bring_back_the_v10s Sep 23 '26

Well... okay I guess?

1

u/master5o1 Sep 24 '26

Ok, more impressive than my first thought, which was that it was simply using this other madlad thing for storing ELF data in a SQLite database file.

https://fzakaria.com/2026/08/23/your-executable-is-a-sqlite-database

1

u/philh Sep 24 '26

some panels are just there to influence how other panels are rendered: If you step out of a door below a balcony, there’s something above you and that has to end somewhere.

Wait, I thought doom's engine didn't support balconies?

1

u/psantana Oct 02 '26

What!!!!!!

1

u/X_MALICUR Oct 17 '26 edited Oct 17 '26

Autism

-1

u/break_card Sep 23 '26

Python is that you

16

u/ArtOfWarfare Sep 23 '26

Not really, no. If you read the article, he’s using Python to detect input and push that into the DB, run a timer, and pull pixel data from the DB and set it in a canvas. All the actual game logic and rendering and everything happens in the database, in a SQL dialect.

-7

u/SteelBalls1867 Sep 23 '26

stuff like this is not cool if they just asked an LLM to do it

8

u/UnexpectedAnanas Sep 23 '26

But did they? It doesn't look like it.

2

u/NenAlienGeenKonijn Sep 24 '26

There is a -LOT- of AI generated stuff on that website.

-1

u/SteelBalls1867 Sep 23 '26

writeup is riddled with slop. but maybe they did all the coding themselves and they just happen to write like an LLM eh

0

u/[deleted] Sep 24 '26

[deleted] — view deleted comment

1

u/Yaruxi Sep 24 '26

Actually totally fine - compared to the monster AI it‘s not that expensive!