
值得的時間——沒錯,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]

