FlorrVLM-Agent
A local game-playing capability pack (MCP server) that gives any MCP-capable agent vision-based perception, prediction, combat decisions, actions, and a persistent Markdown knowledge base.
Knowledge base (Markdown):
kb_list,kb_search(semantic search with full-text fallback),kb_write(overwrite),kb_append, pluskb_export/kb_importfor tar.gz backup and restore.Perception:
perceive_gamegrabs current state (own HP, nearby entities) and feeds the predictor; auto-falls back to synthetic frames with a_fallbackflag when no perception service is available.reset_predictorclears history after deaths or scene jumps.Prediction:
predict_all_entitiesforecasts positions ~1.2s ahead for up to 8 entities ranked by threat, with confidence and aprediction_trustedflag.Actions:
game_actionperforms move / attack / defend / synthesize / idle (human-like jitter and pauses);switch_setchanges loadout or formation;handle_afkdeals with AFK captcha prompts. Default dry-run records instead of touching keyboard/mouse.BOSS memory:
query_boss_historyreads recorded boss behavior habits from the knowledge base.Tactics:
switch_tacticpins a Markdown file as the active tactic for subsequent decisions.Maintenance:
clean_cacheclears all caches, prediction history, or temp frames.Onboarding:
ugf_guidereturns a runtime-generated manual covering capabilities, tool list, call chains, and pitfalls.
Uses YOLO for real-time visual perception to detect and track game entities, providing the visual input for the agent's decision-making.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@FlorrVLM-Agent Check the game screen, predict entity movements, and advise fight or retreat."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🎮 Universal-Game-Framework
一个能自己跑的单文件游戏 Agent
看画面 → 预判 → 评估 → 出动作 → 查/写经验 → 复盘 → 汇报 → 学习,全在一个 agent.py 里。
中文 | English
⚠️ 声明:仅用于本地 AI 智能体技术研究。在 florr.io 官方服务器运行 bot 违反游戏服务条款,可能导致账号封禁。请在本地 / 自建 / 已授权环境使用。
这是什么(给零基础看的)
想象一个"游戏代打机器人",它每一步都做这几件事:
看:拿到当前画面里有什么(自己血量、怪物、队友)。
算:怪物下一秒会走到哪、打得过还是打不过。
查:翻自己的"经验本"(知识库),看以前遇到这种情况该怎么办。
动:按经验做出移动 / 攻击 / 切套装的动作。
记:打完一局写复盘,把有用的经验继续写进本子。
这个"机器人"就是 agent.py —— 一个文件、一条命令就能开跑,不需要装 MCP 服务、不需要别的 Agent 托管。
Related MCP server: Pokemon MCP Server
快速开始
# 1. 先离线试跑(不碰键鼠、不需要密钥,最安全)
python agent.py selftest # 全链路自检,应输出 19/19 通过
python agent.py run --dry-run --rounds 20
# 2. 看运行模式和手册
python agent.py mode
python agent.py guide
# 3. 真机开跑(需要外部感知服务 + 装了 pyautogui)
pip install "pyautogui>=0.9.54" # 有显示器 / X server 才需要
python agent.py run依赖极简:离线链路零第三方库即可跑通;真实运行建议 pip install -r requirements.txt(只有 pyyaml + requests)。
全部命令
命令 | 作用 |
| 主循环( |
| 查看运行模式(dry-run?感知后端?LLM 开没开?当前游戏?) |
| 离线自检:跑通全链路并断言关键产物 |
| 手工取一帧画面状态 |
| 手工取一帧 + 全实体 1.2s 预判 |
| 执行动作: |
| 切换套装: |
| AFK 弹窗处理指引 |
| 知识库: |
| 视频学习: |
| 生成对局报告(写 |
| 看会话记忆与历史战绩 |
| 自动调参: |
| 打印使用手册 |
能力清单(一个不少)
能力 | 在哪体现 |
感知 |
|
全实体预判 |
|
战斗评估 |
|
动态心态 |
|
知识闭环 |
|
拟人动作 | 移动抖动、随机停顿、安全区钳制、鼠标四角安全暂停 |
BOSS 记忆 | 归纳移动模式 / 追踪距离,写回知识库 |
组队协同 | 识别队友、分工、保持距离 |
死亡复盘 | 只有 BOSS / 组队局才生成复盘,避免噪声 |
会话记忆 | 断点续玩、历史战绩 |
自动调参 | 按战斗统计自动微调阈值(阈值批次写入 |
自动汇报 | 生成 Markdown 报告,可选 Webhook 推送 |
视频学习 | 逐帧 VLM 提战术,去重后写入知识库 |
配置
改参数不用改源码,全部集中在这三处(优先级从低到高):
agent.py里的内置DEFAULT(最后兜底)config.yaml(全局配置)
game_profiles/<游戏名>.yaml(游戏档案,见 game_profiles/)
改完保存即热加载生效,不用重启。
常用环境变量
复制 .env.example 为 .env 再填:
变量 | 作用 |
| 只记录动作,不碰真实键鼠(推荐先这样试) |
|
|
| 外部感知服务地址(留空则用 |
| 切换游戏档案,如 |
| LLM 决策 |
| 视频学习的视觉模型 |
| 报告推送地址 |
为什么这么轻
对比项 | 旧版(MCP 服务) | 现在(单文件 Agent) |
文件数 | 100+ 个模块 / 文档 / 工具 |
|
每回合开销 | MCP 子进程 + JSON-RPC 往返 6 次 | 进程内函数调用,零 IPC |
依赖 | flask / mcp / numpy / psutil / dotenv… | 核心只需 |
离线可跑 | 需要装一堆包 | 只用标准库即可跑通 dry-run 全链路 |
细节设计:requests / yaml / pyautogui / cv2 全部惰性 import;
预判与战斗评估是纯 math,不引入 numpy。
测试
pip install pytest
python -m pytest tests/ -q # 单元测试
python agent.py selftest # 端到端离线自检CI(.github/workflows/ci.yml)会在 Python 3.11 / 3.13 上跑这两项。
文档
文档 | 内容 |
分层架构、数据流、模块地图、配置优先级、可靠性设计 | |
30 分钟接入一款新游戏(含常见错误速查) | |
安装 / 感知 / 知识库 / 排障 / 合规常见问题 | |
5 分钟 Demo 走查( | |
Windows / Linux 常驻运行(计划任务 / NSSM / systemd) | |
技术优化路线图(26 项,v3.1.0 已全部落地) | |
版本变更记录 |
目录结构
Universal-Game-Framework/
├── agent.py # 全部能力都在这里(单文件 Agent)
├── config.yaml # 全局配置(阈值 / 路径 / 降级链,可热加载)
├── game_profiles/ # 游戏档案:florr / demo_arcade / space_invaders
├── docs/ # 架构 / 新游戏接入指南 / FAQ
├── tests/ # 150+ 项测试(含故障注入与 fuzz)
├── tools/secret_scan.py # 密钥防泄漏扫描(pre-commit + CI)
├── src/ugf/ # 模块化分片源(build.py split/agent 与单文件互转)
├── build.py # 构建工具:zipapp 分发 + 分片↔单文件互转与一致性校验
├── ROADMAP.md # 优化路线图(26 项)
├── CHANGELOG.md # 版本变更记录
├── requirements.txt # 依赖(核心只有 pyyaml + requests)
├── pyproject.toml # pip install . 后可用 ugf 命令
├── Dockerfile # 多阶段构建 + 非 root + 健康检查
├── docker-compose.yml # 容器编排示例
├── start.bat / start.ps1 # Windows 一键启动
└── README.md运行期会自动生成(已在 .gitignore 中忽略):
knowledge_md/(经验本)、run_logs/(日志与报告)、agent_state.json、session_history.json。
贡献与安全
参与贡献:CONTRIBUTING.md(双源工作流 / 质量门槛 / 提交规范)
报告漏洞:SECURITY.md(请走 GitHub 私密通道,勿开公开 Issue)
Issue 模板:Bug 报告 / 功能建议
License
MIT,见 LICENSE。
Available Tools
16 toolsclean_cacheA
清理运行期缓存。
入参:target 取 all(默认,清全部)/ predict(只清预判历史)/ frames(只清临时帧目录)。 返回:清理结果文本。 用途:长时间运行后释放磁盘;换局前保证预判数据干净。 下一步:清完预判历史后重新连续 perceive_game 积累帧;长时间运行前可先清 frames 省磁盘。
Inputs: target. Returns: result
game_actionA
执行一个游戏动作。
用途:把决策落地成实际操作。 入参:action_type 必填,取 move / attack / defend / synthesize / idle; move 时必须给 x、y 目标坐标(内部会做拟人化路径微扰和偶发停顿)。 切换套装请用 switch_set,不要用本工具。 返回:动作执行结果文本。默认 dry-run(UGF_DRY_RUN=1)只校验参数并返回描述, 不会真的动键鼠;只有在获得授权的环境里才关闭 dry-run。 下一步:回到 perceive_game → predict_all_entities 的循环;遇到 AFK 弹窗用 handle_afk。
Inputs: action_type (required), x, y. Returns: result
handle_afkA
处理游戏内的 AFK 人机验证弹窗。
用途:长时间挂机触发验证时调用。 入参:无。 返回:操作指引文本。 下一步:结合 perceive_game 返回的弹窗坐标,用 game_action(move) 完成点击验证。
Inputs: no named parameters. Returns: result
kb_appendA
向知识库已有文档追加内容(文档不存在则自动新建)。
用途:一局结束后补一行结论、给 BOSS 习性加一条新观察。 入参:filename、markdown_content、game_name(可选,分类文件夹)。 返回:成功为「已追加到知识库: <路径>」;失败返回「错误: ...」。 下一步:配合 kb_search 复用这些累积经验。
Inputs: filename (required), markdown_content (required), game_name. Returns: result
kb_exportA
把整个知识库(活跃 + 归档)打包成 tar.gz 备份。
用途:换机迁移、定期备份。 入参:无。 返回:备份文件路径或状态文本。 下一步:在新机器上用 kb_import 恢复。
Inputs: no named parameters. Returns: result
kb_importA
从 kb_export 生成的 tar.gz 备份恢复知识库(同名文件覆盖)。
入参:backup_path,备份文件的绝对路径或相对项目根目录的路径。 返回:恢复结果文本(含恢复的文件数)。 下一步:kb_list 确认恢复结果,kb_search 抽查具体内容。
Inputs: backup_path (required). Returns: result
kb_listA
列出知识库里已有的 Markdown 文档名。
用途:动手前先看本地有没有这个游戏的资料,避免重复研究。 入参:game_name 可选;给了就只列该游戏文件夹下的文档。 返回:JSON 字符串——文档名数组。 下一步:把感兴趣的文档名交给 kb_search 检索正文;没有相关资料就先 kb_write 建一份。
Inputs: game_name. Returns: result
kb_searchA
在本地 Markdown 知识库里做关键词检索。
用途:查某只怪 / 某个 BOSS / 某套战术的已知资料(语义检索优先,不可用时降级为全文匹配)。 入参:keyword 必填关键词;game_name 可选,限定在某个游戏文件夹内搜索。 返回:命中的文档片段文本;没有命中时返回空结果或提示文本。 下一步:把资料用于决策;资料缺失或过时就用 kb_write / kb_append 补上。
Inputs: keyword (required), game_name. Returns: result
kb_writeA
把一段 Markdown 写进知识库(不存在则新建,已存在则整体覆盖)。
用途:保存新学到的战术、怪物习性、本局结论。 入参:filename 文件名(不要带路径);markdown_content 正文;game_name 可选,用于分类到子文件夹。 返回:成功为「已写入知识库: <路径> (N 字符)」;失败返回「错误: ...」。 注意:这是覆盖写。想追加请用 kb_append。 下一步:想追加而不是覆盖,用 kb_append;写完可用 kb_search 抽查内容。
Inputs: filename (required), markdown_content (required), game_name. Returns: result
perceive_gameA
获取当前游戏画面状态(自身 HP、周围实体列表等),并自动喂给预判模块。
用途:每一步决策前先「看一眼」,也是 predict_all_entities 的数据来源。 入参:无。 返回:JSON 字符串——含自身状态与 entities 实体列表。需要连续调用多帧(≥3 帧) 后续预判才有效。感知服务不可用时会自动降级为进程内合成帧, 结果里带 _fallback 标记(离线联调照常可用,不会抛异常)。 下一步:predict_all_entities 做位置预判,或 kb_search 查资料。
Inputs: no named parameters. Returns: result
predict_all_entitiesA
预测画面中全部实体未来约 1.2 秒的位置。
用途:判断威胁、决定走位与攻击目标。 入参:无(依赖此前多次 perceive_game 积累的历史帧)。 返回:JSON 数组,按威胁从高到低最多 8 个实体,每项含 raw_id / rarity / category / threat_score / x_now / y_now / x_predict / y_predict / vx_per_sec / vy_per_sec / confidence / prediction_trusted。confidence < 0.65 时 prediction_trusted=false 且 x_predict、y_predict 为 null(此时不要相信预判)。 历史帧不足时返回 {"status": "insufficient_data", ...}。 下一步:据此决定 game_action 的 move / attack。
Inputs: no named parameters. Returns: result
query_boss_historyA
读取知识库里记录的 BOSS 行为习惯。
入参:boss_name 可选;不传返回全部记录,传了只返回名字匹配的记录。 返回:历史习性文本;无记录时返回「知识库还没有 BOSS 行为记录(文件不存在)。」 下一步:把习性用于决策,打完用 kb_append 补充新观察。
Inputs: boss_name. Returns: result
reset_predictorA
清空预判模块的全部历史帧。
用途:新开一局、重生、或画面大幅跳变后调用,避免用旧轨迹误判。 入参:无。返回:确认文本。 下一步:重新连续调用 perceive_game 积累帧。
Inputs: no named parameters. Returns: result
switch_setA
切换当前套装 / 阵型。
入参:set_name 可传当前游戏档案 combat.sets 里的名字(例如 space_invaders 的 shoot / dodge / focus_mothership),也可传决策层的抽象名 (combat / tank / retreat / chase / team),后者按档案 combat.set_map 翻译。 返回:「已切换套装: <名称> (按键 N)」;dry-run 下返回 「[dry-run] 套装切换已记录(未真实执行)」;传错名字时返回「未知套装: ...」并列出可选值。 下一步:perceive_game 确认切换生效,再继续决策。
Inputs: set_name (required). Returns: result
switch_tacticA
指定知识库里的一份 Markdown 文件作为「当前战术」。
用途:让后续决策直接读取这份战术,不用每次重新检索。 入参:tactic_file,知识库中的文档名。 返回:「已切换当前战术为: <文件名>」;文件名非法或文档不存在时返回对应错误文本。 下一步:配合 kb_search / kb_append 迭代这份战术。
Inputs: tactic_file (required). Returns: result
ugf_guideA
返回本服务的使用手册(给刚接进来的 Agent 看,不用读仓库也能上手)。
用途:第一次连接时先调用它,了解能力边界、工具清单和推荐调用顺序。 入参:section 取 all(默认,全部)/ quick(一屏速览)/ tools(工具清单)/ chains(调用链)/ notes(注意事项与常见坑)。 返回:Markdown 文本手册。工具清单由运行时动态生成,与实际注册的工具始终一致。 下一步:按手册里的调用链开始 perceive_game → predict_all_entities → game_action。
Inputs: section. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools target distinct resource+action pairs, and several descriptions proactively cross-reference each other (e.g. game_action says to use switch_set instead, kb_write points to kb_append). However, reset_predictor and clean_cache(target=predict) both clear prediction history, and query_boss_history overlaps with kb_search for boss/habit lookups, so a couple of pairs could still be confused.
All names use snake_case consistently, and the knowledge-base tools share a clear 'kb_' prefix group. The verb/noun ordering is mixed, though (kb_list/kb_write = noun_verb vs reset_predictor/switch_set/clean_cache = verb_noun, and perceive_game/game_action are noun phrases), a minor deviation from a single predictable pattern.
16 tools is slightly above the comfortable 3-15 band but justified because the server spans several subsystems (KB lifecycle, perception, prediction, action, cache, guide). Each tool earns a place; no redundant or filler tools are present.
The surface covers the full game loop (perceive -> predict -> act) plus a near-complete KB lifecycle (list/search/write/append/export/import) and supporting utilities (AFK, cache, tactic, boss history, guide). Minor gaps remain, notably no KB delete/remove operation and boss history being read-only, but agents can work around these via overwrite and kb_append.
Maintenance
Related MCP Connectors
Official MCP server for Agentwork — delegate tasks to AI agents with human-in-the-loop
MCP server for Flux AI image generation
Cloud-hosted MCP server for durable AI memory
Hosted YouTube MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Minecraft MCP Server powered by Mineflayer API. It allows to control a Minecraft character in real-time, allowing AI assistants to build structures, explore the world, and interact with the game environment through natural language instruction22278 npm810Apache 2.0
- FlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to play Pokémon games by providing a functional interface for game interaction. It allows for seamless integration with AI clients to execute gameplay tasks and manage game states.3-
- AlicenseBqualityDmaintenanceMCP server for Vynn — self-improving AI workflows & backtesting.21MIT
- AlicenseBqualityDmaintenanceA local MCP server that gives AI agents structured task planning, execution tracking, and guided research workflows.1610 npmMIT