Communityコーディング&開発github.com

game-automation

エージェントが実際のゲームを起動・操作・監視し、自作Modをテストできるようにするスキル。Steamやexeからの起動、固定サイズのウィンドウモード、GPUセーフなスクリーンショット、メニュー操作、キー入力、相対マウス移動、クラッシュレポートのクリーンアップ、PIDによる強制終了、ログ読み取り、スクリプト化されたテストシーン、ゲーム内JSONブリッジなどをカバー。Windows(WSLからも可)を優先し、LinuxとmacOSの注記も含む。Modを実際のゲームで確認する必要があるとき、メニューを自動操作するとき、再現可能なテストやデモシーンを構築するときに使用する。

game-automation とは?

このスキルは、AIエージェントが実際のゲームアプリケーションを操作・監視し、自作Modやスクリプトの動作を検証するための包括的な自動化フレームワークを提供します。主にWindows(WSL経由も含む)を対象とし、Steamやexeからのゲーム起動、固定サイズのウィンドウモード設定、GPUキャプチャを用いたスクリーンショット撮影、マウスクリック・キーボード入力・相対移動(FPSカメラ用)などの操作コマンドを備えています。さらに、ゲーム内にJSONラインソケットを埋め込むブリッジ機構により、ピクセル操作に頼らない高レベルな観測・指示が可能です。クラッシュレポートの後処理やイベントビューアからのログ取得にも対応しており、人とエージェントの安全な協業ルール(オンラインモードの誤操作防止、アイドル時間の確認など)も明文化されています。Linux(X11/Wayland)およびmacOS向けの代替コマンドも記載されており、マルチプラットフォームでの利用を考慮した設計となっています。

対応~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/rehan-remade/universal-modder/tree/main/skills/game-automation

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

ゲーム自動化:エージェントの手と目

実際のゲームこそがオラクル(判断基準)です。ループは「起動 → ナビゲート → シーン設定 → 動作 → スクリーンショット撮影とログ読み取り → 判断」です。ゲームごとに一度構築すれば、以降の変更はすべて1分以内に確認できます。

Windows(ネイティブまたはWSLから):um win

um win setup                                   # 一度だけ:PowerShellツールとgfxcapture対応ffmpeg、NVENC/AMF/QSV/x264を自動選択
um win ps                                      # ウィンドウプロセスの一覧:pid, name, title
um win launch --steam 105600                   # または:um win launch "C:\Games\Foo\Foo.exe" -- -windowed
um win shot --exe Terraria.exe shot.png --scale 0.33   # 全体フレーム+1/3サイズの確認用軽量コピー
um win drive --proc Terraria "focus" "click 640 360" "key 0x1B" "type hello" "hold 0x44 1500"
um win drive --proc Terraria "hold 0x20 150" "sleep 200" "hold 0x20 150"   # sleep <ms> はステップ間の待機(ミリ秒)
um win drive --proc Terraria idle              # ユーザーが最後にマウス/キーボードに触れてからの経過秒数(待機しない)
um win kill <pid>                              # 正確なPIDのみ
um win reg get "HKCU\Software\..."             # レジストリ読み取り(reg set は事前にキーをバックアップ)

Python(長いスクリプト用)では from um.win import Drive, shot, Recorder として、d = Drive("AoE2DE_s")、d.focus()、d.click(x, y)、d.key("0x0D") と使います。

WinDrive コマンド(um/ps1/WinDrive.ps1、stdin プロトコル、各応答は1行)。座標はゲームウィンドウのクライアント領域を基準とします。

  • マウス:move x y、click x y [right]、mdown/mup、drag x0 y0 x1 y1、rel dx dy(FPSカメラ/生入力用)、wheel 120。
  • キーボード:key <vk> [tap|down|up]、hold <vk> <ms>、type <text>、scanmode on(仮想キーイベントを無視するDirectInput/生入力ゲーム用)。
  • ウィンドウ:focus、rect、size <w> <h>(クライアントサイズ設定)、title、fg、idle、untop。
  • タイミング:sleep <ms> は1回の呼び出し内のステップ間で待機します。各 um win drive 呼び出しは PowerShell を起動するため(1~2秒)、時間指定のあるコンボは1回の呼び出しにまとめてください。
  • 仮想キーコード:Esc 0x1B、Enter 0x0D、Space 0x20、W/A/S/D 0x57/0x41/0x53/0x44、F1 0x70、Shift 0x10、Ctrl 0x11、矢印 0x25~0x28。

