A multiplayer DOOM-like game written in SQL has been implemented

The DOOMQL project is presented, developing a variant of the DOOM game, written in SQL and capable of execution inside the CedarDB DBMS, partially compatible with PostgreSQL. The game supports multiplayer mode and renders using ASCII graphics. The project code is distributed under the MIT license.

All components of the game, including rendering code, player state synchronization in multiplayer games, and the game loop, are written in SQL. Game logic is implemented using tables, views (VIEWs), and stored procedures, which distinguishes DOOMQL from similar projects DuckDB-DOOM (uses stored procedures in WebAssembly) and pg_doom (implemented as an extension to PostgreSQL in C).

DOOMQL is developed using the "everything is data" concept, using tables to store the state of maps, players, objects moving around the level, input events, settings, and sprites. The game loop responsible for processing and updating the game state is run by a 20-line shell script that executes SQL code 30 times per second to calculate shot trajectories, analyze collisions, process input, and respawn players.

The SQL-based 3D renderer supports ray tracing, sprite projection onto a 3D scene, object overlap processing, and a Heads-Up Display (HUD) interface. All rendering logic is implemented using views. Several players can connect to the game at the same time, and their status is synchronized using tables and views.

On the user side, a client is launched, which includes about 150 lines of code in Python. The client's work is reduced to transmitting information about keystrokes and outputting frames to the terminal. The output is organized by periodically executed SELECT queries to the "screen" view in the DBMS, which dynamically forms the image line by line (each line output in response to a SELECT query corresponds to a line on the screen). Information about keystrokes and adding new players is carried out through INSERT queries.

Source: opennet.ru

Buy reliable hosting for sites with DDoS protection, VPS VDS servers πŸ”₯ Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster