/gameframe:re-portfrom gameframe
Guides exact reimplementation of traced game behavior, mirroring structure, numeric types, and iteration order. Useful when porting game logic from traced ground truth.
Ships in gameframe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Precondition: the behaviour is traced and documented. Anything numeric has ground truth. If you find yourself inventing a rule while writing code, stop and trace it.
Read the pseudocode to understand the behaviour, then write the new code from your notes, with
clear names and the target language's own types and structure. By default, do not paste
decompiled code into the new code base: it is the original author's work. It is also unreadable. This is the line between a reimplementation and a copy; keep it visible (see
docs/LEGAL.md). If the user chooses otherwise, say this once and follow their decision.
Before you write a sound chip, a codec or a language runtime yourself, check docs/crates/:
GameFrame may already have a checked implementation (OPL2, WMA v2, the MSVC maths functions,
Turbo Pascal's Real). Compare it with your game's version before you rely on it.
0.33333331f, not 1.0 / 3.0.Original: `FUN_1400be680` . Mark guesses
inferred.Decide the shape of the reimplementation early: these are cheap on day one and expensive to add after a year.
re-verify is built on it.gameframe-voodoo, -rage, -virge, -powervr), and a modern renderer. The core never
asks a device how it drew. A pixel the original read back (grLfbReadRegion) is an input of
the core. Hooks for the extra build (record the calls, replace textures, add draws) sit on
the interface. Make one hook write each call in the format of GameFrame's call log
(WRAPPER_CALLS, docs/hardware/wrappers.md), so the port's calls compare line for line
with the original's. Write a Glide vertex by the same rules as the library: only the fields
the current state reads (wrappers/glide/src/used.rs). docs/hardware/rendering-pipeline.md
explains the stages, where each ran on each card, and what to check at each seam.The platform layer around the core (time, input, drawing, sound, the player's files, the
browser build) is in docs/working/building-the-port.md. For the player's files (game data,
saves, mods) use GameFrame's gameframe-library crate and its HTML page in
templates/library-page/, set up from one library.json. A disc image read in place goes
through gameframe-game-source. The launcher, settings, renderer choice and console around the
core are GameFrame's frame: implement gameframe_frame::Game (or speak its JSON lines, or
write a frame.json) and give each renderer an honest grade (crates/frame/README.md). The
frame is an addition, so it never changes what the core computes. Shaders and fixed-function state are
part of what the player sees: port them exactly (docs/hardware/shaders.md).
Most reimplementations add things: multiplayer, a server, mod support, a debug probe, a new camera, a browser version. Keep each one apart from the core:
--vanilla) turns every addition off for one run, so a player
can always get the original game;Deviation: and happens only when that addition is in
use.Mod code that changes rules (scripts or plugins run inside the simulation) must give the same result on every computer, or replays and multiplayer break. Run it in a sandbox: integers only (no floating point), no access to files, the clock or the network, random numbers only from the game's own generator, a fixed instruction budget per call (a plugin that runs out stops at the same instruction everywhere), a fixed order between plugins, and a fingerprint of the loaded plugins that multiplayer players must share. A WebAssembly interpreter with fuel metering and floats switched off does all of this.
python3 tools/dos/tdinfo.py BINARY rust TYPE ... writes Rust structs and readers for Pascal
record types in the original's field order (with rust-reader for the PascalReader they
use). Generate the code instead of copying it by hand. Keep the generated file unedited: regenerate it when the
toolkit improves. Rust projects made by new-project.sh build into build/. The game is in game/, a link into the GameFrame home. An older project keeps the game in target/, where cargo clean would delete it.
These are the details that make a reimplementation drift, in order of how often they bite:
Math.fround, struct round trip). 32-bit x87 games computed in 80-bit
precision until a value was stored: match where it was stored.(a + b) + c differs from a + (b + c). Keep the original's order, from the disassembly.
Watch for fused multiply-add: compilers may fuse a * b + c on one side and not the other.sin, cos, atan2, pow, exp differ in the last bit between C
runtimes. If the simulation depends on them, reimplement the original's runtime functions
(emulate them for ground truth) instead of calling your platform's.qsort) order equal elements in a way that depends on the
algorithm; reproduce the original's algorithm when equal keys are possible.cvttss2si).docs/COMPILED-CODE.md, "Order of evaluation").0x3eaaaaab for 1/3) is exact
in the binary. Copy its bits. An expression for it in the port may round differently.docs/GAME-PATTERNS.md, "Update
order"). Copy each decision from the binary.docs/working/hybrid-port.md) must
leave every register as the original does, scratch registers too. They must also set the
flags that callers test after the return. On the 386 a shift count is masked to 5 bits, so
SHL AX,CL with CL = 33 shifts by 1. The overflow flag is defined only for 1-bit
shifts and rotates (for SHL/RCL by 1 it is the new top bit xor the carry). A routine
may also be entered by falling through from the one above it, or only through a jump table.
Such entries need their own port or hook.Any intentional difference (a platform difference, a fix the project decided on, an addition)
gets a comment containing Deviation: and the reason; a piece left out gets not ported.
tools/triage/deviations.py --out docs/DEVIATIONS.md src/ lists them all in one ledger, and
--check fails a test when the ledger is out of date. A deviation is a decision; an accidental
difference is a bug.
Where the game can reach a not ported piece while it runs, call GameFrame's
gameframe_report::unported! there as well, with the original's address, one line, and the
values at the place: unported!("0x5898b4", "the hit's material", material = m). The game goes
on as before. The first time it gets there, a report is written with the place, the values, the
game's state and the launch, so the run can be repeated. A check against the original that can
run in the game uses mismatch!. In main, call report::install with the game's name and
its GitHub repository, report::set_dir, report::set_launch, and report::flush at the end;
a kernel also calls Link::send_reports, and Setup::report_gaps for the devices running on a
stand-in (gameframe-frame's README, "Devices"). Debug builds keep the reports on the machine (Dev).
Release builds give each one a filled-in GitHub issue link that the frame shows (Production).
Tests set GAMEFRAME_STRICT=1 to fail at an unported path. The crate's README has the rest.
tools/triage/coverage.py SOURCE_DIR reads the Original: citations and says how much of the
original's code (by count and by size) the reimplementation has ported from, with the largest
functions nobody cites yet.
re-verify section 0 says how deep).re-land).examples/sample-game/port.py is a complete small example: a reimplementation that matches the
original bit for bit, and a --naive mode that makes mistake 1 to show what the checks catch.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tanepiper/game-frame --plugin gameframe16 skills in this plugin
/re-browseBuild and grow a resource viewer for a game - first the catalogue (tools/formats/catalog.py, a static HTML page and JSON manifest of every file, its kind, entropy, hex and what the Python decoders make of it, with pictures), then the project's own viewer app on the port's readers (pictures, palettes, sound, 3D models, text, hex; native and browser; a file output mode for agents). Use at the start of a project, right after the inventory, and after every new decoder, so the person and the agent can check decoded content by looking at it./re-cleanroomRun a source-visible specification and source-blind implementation workflow when a project wants independent reimplementation from a neutral behavior contract./re-emulateRun individual functions from a game's Windows x64 binaries (tools/emu/pe_emu.py), 32-bit x86 Windows binaries (tools/emu/pe32_emu.py) or 16-bit DOS/NE programs (tools/emu/dos_emu/) under the Unicorn emulator to capture exact ground truth for chosen inputs, and record the calls they make (random draws) with call_trace.py. Use for anything a reimplementation must match bit for bit - random number generators, maths, procedural generation, simulation steps, pathfinding, parsers - instead of trusting the pseudocode./re-formatDecode a game's data files - package/archive containers, compressed entries, resource and asset formats, save games - by finding the code that reads them, prototyping a decoder with tools/formats/reader.py, proving it against every file of its type with validate.py (all bytes consumed), then porting it. Use when a file type is not yet understood or a decoder fails on some files./re-ghidraDecompile a game's binaries with Ghidra in headless mode and work with the result as text - the full export (decomp.c, functions, strings, imports, exports), queries with decomp_query.py, one-off decompiles of functions Ghidra missed, vtable and reference listings, constants read from the binary, and checks against the disassembly. Use whenever you need pseudocode for a native binary, including 16-bit DOS (MZ) and NE programs./re-inventoryFirst look at a game's files (Windows PE, or DOS MZ/NE/LE executables) - which binaries hold the game's own code, which engine and middleware it uses, whether it is native, managed, scripted or packed, which data containers and save files exist - and record it in docs/FINDINGS.md; then read the manual and the program's long strings into docs/lore.md, which says what each system is for. Use at the start of a project, or when a new binary or file type turns up.Other plugins' skills for the same job