ルール

  • 人間が入力中のオンラインモードのゲームにフォーカスを当てないこと。 実際にGTA Vで発生しました。エージェントがストーリーモードをクリックするためにGTAにフォーカスを当てたところ、人間のキー入力がGTAのランディングページに送られ、「改造バージョンでGTA Onlineサーバーにアクセスしようとしている」という警告が出ました。ScriptHookVがブロックしましたが、それに頼らないでください。idle を確認し、人間にクリックを依頼するか、起動時にアンチチートをオフにしてオンラインが起動しないようにしてください。詳細は knowledge/techniques/driving-real-games-safely.md を参照。
  • 入力はゲームにのみ送られます。 WinDrive は、他のアプリケーションが前面にある場合は送信を拒否します。唯一の例外は、前面アプリがなく、カーソルがゲーム上にある場合です(ウィンドウモードのゲームでは、クリック時に前面が外れることがあります)。
  • ユーザーがPCの前にいる可能性があります。 idle が1分未満の場合は、操作前に確認し、セッションを短く保ってください。ユーザーが許可した場合は無人実行も問題ありません。
  • スクリーンショットはトークンを消費します。 --scale 0.33 のコピーを確認してください。クリック座標は逆算して×3に変換し、メニューのクリックポイントは一度測定して MODLOG.md に表として保存してください。
  • gfxcapture の理由: GPU レンダリングされたゲームは、GDI キャプチャでは真っ黒になります。gfxcapture(Windows.Graphics.Capture)は、カバーされている場合でも1つのウィンドウの実際のフレームを取得します。最小化されたウィンドウはキャプチャできません。
  • HDR ディスプレイ: SDR ゲームで Windows Auto HDR が有効な場合、キャプチャは色あせて表示されます(2~3倍明るく、シアンシフト)。色の判断ができなくなります。um win shot/record は有効時に警告を表示します。キャプチャ中はゲームの Auto HDR をオフにし(設定 > システム > 表示 > グラフィック > 該当ゲーム > Auto HDR)、ユーザーが希望する場合はキャプチャ後に再度オンにしてください。

ウィンドウを予測可能にする

  • 固定クライアントサイズのウィンドウモード。 すべてのゲームにこの設定がどこかに隠れています:
    • ini ファイル(UE の GameUserSettings.ini の [/Script/Engine.GameUserSettings]、Unity の Screenmanager Fullscreen mode / Resolution レジストリ値 HKCU\Software\<company>\<product>);
    • 起動フラグ(-windowed -w 1920 -h 1080、Unity -screen-fullscreen 0 -screen-width 1920 -screen-height 1080、Source -sw -w 1920 -h 1080);
    • またはゲーム固有のレジストリ(AoE2:Mode Display 0 + Windowed Width/Height)。
    • um win drive --proc X "size 1920 1080" でほとんどのウィンドウモードゲームをリサイズできます。
  • イントロをスキップ: 起動フラグ(-skipintro、-nosplash、Unity -popupwindow)、またはゲームのコピーでイントロ動画を削除/リネーム。
  • 直接ゲームを開始: ローダーフラグ(tModLoader -skipselect Player:World)、テスト用セーブ、シナリオ自動読み込み、開発コンソールコマンド。
  • バックグラウンドスロットリング: 多くのゲームはフォーカスがないとスロットリングや一時停止を行います。設定を探してください(Terraria:Main.instance.InactiveSleepTime = TimeSpan.Zero;Unity:Application.runInBackground = true;UE:t.IdleWhenNotForeground 0)。

クリックより優れた方法:スクリプト化されたシーンまたはブリッジ

  • Mod内のチャットまたはコンソールコマンドでアイテムを付与、敵をスポーン、テレポートできます。テストは1行で済みます(/arsenal、/mothership)。
  • テストシーン: Mod側のタイムライン(フレームNでウェーブをスポーン、N+30で発射)、トリガー付きシナリオ(AoE2ScenarioParser を使用した AoE2)、バックアップ付きの専用テストワールド。
  • エージェントブリッジ: Mod内の 127.0.0.1 上のJSONラインソケット(examples/terraria-tmodloader/reference/AgentBridge.cs 参照)。
    • コマンド例:observe(メニューオプションまたはワールド状態をテキストで返す)、click <id>、controls、step。
    • すべてのリクエストはゲームのメインスレッドで更新後に処理され、応答が一貫するようになります。
    • UIツリーからメニューを汎用的に読み取り、エージェントがプレイヤーと同じものを認識できるようにします。破壊的なボタン(削除など)は除外してください。
    • エージェントはピクセルを使わずにプレイできるようになります。
  • プロセス外バックエンド: ゲーム内部分は薄く保ち、頭脳(HTTP/ファイルドロップ)は外部に置きます。このパターンはAI NPCやクロスゲームマッシュアップにも拡張できます。

