dsh-game-core
dsh-game-bridge 的本地引擎:抓屏 + OCR + 将来的 20 Hz 闭环。
独立进程、stdio JSON 协议、不认识模型也不认识 DSH。
为什么单独一个包
- 插件壳(npm)要被 DSH 的市场沙箱干净安装,不能带原生依赖;
- Python 的 CV/OCR/手柄生态现成,引擎可以独立升级;
- 引擎崩溃不该带走 harness;harness 卸载插件时要能整棵杀掉引擎。
协议(v0,一行一条)
// 请求(region 可选:attach 到窗口后由会话自动填入)
{"id": 1, "method": "snapshot", "params": {"ocr": true, "max_width": 1280, "region": {"left": 239, "top": 203, "width": 1280, "height": 800}}}
// 成功
{"id": 1, "ok": true, "result": {"png_b64": "...", "width": 1280, "height": 800, "scale": 1.0, "region": {...}, "ocr": [...], "captured_at_ms": 0}}
// 失败
{"id": 1, "ok": false, "error": {"code": "ENCODE_FAILED", "message": "..."}}
方法:ping · selftest · snapshot · windows · events · attach · act · plan · status · stop。
attach 接受窗口标题子串(大小写不敏感):优先后台只截该窗口;找不到时返回
WINDOW_NOT_FOUND 并列出当前可见窗口,便于换关键词。传 unspecified 退回整屏。
输出后端
dry-run(默认):只记录动作,不碰设备;vgamepad:Xbox 360 虚拟手柄(ViGEmBus);keyboard:Win32 SendInput 键盘(W/A/S/D/SPACE/ENTER/ESC/ARROWS…)。
真实后端都必须经过 safety 闸与 DSH 审批;keyboard 的 SendInput 路径尚未实机验证。
自检
python -m dsh_game_core selftest # 依赖 / 显示器 / OCR 预热
python -m dsh_game_core selftest --capture # 再加一次真实抓屏(只读,不注入输入)
python -m dsh_game_core windows --limit 20 # 列出可见窗口(只读)
python -m dsh_game_core serve # 插件用的 stdio 服务
已固定下来的实测教训
- RapidOCR 必须
det_limit_type="max"、det_limit_side_len=960: 默认min会把 640×80 的 HUD 区域放大到短边 736px,det 从 ~9ms 变成 ~1.3s。 - 一次性
grab(),不开连续捕获线程:采样只有 2–5 Hz,起线程只会抢游戏帧数。 - 抓屏是只读操作;任何输入注入能力(M2)必须另有夺回热键与反作弊拒绝。
Metadata
Release files for dsh-game-core 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dsh_game_core-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for dsh_game_core-0.0.1-py3-none-any.whl |
Release files / dsh_game_core-0.0.1-py3-none-any.whl
| Download URL | dsh_game_core-0.0.1-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20e883fa6d957983e333bcb62211413c8463d446697fe42fb78134e94e04a6a9
|
|
BLAKE2b-256 checksum How to use checksums |
d23f51dfec7e185ea0be491f08e1da5796043dd82a2048e26e0c1f2fd126ad39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for dsh-game-core 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.