SUSU / PORTFOLIO
All work返回作品

Solo · MIT · Open-Source Tooling独立 · MIT · 开源工具

gridbot — black-box QA

Python · ADB · PaddleOCR · alpha (from source)

An open-source Android automation toolkit for screen-based checks when a game exposes few useful UI elements. I built modular capture, input, OCR and navigation tools that can be combined into repeatable flows. 一个开源 Android 自动化工具包,用于游戏缺少可用 UI 元素时的屏幕检查。我构建了可组合的截图、输入、OCR 与导航模块,让重复操作可以组织成流程。

My role我的职责

Capture, input and OCR modules; API design and documentation.

截图、输入与 OCR 模块;API 设计与文档。

Context项目背景

Solo · alpha 0.1.x · install from source.

独立开发 · alpha 0.1.x · 源码安装。

Core tools主要技术

Python · ADB · PaddleOCR

Problem问题

Custom-rendered game screens expose little through the standard UI hierarchy, so element-based automation can't see them.

自绘的游戏界面在标准 UI 层级里几乎没有信息,基于元素的自动化工具看不到它们。

Decision决策

Work from pixels: ADB screenshots, OCR to find visible text, ADB taps, as independent modules plus a YAML-driven navigator.

从像素出发:ADB 截图、OCR 找屏幕上的文字、ADB 点击,做成可单独使用的模块,再加一个按 YAML 走流程的导航器。

Outcome结果

An MIT-licensed alpha for repeatable menu and workflow checks. Trade-off: OCR adds latency and it is not frame-accurate.

MIT 协议的 alpha 版,适合可重复的菜单和流程检查。代价是 OCR 有延迟,做不到逐帧精确。

From screen to action从屏幕到操作

  1. Capture截图

    ADB provides an image of the current screen.

    通过 ADB 获取当前屏幕图像。

  2. Locate定位

    OCR finds the visible target text and its position.

    OCR 找到可见的目标文字与位置。

  3. Act操作

    ADB sends the tap; the next capture reveals the resulting screen.

    ADB 发送点击,再次截图查看操作后的界面。

The example below only taps when a text match is found. OCR needs readable text; it does not identify arbitrary game objects.下方示例只有匹配到文字才会点击。OCR 依赖可读文字,并不识别任意游戏物体。

from gridbot import AdbCapture, AdbInput, OcrEngine

cap = AdbCapture()
inp = AdbInput()
ocr = OcrEngine.get(fast=True)

screen = cap.screenshot()
button = ocr.find_text(screen, "Settings")
if button:
    inp.tap(*button.center)

When the screen is the interface当屏幕是可用的操作入口

Custom-rendered game screens may expose little useful information through the standard UI hierarchy. gridbot uses ADB screenshots and OCR to locate visible text, then sends taps or swipes through ADB. It provides a screen-based route when element-based automation is insufficient.

自定义渲染的游戏界面,可能无法通过标准 UI 层级提供足够的信息。gridbot 通过 ADB 截图,用 OCR 定位可见文字,再经 ADB 发送点击或滑动。当基于元素的自动化不够用时,它提供基于屏幕的操作路径。

Composable checks可组合的检查流程

Separate responsibilities. Capture returns a screen image; input sends an action; OCR finds visible text. These modules can be used independently, so a small script does not need to adopt the whole toolkit.

拆分职责。截图模块返回画面,输入模块发送操作,OCR 模块寻找可见文字。各模块可以独立使用,小脚本不需要接入整套工具。

Organise longer flows. The navigator follows YAML state graphs, and the recorder captures interactions for replay. These provide ways to organise repeated steps beyond the single text-and-tap example above.

组织较长流程。导航模块执行 YAML 状态图,录制模块记录交互以供回放,用于组织比上方单次文字匹配与点击更长的重复步骤。

Evidence shown. The snippet is an API usage example. I owned the architecture, API design, packaging and documentation.

当前展示。此代码片段为 API 用法示例。我负责架构、API 设计、打包与文档。

The tradeoff: pixels instead of app internals取舍:通过像素操作

Screen-based automation does not require modifying the target application, but text recognition introduces latency and depends on visible, readable content. It is a fit for repeatable menu and workflow checks, not a claim of frame-accurate gameplay control. The current release is an MIT-licensed alpha installed from source; it is not yet on PyPI.

基于屏幕的自动化无需修改目标应用,但文字识别有延迟,也依赖内容可见、可读。它适合重复的菜单与流程检查,不代表能进行逐帧精确的游戏控制。当前版本采用 MIT 协议,处于 Alpha 阶段,需要从源码安装,尚未发布到 PyPI。