Someone got Doom in an SQL database
🇬🇧 English
Rendering Doom within a database is a bold experiment, though as Ars Technica notes, it is "obviously a bad idea." The SQLDoom project uses a small Python client to manage input, output, and game timing, while Cedar DB tables handle the game geometry and state. Approximately 1,300 lines of SQL queries across 89 common table expressions implement the game logic and generate 35 bitmap framebuffers per second. This represents a major improvement over the previous Doom QL project, which achieved only raycasting-based, grayscale ASCII graphics reminiscent of Wolfenstein 3D.
The newer SQLDoom produces full-color 640x480 frames indistinguishable from the original executable. Converting Doom's classic WAD files to a relational database was straightforward because the original game structured levels into vertices, lines, and sectors. Even the famous binary-space partition trees translate to SQL using a pre-computed sort_key for objects at load time, allowing a simple "ORDER BY" statement to determine visible walls per frame, vastly improving performance.
🇨🇳 简体中文
在 SQL 数据库中渲染多尔顿 explained
在数据库中渲染多尔顿是一次大胆的实验,尽管正如 Ars Technica 所指出的那样,这显然是一个坏主意。SQLDoom 项目使用一个小型 Python 客户端来管理输入、输出和游戏计时,而 Cedar DB 表处理游戏几何和状态。大约 1,300 行 SQL 查询跨越 89 个公共表表达式实现游戏逻辑并每秒生成 35 个位图帧缓冲区。这比之前的 Doom QL 项目有了重大改进,该项目仅实现了基于光线投射的灰度 ASCII 图形,让人联想起 Wolfenstein 3D。更新的 SQLDoom 生成的完整彩色 640x480 帧与原始可执行文件 indistinguishable。将多尔顿经典的 WAD 文件转换为关系数据库非常简单,因为原始游戏将关卡构建为顶点、线和扇区。甚至著名的二进制空间分区树也可以使用加载时为对象预先计算的 sort_key 翻译为 SQL,从而允许简单的“ORDER BY”语句确定每帧可见的墙壁,从而大大提高性能。
SQLDoom 如何使用数据库查询渲染帧?
SQLDoom 使用大约 1,300 行 SQL 查询跨越 89 个公共表表达式来实现游戏逻辑并每秒生成 35 个位图帧缓冲区,Cedar DB 表跟踪几何和状态。