Expand description
Shuyi Engine’s tools, shuyi: the tool contract’s operations (new,
check, lint, modules, add, run, scene, replay, playtest, autobalance,
import, bake, export, doctor, explain, attach, each with --json; contract),
the exporters export runs (export), the contract as
an MCP server with a session (mcp, mcp install; mcp), and frame-png, font-atlas, app-info,
glyph-tiles, check-keys, check-text, check-skills, lang-status,
web and private-assets, each a module of library functions with a
thin wrapper here; bench, which plays the game’s benchmark scenarios
and gates them against its targets’ budgets (docs/targets/README.md); the engine’s modules as modules and add read them
(catalog); templates made of parts, which new composes
(template); the engine’s skill pack, which new copies into a game
and check-skills checks (skills); the notices a package carries
(notices); and the pool of threads the slow
ones play on (pool).
They run on a project: the folder holding a shuyi.ron
(project), which says what each command scans and builds; new,
doctor, explain, attach, schema and check-skills need none. The commands that run the game itself
get what they need from it (GameTools) in a program of its own that
calls main_with, and shuyi runs that program (shuyi.ron’s
game) for them. A game on the short path gives BasicTools
(basic).
A CLI tool prints to stdout by design, so print_stdout is allowed here.
Re-exports§
pub use basic::BasicTools;pub use game::AutobalancePlan;pub use game::GameArg;pub use game::GameAudio;pub use game::GameBake;pub use game::GameLang;pub use game::GameOption;pub use game::GameTools;pub use game::OneBitSkin;pub use game::PlaytestPlan;pub use game::Tunable;pub use game::check_start;pub use game::game_arg;pub use project::Project;pub use serde_json;
Modules§
- app_
info - Who the game is:
shuyi.ron’sapppart (AppPart, ADR-0059), its rules (problems, whichcheck --targetreports), andapp-info, which writes it as the Rust constant the game’s binary compiles (rust,run) and the window’s icons, downscaled from the game’s one icon (downscale, ADR-0061) or drawn per size (ADR-0069). - basic
BasicTools: theGameToolsof a game on the short path (ADR-0036), from itsBasicGame:frame-png,lang-status, the contract’scheck,runandscene(a session with no scene, or one played from a session record), the font atlascheckchecks the text against, and the controlscheck --targetchecks. A game that adds a scene, a record, bots, importers or a bake writes its ownGameToolsand calls these methods for the rest.- catalog
- The engine’s modules as the tools read them (ADR-0009 §2, §4, §6),
for
modulesandadd(crate::contract::modules,crate::contract::add): - check_
keys check-keys: fails when game code or player text names a key directly instead of going through anActionand the player’s keymap. Controller buttons are treated like keys.- check_
text check-text: counts the player-facing text still written as string literals in the screens’ source (CheckText::dir), instead of asked for by key withctx.text("screen.thing")from the game’s language file. It fails when the count is aboveCheckText::max_literals.- codec
- PNG files as RGBA8 pixels, for the tools that read and write pictures.
- contract
- The tool contract (ADR-0005 §1, ADR-0022): the operations an agent, CI
or a person runs on a game, each a library function with a typed input
and output that serde reads and writes and JSON schemas describe. The
CLI (
shuyi <op> [--json]) is one surface over them; the MCP server (shuyi mcp,crate::mcp) is another, where each is a tool and a session keeps one game running between calls. - export
- The exporters
exportruns (crate::contract::export): one per target, each building the game with the target’s Rust triple and writing its package (Exporter).windowswrites a zip,linuxatar.gz,macosa folder holding a signed.app,weba folder and its zip, andplaydatea.pdxand its zip. Every package carriesNOTICES.txt(notices), and the Windows and macOS ones a note for players on opening an unsigned program (HOW-TO-OPEN.txt). - font_
atlas font-atlas [--no-text] [--wide [<set>=]<wide.bdf>]... <font.bdf>... <out-dir>: turns a BDF bitmap font into a font atlas (atlas.png+atlas.ron, read asshuyi_assets::font::FontAtlasDef) and its one-bit copy for a one-bit screen (atlas_1bit.bin). It keeps the glyphs the font has ofATLAS_RANGES, of the characters the game’s text uses and of the glyphs the project requires (AtlasChars): whenshuyi.ronnames a game tool program,font-atlasruns in it and reads the game’s text (--no-text: the ranges and the required glyphs only). Further BDF files add glyphs the first lacks (a game’s own, e.g. controller button shapes). The atlas must have the glyphs the project requires (crate::project::FontAtlas::required_glyphs); a character the text uses that the fonts lack is named, andcheckfails on it.- frame_
png frame-png: renders a frame of a game in the test Harness to a PNG without a window, for looking at a skin, a picture or a mockup. Never a gate: snapshots stay text.- game
- What the commands that run the game need from it:
GameTools. - glyph_
tiles glyph-tiles: a tileset made from the font’s glyphs, for a game that wants a sprite skin before it has art (as the game’stest-tilesetdoes): each tile is a square of a palette color with up to a few glyphs stamped on it, centred, in another; a tile with no background is clear but for its glyphs (a piece drawn over the ground). Tiles are laid out in the ordershuyi.ronlists them,columnsto a row, so tileiis at columni % columns, rowi / columns.- lang_
status lang-status <tag>: what a language pack of the game lacks: the missing keys (no entry), the stale ones (an entry made from source text that has since changed) and the orphaned dialogue entries (their line was reworded or cut, so it has a new id or none), each with the untranslated line of its scene nearest to what it translated. All show in the game as a shorter tag’s pack or the source language has them (Lang::chain) and fail no gate; this lists them for whoever translates. After the screen text’s missing and stale keys come its entries too long for their place: wider than their key’smax_cellsin the source’sui.ron(Lang::overflow), measured with the font atlas’s wide glyphs. They fail no gate either. Screen text comes first, then the data’s, then the dialogue’s, each with its counts. Test text (thetest*.dlgscenes, data ids starting withtest) is left out, and counted, except in the report of the test pack (codetest);--onlyand--filenarrow the report. The game gives its languages (crate::GameTools::lang).- mcp
shuyi mcp: the tool contract as an MCP server over stdio (ADR-0005 §2, ADR-0031), andshuyi mcp install, which registers it with the agents it finds (install).- notices
NOTICES.txt: the notices a package of a game owes for the works in it, written beside the game.shuyi webwrites one into the web build (crate::web). It lists the crates compiled in (crates), the web shell’s files and the game’s own license texts (game_texts), then each license text once (write()).- pool
- A pool of threads for the tools that play many slow tries (
playtest, and laterautobalance): every item of a work list run on one ofnthreads and timed, the answers given back in the list’s order, so what is made of them never depends on the thread count. The clock is the tools’; the core never reads one. - private_
assets private-assets [--library | --pin]: fetches the files a game may not hand out (bought art, say) from a private repository, checked out into a git-ignored folder of the project (PrivateAssets::checkout) at the commit the project’s pin file names (PrivateAssets::pin_file).- project
- The project file,
shuyi.ron, at a game’s root: who the game is (itsapppart), which paths each check scans, the game’s tool program (for the commands that run the game), the font atlas’s rules, the web build’s package, the game’s own license texts and the private repository’s settings, and the targets the game ships on. A command whose part is missing says so. - skills
- The engine’s skill pack (ADR-0005 §2, ADR-0043):
skills/<name>/SKILL.mdfolders in the open Agent Skills format, each with a worked example (example.ron, a script of contract commands) unless it waits for work still to come. - template
- Templates as data (ADR-0013 §3): a folder with a
template.ronand the files of its parts, whichshuyi newturns into a new game. - test_
card - The test card, a generated test image for sprite items (it lives with
the raster in
shuyi-ui). The test card: a public test image for sprite items, generated, not art, so the same code always makes the same pixels. The raster’s andframe-png’s tests paint it, and a game may write it into its test files. - watch
run --watch: the game’s window program, in a debug build (so with its debug tools on), with the folder of its files on disk laid over the embedded ones and watched (ADR-0071). It isn’t an operation of the contract: it plays nothing headless and answers nothing, and it runs until the player closes the window.- web
web [--release] [--<feature>...]: builds the game’s binary (crate::project::Web) forwasm32-unknown-unknownand packages it with the web shell into the project’sweb.distfolder: the page (web/index.html, with the game’s title and binary written in), the vendored JS loaders (web/mq_js_bundle.js, andweb/sapp_jsutils.jswithweb/quad-storage.jsforlocalStorage) and the engine’s own plugins (web/gamepad.jsfor controllers,web/page-files.jsfor the files the page hands the game, and the rest). The shell is built into this tool; seeweb/README.md, which also says how a game’s binary gets the link argument these plugins need. Each--<feature>turns on a feature of the game’s package thatweb.featureslists (a debug build’s tools, say). The game’s music tracks (.ogginweb.music, not embedded) are copied beside the page into a folder of the same name, which exists even when there are none; its voice clips (web.voice,.oggand.ron) are copied the same way when there is such a folder.
Constants§
- COMMANDS
- The commands of
shuyithat aren’t operations of the contract (Op::ALL), asusagelists them: with the contract’s operations and the MCP session’s tools, the commands a skill may name (skills::check).
Functions§
- main_
with - Runs the command
argson the project of the working folder, with the game’s tools if this is the game’s tool program, and returns the exit code: 0 for success, 1 for a failed check or step, 2 for wrong arguments (SH0nnn), 3 for a setup to fix before running it again (SH1nnn: no project, a project file that lacks what the command needs, no game tool program, cargo that doesn’t start). - run
- Runs the command
argsonproject, with the game’s tools if they are at hand (otherwise a command that runs the game runs the game’s tool program), and returns the exit code (seemain_with). - usage
- The usage text, with
commandas the tool’s name.