完全从DNS记录中的Doom
Doom entirely from DNS records

原始链接: https://github.com/resumex/doom-over-dns

## DOOM 通过 DNS:一项令人惊讶的实用壮举 该项目展示了 DNS TXT 记录的一种创造性(且非常规)用法:完全通过 DNS 查询运行经典游戏 DOOM。利用 Cloudflare 免费的、全球缓存的 DNS 服务,整个共享版 DOOM 游戏——包括 WAD 文件和游戏引擎 DLL——被分割成近 2000 条 TXT 记录。 一个 PowerShell 脚本随后在运行时重建并运行游戏,仅从 DNS 获取数据,且不将任何文件写入磁盘。它利用直接加载到内存中的修改后的 .NET 8 游戏引擎。 设置过程包括构建引擎、使用提供的脚本和 API 令牌将游戏数据上传到 Cloudflare DNS,然后使用单个 PowerShell 命令启动游戏。虽然免费的 Cloudflare 区域在数据存储方面存在限制,需要多个域名才能容纳完整游戏,但 Pro 区域就足够了。该项目甚至支持恢复中断的上传。

一个GitHub上的新项目展示了运行DOOM——不是通过DNS *玩*游戏,而是通过**从DNS记录加载整个游戏**来实现。该项目在Hacker News上分享,巧妙地利用了DNS的数据存储能力来保存游戏文件。 用户指出标题略有误导,因为DNS仅用于存储,不用于处理或执行游戏。这一成就引发了关于“它能运行DOOM吗?”的极限讨论,以及与在更老的计算设备(如MONIAC和ENIAC)上运行游戏的比较。 一位评论员将该项目与经典的YouTube视频“Harder Drive”联系起来,强调了非常规数据存储方法的独创性。本质上,这是一个引人入胜的、尽管在技术上有限的、展示DNS能力边界的演示。
相关文章

原文

Demo

At some point, a reasonable person asked "DNS resolves names to IP addresses, what else can it do?" The answer, apparently, is run DOOM.

DNS TXT records can hold arbitrary text. Cloudflare will serve them globally, for free, cached at the edge, to anyone who asks. They are not a file storage system. They were not designed to be a file storage system. Nobody at the IETF was thinking about them being used as a file storage system when they wrote RFC 1035. And yet here we are.

This project compresses the entirety of shareware DOOM, splits it into ~1,964 DNS TXT records across a single Cloudflare zone, and plays it back at runtime using nothing but a PowerShell script and public DNS queries. The WAD file never touches disk and the .NET game engine DLLs are loaded directly into memory.

It was always DNS.


# 1. Install PowerShell 7 (if you don't have it)
winget install Microsoft.PowerShell

# 2. Play DOOM
.\Start-DoomOverDNS.ps1 -PrimaryZone 'example.com'

That's it. Everything else is fetched from DNS automatically using Resolve-DNSName.

# 1. Build the game engine
cd managed-doom
dotnet publish ManagedDoom/ManagedDoom.csproj -c Release -f net8.0 -o publish-out

# 2. Load Cloudflare credentials
Import-Module .\TXTRecords\TXTRecords.psm1
Set-CFCredential -ApiToken (Read-Host 'API Token' -AsSecureString)

# 3. Upload to DNS
.\Publish-DoomOverDNS.ps1 `
    -PublishDir 'managed-doom\publish-out' `
    -WadPath    'DOOM1.WAD' `
    -Zones      @('example.com')

Parameter Default Description
-PrimaryZone (required) DNS zone where stripe-meta records live
-DnsServer (system default) Specific DNS resolver IP (e.g. '1.1.1.1')
-WadName 'doom1' WAD type: doom1, doom, doom2, plutonia, tnt
-DoomArgs '' Arguments forwarded to the engine (e.g. '-warp 1 3 -skill 5')
-WadPrefix 'doom-wad' DNS prefix for the WAD stripe
-LibsPrefix 'doom-libs' DNS prefix for the DLL bundle stripe

Use -DnsServer '1.1.1.1' if records haven't propagated to your local resolver yet.

Parameter Default Description
-PublishDir (required) Path to dotnet publish output directory
-WadPath (required) Path to the WAD file
-Zones (required) Ordered array of Cloudflare DNS zone names
-WadPrefix 'doom-wad' DNS prefix for the WAD stripe
-LibsPrefix 'doom-libs' DNS prefix for the DLL bundle stripe
-Force $false Skip confirmation prompts when overwriting

Uploading requires a Cloudflare API token with Edit zone DNS permissions. Load it with Set-CFCredential from the TXTRecords module (see Quick Start above).

A Free zone holds 185 data chunks; Pro/Business/Enterprise hold 3,400. The WAD alone needs ~1,199 chunks, so Free-tier users need multiple domains. Pass them as an array to -Zones and the module distributes chunks automatically. A single Pro zone fits everything.

Resuming interrupted uploads

If an upload is interrupted, Publish-TXTStripe supports -Resume — it verifies the hash, finds the last good chunk, and picks up where it left off.

Upstream managed-doom uses Native AOT, which can't be loaded via Assembly.Load(). This fork converts it to a framework-dependent .NET 8 assembly with stream-based WAD loading and Win32 P/Invoke for windowing (no GLFW, no audio — uses built-in NullSound/NullMusic stubs).

managed-doom | Silk.NET | TrippyGL | DOOM1.WAD (id Software) | Cloudflare DNS API

联系我们 contact @ memedata.com