GGua REFERENCE日本語GitHub ↗
PLAYWRIGHT-STYLE UI AUTOMATION FOR GAMES

Drive game UI by meaning.

Gua is a game testing and automation protocol for Godot and Unity, built around Playwright-like design principles. Semantic UI Tree automation remains its core, with the World Object Tree, gameplay input, MCP and WebMCP, AI agent exposure policy, virtual time, Recording, and visual comparison. AI can develop and verify a game, then use approved information and operations to play its release build as a player.

An AI agent uses the Gua MCP server to inspect the semantic UI tree and remotely activate the Start Game button in a Godot game
DEMO An AI agent operates game UI through MCP
TWO AI USE CASES

AI builds the game. AI plays the release.

Gua supports both an AI that assists the developer and an AI that participates in the game. They do not receive the same information or permissions.

AI-assisted development and verification

An AI coding agent changes code and uses the Debug profile to inspect UI, logs, and screenshots, verify the result, and fix failures.

AI player in a release build

An AI agent player uses the Player profile to read approved UI and World information and advances the game with only authorized UI operations and gameplay input.

GET THE LATEST

Start with the latest release

Download the Godot add-on and Windows Inspector from GitHub Releases / Latest. Building Gua from source is intended for contributors working on Gua itself.

HOW IT WORKS

Observe the real input path

01 / DRAWThe game engine renders UI normally
02 / REFLECTThe adapter collects semantic state
03 / CONNECTThe bridge publishes it over WebSocket
04 / ACTTests, Inspector, and MCP operate it
WHAT YOU CAN DO

Observe, operate, verify, and reproduce through one protocol

Gua goes beyond UI testing. It exposes UI, explicitly selected game-world information, and authorized gameplay input through one semantic protocol used consistently by tests, Inspector, MCP, WebMCP, Recording, and visual comparison.

OBSERVE / 01

Observe UI as a meaningful tree

Read id, role, text, hierarchy, and bounds together with visible, enabled, value, focus, checked, selected, caret, scroll, and range state, all tied to a frame and revision.

Semantic UI Tree · Node state · Logs · Runtime capabilities
LOCATE / 02

Find controls by role and state

Match id, role, text, and value exactly, by substring, or by regular expression. Combine parent scope, direct children, visibility, enabled, selection, and count conditions.

GetById · GetByRole · GetByText · Within · QueryAll
ACT / 03

Operate the game's normal input path

Send click, focus, value, check, select, scroll, and key actions to semantic targets. Confirm the correlated host completion event instead of treating queue acceptance as success.

Click · SetValue · SetChecked · Select · Scroll · PressKey
TEST / 04

Wait for UI state in ordinary tests

From NUnit, xUnit, MSTest, or C++, wait for visibility, values, focus, selection, counts, and stable snapshots. Build deterministic tests without fixed sleeps.

Gua.Testing · C++ helpers · Async waits · Cancellation
CAPTURE / 05

Capture a rendered frame as PNG

Request PNGs from rendered Godot or Unity runs and save them with dimensions, session, and frame metadata. Headless, unsupported, timeout, and cancellation remain distinct outcomes.

CaptureScreenshot · SaveScreenshot · Test attachment
VISUAL / 06

Detect PNG baseline regressions

Gua.Testing.Visual supports pixel thresholds, allowed difference ratios, masks, and OS/renderer variants. Failures produce Expected, Actual, Diff, and a comparison manifest.

Baseline comparison · Masks · CI artifacts
RECORD / 07

Record and replay semantic actions

Gua.Testing.Recording stores actions, timing, revisions, and wait conditions, then replays with host completion checks. Sensitive values are represented only by secret keys.

GuaRecorder · GuaReplayer · recording.schema.json
DIAGNOSE / 08

Keep evidence from the failing moment

Collect the UI tree and diff, pending requests, event history, logs, runtime version, environment, screenshot, and game-process output into one failure artifact.

Failure diagnostics · stdout/stderr · Strict isolation
INSPECT / 09

Investigate and operate through Inspector

The browser and Windows desktop Inspector show the tree, node state, logs, and screenshot. Invoke every semantic action, Recording, Replay, and Visual comparison from the UI.

Tree inspector · Node bounds · Automation panel
AGENT / 10

Connect development AI and AI players

During development, gui-mcp exposes Debug capabilities. For a native release build, the host must configure gui-mcp with the Player profile; browser WebMCP is always fixed to Player. Both paths then expose only Player-scoped observation and operations.

Debug development · Player gameplay · MCP · WebMCP
WORLD / 11

Observe opted-in world objects

Publish stable doors, objectives, enemies, and checkpoints as a separate read-only tree with semantic state and player visibility.

World Object Tree · Selectors · Waits · Inspector
INPUT / 12

Drive bounded gameplay input

Expose a Semantic Game Action map or capability-gated raw input with owner isolation, bounded leases, confirmation, and neutral cleanup.

Action Map · Keyboard · Pointer · Gamepad · Text
POLICY / 13

Show an AI player only safe information

Keep developer Debug data complete while the game restricts the UI and World information and UI operations exposed to an AI player.

Debug / Player · Field rules · Action allowlist
WEBMCP / 14

Expose Web exports inside the browser tab

Register Godot Web or Unity WebGL semantic tools through the page's experimental WebMCP API without a separate MCP server or WebSocket.

gua-webmcp · Godot Web · Unity WebGL · Player profile
ENGINE SUPPORT

Automatically reflect real Godot and Unity UI

Godot 4.7

The recommended GDScript add-on recursively reflects the Control tree, including Button, LineEdit, TextEdit, CheckBox, OptionButton, ItemList, Range, and ScrollContainer. The external host manages scene startup, available ports, headless/rendered runs, stdout/stderr, and strict resets.

Unity 6

The UPM package automatically reflects UI Toolkit, uGUI, and TextMeshPro. External tests can launch Editor Play Mode or a Windows Mono Player for headless semantic tests and rendered Screenshot or Visual tests.

RELIABLE AUTOMATION

Built to keep tests deterministic

State-based waits

Wait for visible, enabled, text, value, focus, checked, selected, count, or a stable snapshot from fresh frames.

Strict locators

Zero or multiple matches fail clearly; multi-result queries are explicit through QueryAll.

Request correlation

Pair actions with observed host results by request ID without consuming unrelated events.

Test isolation

Strict reset detects pending requests, in-flight actions, and leaked events between tests.

Secret handling

Redact sensitive values from snapshots, logs, diagnostics, and recordings, resolving them in memory only during replay.

CI reproduction

Run ordinary dotnet test with the public Godot Action and retain diagnostic and Visual artifacts on failure.

GUIDES & REFERENCES

Choose by how the parts relate

The guides are grouped into getting started, exposing the game, operating it with AI, testing and inspection, and cross-cutting safety and reproducibility.

1. Integrate an engine and get started

Begin with your game engine, AI-assisted development, or AI player support.

2. Expose game information and input

Define which UI, world, and input semantics the game provides.

3. Connect and operate with an AI agent

Use the published UI, world, and gameplay input through the connection that fits the runtime.

4. Test and investigate failures

Inspect live state, compare rendered output, and record reproducible operations.

5. Improve safety and reproducibility

Apply these cross-cutting controls across tests and AI play rather than through one connection method.

Docs and API reference

Consult protocol, package, API, and CI details while implementing an integration.