クラッシュとクリーンアップ

  • クラッシュレポーター(BugSplat BsSndRpt64.exe、CrashReportClient.exe、UnityCrashHandler64.exe)が残留し、Steamに「既に実行中」と表示させることがあります。um win ps で特定し、um win kill <pid> でクリアしてください。
  • pkill -f やワイルドカード taskkill /IM は絶対に使用しないでください。パターンが自分のシェルや他のアプリケーションに一致する可能性があります。
  • クラッシュ後は、最初にローダーまたはゲームのログ(mod-any-game スキルにリストあり)を読み、次にWindowsイベントビューア(アプリケーションログ)でネイティブクラッシュを確認してください。

Linux と macOS

  • Linux(X11): xdotool search --name "Game" windowactivate --sync key Escape、xdotool mousemove --window $W 640 360 click 1。スクリーンショット:import -window $(xdotool search --name Game) shot.png、または ffmpeg x11grab。
  • Linux(Wayland): ydotool + grim。Proton ゲームはWine上のWindowsゲームです。起動オプション(WINEDLLOVERRIDES、PROTON_LOG=1)はSteamに設定します。
  • macOS: screencapture -l <windowid> shot.png(ウィンドウIDは GetWindowID またはAppleScriptで取得)、osascript / cliclick で入力。入力と画面録画には、ターミナルに対するアクセシビリティと画面録画の許可が必要です。

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

asset-pipeline

Turn generated or hand-made art into exactly what a game engine loads. Covers sprite cutout, trim and nearest-neighbour fitting to frame sizes, pixelation to a palette, sprite sheets and strips, player/team-colour masks, seamless textures, and rendering a 3D model into sprite frames from the game

fal-assets

Generate game assets with fal (fal.ai) through the fal MCP server, the `um fal` CLI (REST) or `fal api`. Covers sprites and icons with transparent backgrounds, consistent variants and animation frames, pixel art, seamless textures, PBR material maps, image-to-3D models, remeshing, auto-rigging, sound effects, music, voice lines, and trailer or cutscene video. Use whenever a mod needs new art, audio or 3D models, or the user mentions fal, generating sprites, textures, models, SFX or music for a game.

game-recon

Figure out how a specific installed game can be modded, before writing any mod code. Covers where it

game-research-websearch

Research a game, engine or modding technique on the open web with archive-aware, rate-limit-safe searches — Wayback Machine/archive.today for dead forums (XeNTaX, Zenhax, old threads), GitHub code/repo search, Nexus/Steam Workshop/Thunderstore APIs, Reddit JSON, YouTube transcripts, plus archive snapshots as evidence. Use when starting work on a game (

mashup-mods

Build cross-game mashups and total conversions, the

mod-any-game

Mod a PC game the user owns, taking an idea to working in the real game and recorded. It covers new items, weapons, enemies, bosses, units, civilizations, mechanics, art, sound, VR and cross-game mashups. Use when the user wants to mod, extend, hack on, reverse engineer or mash up a game (

port-a-mod

Port an existing mod to a newer game version or another mod loader while keeping its behaviour, values and quirks. Typical cases are an old Forge 1.7.10 or 1.12 Minecraft mod moving to modern Fabric or NeoForge, a Skyrim LE plugin moving to SE/AE, or a tModLoader 1.3 mod moving to 1.4. It covers pinning one source version, a private decompiled reference, an adaptation matrix, extracting the mod

publish-mod

Package and release a finished game mod. Covers the pre-release lint (no game files, decompiled code or leaked keys), README and install steps, credits and AI disclosure, versioning, where to upload (Nexus Mods, Steam Workshop, Thunderstore, mod.io, GitHub releases), and the post with a video. Use when the user wants to ship, share, upload, release or post a mod.

reverse-engineering

Read how a game actually works so a mod can hook it. Decompile .NET/Mono (ILSpy), IL2CPP (Cpp2IL, Il2CppDumper), Java (Vineflower) and native code (Ghidra, IDA, via MCP servers); dump data and asset formats; reverse-engineer a binary file format and prove it with a round trip; read live memory (Cheat Engine, Frida, x64dbg); find render passes (RenderDoc). Use when a mod needs game internals, e.g.

share-field-notes

Search and contribute to the shared AI-modding knowledge base, where field notes record how specific games were modded, decompiled or reverse-engineered (exact versions, route, engine facts, verification, gotchas). Use before starting work on a game (

showcase-video

Record and cut a short showcase video of a game mod, or a compilation of clips, ready to post on X/YouTube. Records the game window with only the game

関連スキル