rea-games

GitHub

逆向工程游戏行为并重建端口,通过记录输入、生成规范、构建纯逻辑端口及逐帧验证确保行为一致。

skills/rea-games/SKILL.md erkamyaman/rea-games

触发场景

用户希望克隆或移植游戏 用户想理解游戏工作原理 指令包含 'rea this game'

安装

npx skills add erkamyaman/rea-games --skill rea-games -g -y
更多选项

不安装直接使用

npx skills use erkamyaman/rea-games@rea-games

指定 Agent (Claude Code)

npx skills add erkamyaman/rea-games --skill rea-games -a claude-code -g -y

安装 repo 全部 skill

npx skills add erkamyaman/rea-games --all -g -y

预览 repo 内 skill

npx skills add erkamyaman/rea-games --list

SKILL.md

Frontmatter
{
    "name": "rea-games",
    "description": "Reverse-engineer a game's behavior and rebuild it in another engine (web, Godot, Bevy, Unity; there is no reference Unity port yet) with proof it matches. Use when the user wants to clone, port, remake or understand how a game works, or says \"rea this game\". Records the original's inputs and state, writes a GAME.md spec, builds the port, and checks it frame by frame."
}

rea-games

You rebuild a game from what it does, and prove it. The loop is: record the original, write the spec, build the port, verify, fix, repeat. Never call a port done until rea-games verify says every case is identical.

Before you start

  1. Find out what the original is and what licence it has. A clean-room rebuild of behavior is fine; copying its art, music, names, or code is not, unless the licence allows it. Open source or permissive originals are the ones to start with (see games/*/game.json for the games that ship). If the licence is unclear, say so and ask before going on. Never use a trademarked name for the rebuild. Vendor the original unmodified under originals/<game> with its licence file, and add a line to NOTICE.
  2. Check the tools: node -v (22+), and for a browser game Playwright and a Chromium (PLAYWRIGHT_PATH points at an install outside the repository; drivers load it with loadPlaywright() from lib/playwright.mjs).

The loop

  1. Scaffold: rea-games new <game> makes games/<game>/ with game.json, record.mjs, GAME.md and a port stub.
  2. Make the original deterministic. Three things vary between runs: time, random numbers, and input timing.
    • Replace the clock and requestAnimationFrame with a fake you step by hand (dt per step is an input).
    • Replace Math.random with a seeded generator and save every value it returns in the case as tape. The port reads those numbers back in the same order. If the original draws random numbers for things that do not change play (clouds, particles), give those a separate stream and say so in GAME.md.
    • Never edit the original. Wrap the browser, not the game.
  3. Record cases (rea-games record <game>): each case is {tape, inputs, trace}. A trace entry is the state after one input or frame. Read it from the live game, or, when the state is private, from what it draws. Cover: every kind of enemy/obstacle/item, win, lose, restart, the edges (empty, full, maximum speed), odd frame times, and at least one saved state that is one step from each ending. Look at what the cases really contain.
  4. Write GAME.md from the recording: constants, the order of operations inside one step, formulas, quirks (including bugs the original has: keep them, the port must match), and what is not modelled and why that cannot change the trace.
  5. Write the port as pure logic: no DOM, no clock, an injected rng. A runner reads a case on stdin and prints {trace, tapeUsed}. Do not translate the original line by line; write from GAME.md, then check.
  6. Verify: rea-games verify <game> --port <name>. The first difference is printed with its path (trace[412].tRex.yPos: 46 != 45.5). Fix the port, not the case. Use the number, not a guess.
  7. Break it on purpose in at least three ways (change a constant, an offset, an off-by-one) and see verify fail each time with a trace difference, not a crash. A check that cannot fail proves nothing. Put the numbers in the PR.
  8. Play it in the engine: a web page with your own art, then Godot/Bevy/Unity ports that run the same cases. There is no reference Unity port yet, so a Unity port has no example to copy. An engine port counts as verified only when it runs the cases through a runner; otherwise label it "not verified".
  9. Register and pack. List each port under ports in game.json: cmd (the runner, run from games/<game>), optional build (run once before the cases), and play for the web page that node scripts/bundle.mjs turns into docs/play/<game>.html. Then run rea-games pack <game>: the repository keeps cases gzipped, and a successful record removes the old packed copies. See CONTRIBUTING.md for the rest of the PR checklist.

Rules

  • Traces come only from running the original. Never write a trace by hand.
  • Do not loosen a comparison to get green (no rounding, no tolerance) unless GAME.md says why and how much.
  • Report honestly: cases, inputs, what is covered, what is not, what fails.
  • New game licences go in NOTICE.

版本历史

  • f070a83 当前 2026-11-28 07:12

    更新游戏列表至三个,增加Play页面链接、Mines卡片、更安全的录制功能,并在列表中显示所有者/仓库信息,技能说明与CONTRIBUTING保持一致。

  • f84bce3 2026-11-27 19:01

元信息

文件数
0
版本
f070a83
Hash
2241d17c
收录时间
2026-11-27 19:01

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-28 09:59
浙ICP备14020137号-1