返回顶部
p

pokemon-red宝可梦红自动玩

Play Pokemon Red autonomously via PyBoy emulator. The OpenClaw agent IS the player — starts the emulator server, sees screenshots, reads game state from RAM, and makes decisions via HTTP API. Use when an agent wants to play Pokemon Red, battle, explore, grind levels, or compete with other agents. Requires Python 3.10+, pyboy, and a legally obtained Pokemon Red ROM.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.2.0
安全检测
已通过
2,252
下载量
免费
免费
4
收藏
概述
安装方式
版本历史

pokemon-red

宝可梦 红 — 你就是训练家

你直接游玩《宝可梦 红》。无需中间脚本。你启动模拟器服务器,通过其HTTP API获取截图和状态,查看屏幕,决定下一步行动,并发送指令返回。

初始设置(首次使用)

克隆仓库并安装依赖:
bash
git clone https://github.com/drbarq/Pokemon-OpenClaw.git
cd Pokemon-OpenClaw
pip install pyboy pillow numpy fastapi uvicorn requests

将合法获取的ROM文件放置在 ./PokemonRed.gb

将 POKEMON_DIR 设置为克隆仓库的路径(默认:~/Code/pokemon-openclaw)。

启动会话

bash

启动模拟器服务器(后台进程)


cd $POKEMONDIR && python scripts/emulatorserver.py --save ready --port 3456

回合循环

每回合按顺序执行以下操作:

1. 获取状态 + 截图

bash curl -s http://localhost:3456/api/state curl -s http://localhost:3456/api/screenshot -o /tmp/pokemon_current.png

然后使用 image 工具查看截图。行动前务必先查看。

2. 决策:导航还是手动操作?

旅行时使用导航——它会阻塞直到你到达目的地、遭遇战斗或卡住:
bash
curl -s -X POST http://localhost:3456/api/navigate \
-H Content-Type: application/json \
-d {destination: 常磐市}

导航返回以下状态之一:

  • - status: arrived — 已到达!继续任务。
  • status: battle — 遭遇野生宝可梦中断。先战斗,然后再次导航。
  • status: stuck — 无法到达目的地。尝试手动按键或选择不同路线。
  • status: error — 未知目的地或无路径。检查目的地列表。

响应始终包含完整的游戏状态,因此你能确切知道自己的位置。

重要提示: 导航会阻塞——在curl调用中设置较长的超时时间(60-120秒)。

先检查可用目的地:
bash
curl -s http://localhost:3456/api/destinations

检查哪些地图有寻路数据:
bash
curl -s http://localhost:3456/api/maps

仅在以下情况回退到手动按键:

  • - 导航返回 stuck 或 error
  • 你在建筑物内进行特定交互
  • 你处于对话或菜单中

3. 手动控制(需要时)

bash

移动/交互

curl -s -X POST http://localhost:3456/api/press \ -H Content-Type: application/json \ -d {buttons: [up,up,a], reasoning: 走向门口}

有效按键:up、down、left、right、a、b、start、select。每回合发送1-5个按键。

4. 战斗(当状态中 in_battle 为 true 时)

  • - 战斗: 按 a 打开战斗菜单,再次按 a 选择战斗,导航到招式,按 a 确认,然后连续按 a 跳过动画
  • 逃跑: 按 a,然后按 down、right、a 选择逃跑,连续按 a 跳过文本
  • 检查状态——如果仍处于 in_battle,重复操作

5. 任务追踪

bash curl -s http://localhost:3456/api/quest # 当前目标 curl -s -X POST http://localhost:3456/api/quest/complete \ -H Content-Type: application/json \ -d {lesson: 门在x=12的位置} # 推进步骤 + 保存经验

6. 频繁保存

bash curl -s -X POST http://localhost:3456/api/command \ -H Content-Type: application/json \ -d {command: save, name: checkpoint_viridian}

关键端点

端点方法用途
/api/stateGET从内存获取游戏状态(位置、队伍、徽章、战斗)
/api/screenshot
GET | 游戏画面的PNG截图 | | /api/navigate | POST | 寻路到指定目的地 | | /api/destinations | GET | 列出所有导航目的地 | | /api/maps | GET | 哪些地图有寻路数据 | | /api/press | POST | 发送按键指令 | | /api/quest | GET | 当前任务和步骤 | | /api/quest/complete | POST | 标记步骤完成,可选保存经验 | | /api/knowledge | GET | 所有已学经验 | | /api/knowledge/lesson | POST | 添加新经验 | | /api/command | POST | 保存/加载/速度指令 |

策略优先级

  1. 1. 优先使用导航。 任何旅行都使用 /api/navigate。它会阻塞直到到达或战斗——无需轮询。
  2. 立即处理战斗。 如果导航返回 status: battle,先战斗(连续按A),然后再次导航到同一目的地。
  3. 检查任务。 始终了解当前目标。不要漫无目的地游荡。
  4. HP管理。 低于30% → 考虑治疗。低于15% → 必须治疗。导航到最近的宝可梦中心。
  5. 忽略 text_active。 文本检测标志有缺陷(始终为true)。不要连续按B来消除幻影文本。
  6. 频繁保存。 每10回合或达成任何里程碑后保存。

会话模式

子代理会话应:

  1. 1. 启动模拟器服务器(如果尚未运行)
  2. 检查任务状态和目的地
  3. 游玩20-50回合(根据需要导航+手动操作)
  4. 退出前保存状态
  5. 报告进度(位置、等级、任务步骤、任何亮点)

在 /tmp/pokemon_notepad.txt 中记录笔记,以保持会话内的连续性。

完整游戏策略

参见 references/game_instructions.md 了解《宝可梦 红》的基础知识:移动、建筑、门、战斗、属性相克、治疗和任务系统。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 pokemon-red-1776374946 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 pokemon-red-1776374946 技能

通过命令行安装

skillhub install pokemon-red-1776374946

下载

⬇ 下载 pokemon-red v1.2.0(免费)

文件大小: 7.04 KB | 发布时间: 2026-4-17 14:40

v1.2.0 最新 2026-4-17 14:40
Blocking navigate endpoint - returns arrived/battle/stuck with full state. No more polling. Includes lessons learned in docs.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部