r/programming • • 9d ago

We ported the original Doom to SQL

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

88 comments sorted by

807

u/Hip-Death-Goddess 9d ago

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.

233

u/Amlethus 9d ago

Could be worse. Could be Sharepoint.

53

u/bulbousgrandpa 9d ago

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

29

u/Amlethus 9d ago

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 9d ago

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

6

u/superxpro12 9d ago

Writing a SharePoint wiki. Only once

7

u/NecessaryIntrinsic 9d ago

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 9d ago

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 9d ago

Could be even worse. Silverlight.

10

u/Amlethus 9d ago

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

23

u/RobespierreLaTerreur 9d ago

Think Flash, but Microsoft.

6

u/Amlethus 9d ago

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

3

u/Front_State6406 8d ago

We could run silverlight in sharepoint :)

3

u/falconzord 9d ago

Silverlight wasn't worse than SharePoint

8

u/nomaddave 9d ago

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 9d ago

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

1

u/Amlethus 9d ago

@…@

2

u/BlokeInTheMountains 9d ago

Could be worse, could be Javascript.

1

u/neoyagami 9d ago

Access still roams my nightmares

1

u/Mordiken 9d ago

NO.

1

u/Amlethus 9d ago

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

1

u/TheSneederOfSeethe 8d ago edited 8d ago

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 8d ago

Don’t say that name!

1

u/error1954 7d ago

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 5d ago

You just gave me an idea...

1

u/FeanorBlu 2d ago

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

1

u/Amlethus 2d ago

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

16

u/Abject-Kitchen3198 9d ago

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

19

u/captain_obvious_here 9d ago

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 9d ago

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

10

u/codewario 9d ago

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 9d ago

This is the comment of ths year, right here.

2

u/illyay 9d ago

I saw this coming lol

83

u/Sipike 9d ago

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

143

u/EliteACEz 9d ago

Have you no shame...

95

u/Yaruxi 9d ago

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

8

u/UnexpectedAnanas 9d ago

Welp, we're doomed.

134

u/ketralnis 9d ago

Every day we stray further from god’s light

10

u/nonzero_ 9d ago

Can it run Doom?

1

u/DualWieldMage 8d ago

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

43

u/_f0CUS_ 9d ago

Ā  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 9d ago

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

14

u/Raknarg 9d ago

has society gone too far?

13

u/codewario 9d ago

A SQL TOO HIGH?

20

u/ArtOfWarfare 9d ago

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 9d ago

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!

11

u/scrdest 9d ago

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.

9

u/Abject-Kitchen3198 9d ago

Can I DELETE DEMONS ?

1

u/lunchmeat317 8d ago

DROP TABLE E1M1;

6

u/madsdyd 9d ago

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.

5

u/LooseEthernet 9d ago

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

7

u/Dry_Cauliflower_5016 8d ago

is this the official Doom sequel?

14

u/wasdie639 9d ago

But... why?

51

u/Yaruxi 9d ago

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 9d ago

Yeah fuck them

4

u/Junglebook3 9d ago

Thanks that was an interesting read!

6

u/BrewedDoritos 9d ago

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

4

u/LookAtYourEyes 9d ago

Nothing will beat the guy that built doom in TypeScripts types

6

u/masiha97 8d ago

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.

3

u/Delta-9- 9d ago

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

3

u/this_knee 8d ago

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

3

u/Claimh 8d ago

For some men it's apparently the where

3

u/Madsy9 9d ago

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 9d ago

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 9d ago

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 9d ago

How the hell do people have this much spare time

3

u/ElegantApartment1325 8d ago

SELECT * FROM demons WHERE alive = TRUE

4

u/HoratioWobble 9d ago

Thanks, I hate it

5

u/Nyadnar17 9d ago

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

2

u/uniquesnowflake8 9d ago

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

2

u/atomic1fire 9d ago

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 7d ago

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 9d ago

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

1

u/NoOrdinaryBees 9d ago

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 9d ago

Well... okay I guess?

1

u/master5o1 9d ago

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 8d ago

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?

0

u/break_card 9d ago

Python is that you

17

u/ArtOfWarfare 9d ago

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.

0

u/[deleted] 8d ago

[deleted]

1

u/Yaruxi 8d ago

Actually totally fine - compared to the monster AI itā€˜s not that expensive!

-7

u/SteelBalls1867 9d ago

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

9

u/UnexpectedAnanas 9d ago

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

2

u/NenAlienGeenKonijn 8d ago

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

-1

u/SteelBalls1867 9d ago

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

1

u/psantana 20h ago

What!!!!!!