
值得的时间 - 是的,Claude mod 可以运行 Doom
……把它移植过来真是烦得要命。简要说说原理:mod 沙箱没有 WebAssembly,所以引擎是 mod 通过 $.process.spawn 启动的原生二进制,并通过 Unix socket 通信(Windows 上是 127.0.0.1 + token)。它用 zig cc 为 linux/macos/windows × x86_64/arm64 预构建,因此在 kitty 中不需要编译器。

关于这个 mod
……把它移植过来真是烦得要命。简单说说原理:mod 沙箱没有 WebAssembly,所以引擎是 mod 通过 $.process.spawn 启动的原生二进制,并通过 Unix socket 通信(Windows 上是 127.0.0.1 + token)。它用 zig cc 为 linux/macos/windows × x86_64/arm64 预构建,因此不需要编译器。
在 kitty 中,画面是指向引擎写入文件的 Image;Claude Code 只把路径交给 kitty,没有任何像素经过它。其他地方则使用 Raster 的象限方块(每格 4 px)。如果没有其他内容移动,Claude Code 只会绘制约 ~3 frames/s,因此游戏下方有一条每 30 ms 重绘的条带来维持画面。kitty 中约为 ~31 fps,方块模式下约为 ~35-40。
键盘输入处理非常棘手。TS 只有一个 "onPress" 事件;终端永远不会告诉你按键何时释放,只会在重复延迟后继续重复最新按键。Claude Code 只打开 kitty 的键盘 flags 5,所以 mod 也看不到释放事件。我的第一个猜测是让转向键按住 220 ms,结果按住转向会在重复开始前停住约 ~300 ms。
后来我参考了其他终端 Doom 项目模拟输入的方式:
- doom-cli:学习重复延迟,让按键保持到下一次重复即将发生
- intermission:按下后 550 ms,重复时 120 ms,只用鼠标转向
- claude-doom:每次按键发出 160 ms 脉冲
- doom-braille:沉默 100 ms 后释放
我采用了 doom-cli 的模型,再加上它自己源码 TODO 中建议的修正:在重复开始前慢慢转动。现在轻按一次约转 ~10°,不再是 ~60°;按住按键也不会停。鼠标是唯一会回报释放的输入,所以在游戏中横向拖曳时会以恰好等于 a/d 的速度转动,放开就立即停止。你可以同时用 w/s 行走、用鼠标转向。
还有一件事:目前只在 linux 上玩过。macos 和 windows 引擎虽然已经构建,但还没实际运行过;如果你使用 mac/windows,很想知道它是否可用。
/plugin marketplace add reporails/arcade /plugin install doom@reporails-arcade 然后 CLAUDE_CODE_NO_FLICKER=1 claude,再执行 /doom。
repo: github.com/reporails/arcade(MIT;引擎是 GPL-2.0,游戏数据是 Freedoom、BSD)。submitted by /u/cleverhoods [link] [comments]
安装
安装方法请查看原始来源。
原文 / README
... and it was annoying as hell to port it. how it works, short version: the mod sandbox has no WebAssembly, so the engine is a native binary the mod starts with $.process.spawn and talks to over a unix socket (127.0.0.1 + a token on windows). prebuilt for linux/macos/windows × x86_64/arm64 with zig cc, so no compiler needed in kitty the picture is an Image pointed at a file the engine writes. claude code just hands kitty the path, zero pixels go through it. everywhere else it's a Raster of quadrant blocks (4 px a cell) claude code only draws ~3 frames/s when nothing else moves, so a strip under the game redraws itself every 30 ms to keep frames coming. ~31 fps in kitty, ~35-40 with blocks keyboard managing is a nightmare, TS only has an "onPress" event. a terminal never tells you a key was released, it just repeats the newest key after its repeat delay. claude code turns on kitty keyboard flags 5 only, so mods can't see releases either. my first guess (hold a turn key 220 ms) made a held turn stop dead for ~300 ms before the repeats kicked in. what fixed it was reading how other terminal dooms fake it: - doom-cli: learn the repeat delay, hold a key until its next repeat is due - intermission: 550 ms after a press, 120 ms while repeating, mouse-only turning - claude-doom: 160 ms pulse per press - doom-braille: release after 100 ms of silence went with doom-cli's model, plus the fix its own source suggests in a TODO: turn slowly until the repeats start. a tap now turns ~10° instead of ~60°, and a held key never stops. the mouse is the only input that reports its release, so dragging sideways on the game turns at exactly the a/d speed and stops the moment you let go. walk with w/s and turn with the mouse at the same time. one more thing: played on linux only. macos and windows engines are built but they are yet to run, so if you're on a mac/windows, I'd love to know if it works. /plugin marketplace add reporails/arcade /plugin install doom@reporails-arcade then CLAUDE_CODE_NO_FLICKER=1 claude and /doom. repo: github.com/reporails/arcade (MIT; the engine is GPL-2.0, the game data is Freedoom, BSD). submitted by /u/cleverhoods [link] [comments]

