We ported the original Doom to SQL

(cedardb.com)

111 points | by Vaslo 1 day ago

12 comments

  • soltanov 3 hours ago
    Less lines of code than vanilla C while abusing query planning as a state machine is peak engineering malpractice. I love it.
    • Alive-in-2025 3 hours ago
      Yes, this is fantastic! I'm trying it right now. I look forward to the day when LLM inferencing can be done in a sql query and take less than the age of the earth to do something. This works way better than I would have expected, since, well, it's sql all the way down.

      I noticed the cedardb.com blogpost on the project is slashdotted at the moment, but the game itself plays just fine.

  • noduerme 1 hour ago
    The game state being a SQL table just kinda triggered a memory of a year of optimization for me. One thing I'm still unsure of being a good decision or a bad one, when I wrote my casino in 2010, was having every remote call update game states on SQL tables that were used as the source of truth. With multiple players you can imagine that there would sometimes be issues. Some of the deadlock problems early on were horrific; scaling was a nightmare. But everything was atomic. No risk of lost data beyond one turn not reaching the server or deadlocking, nothing like a huge nodejs process choking on everyone's calls at the same time, or losing its memory. You always had state.

    Looking back it seems like not a terrible design pattern for multiplayer turn-based games, if you can work out the kinks. Atomicity guarantees at least that there is a consistent state that won't get lost. Doing that read/write loop for an action game? Pure folly, but it's pretty funny to me.

  • jdw64 12 minutes ago
    It's fascinating that it can be applied this way.
  • ralfd 2 hours ago
    I want to point out that they set up an EU and US multiplayer server! Nice touch.
  • emsixteen 2 hours ago
    Meanwhile I'm too inept to get WordPress to load dynamic content faster than molasses.
  • pmkary 2 hours ago
    This should be illegal :)))) Wow!
  • d--b 2 hours ago
    Nice piece of advertisement. Kind of hard to stand out in the world of SQL dbs. That definitely raised eyebrows.
    • vovavili 13 minutes ago
      I was actually just recently looking if there is a self-hostable alternative to a HTAP system like TiDB + TiFlash with a Postgres-compatible syntax, but LLMs didn't really pick up on CedarDB yet. These guys know game.
  • paul-vernon 11 days ago
    > The game logic is just ~5900 lines of SQL. While this sounds a lot, it’s definitely less than the original C source code which does the same in about 9000 lines!

    Nice

    • paul-vernon 38 minutes ago
      Makes me wonder how good a better relational language than SQL might be for general programming.
  • smalltorch 11 days ago
    Thats ridiculous I love it. The visual in the bottom right it a great illustration.
  • webbrainiac 29 minutes ago
    [flagged]
  • dang 1 day ago
    (This has been posted numerous times but none of them made the front page. I've made a new copy of the earliest one that got comments.)
  • builder_woody 3 hours ago
    [flagged]