Skip to main content

Module game

Module game 

Source
Expand description

What the commands that run the game need from it: GameTools.

The shuyi binary knows no game. A game gives its tools in a program of its own, which runs crate::main_with with them; shuyi.ron names that program (crate::project::GameProgram) and shuyi runs it with cargo run for the commands that run the game: frame-png, lang-status, font-atlas (which keeps the characters the game’s text uses; --no-text runs it without the game), and the contract’s check, run, scene, replay, playtest, autobalance, import and bake.

Structs§

AutobalancePlan
What autobalance searches on one of the game’s stages (GameTools::autobalance_plan): who plays it and how they are judged, as a PlaytestPlan says, and the stage it may change, its type the game’s (Tunable). The command picks the entrants asked for and runs the search (shuyi_core::autobalance_by), each setting’s tries played on every core and judged once. Build it with AutobalancePlan::new and assign the rest (ADR-0039).
GameArg
A game option as given.
GameAudio
The audio a game ships on a target whose export bakes it (GameTools::audio). Build it with GameAudio::new (ADR-0039).
GameBake
What a game bakes into its pack (GameTools::bake). Build it with GameBake::new (ADR-0039).
GameLang
A game’s languages, for lang-status. Build it with GameLang::new (ADR-0039).
GameOption
An option a game adds to frame-png. Build it with GameOption::new (ADR-0039).
OneBitSkin
A skin’s one-bit look (GameTools::one_bit): its palette of roles and the pattern map beside it (ADR-0008 §4). Build it with OneBitSkin::new (ADR-0039).
PlaytestPlan
What playtest plays on one of the game’s stages (GameTools::playtest_plan): its entrants, its checks, and how one try is played. The command picks the entrants asked for, plays their tries on every core, times them and judges them once. Build it with PlaytestPlan::new and assign the rest (ADR-0039).
Searched
What TunableStage::search found.
Tunable
The stage an AutobalancePlan may change, of the game’s stage definition type S: the command never sees S, only what the search found (TunableStage). Build it with Tunable::new (ADR-0039).

Traits§

GameTools
What a game gives the commands that run it. Only frame-png’s and lang-status’s parts are required; a contract operation whose part a game leaves out answers that the game’s tools don’t offer it.
TunableStage
A Tunable of any stage type, as autobalance runs it.

Functions§

check_start
Checks that the start options start are ones the game offers (options): each names one, has a value if it takes one and has none if it takes none. Every operation that starts the game calls it first, whether the options came from the command line or from JSON.
code_of
The problem code of error, from a GameTools method: codes::NOT_OFFERED if is_unsupported, else codes::GAME_ERROR.
game_arg
The game’s start option flag, one of options, with its value from value if it takes one.
is_unsupported
Whether error, from a GameTools method, is unsupported’s: the game left the method at its default.
run_in_game_program
Runs command with args in the game’s tool program of project and returns its exit code; 3 if there is none, or cargo doesn’t start (codes::PROJECT_FILE, codes::TOOLCHAIN).
unsupported
What a game whose tools don’t offer op answers: they lack the method method.

Type Aliases§

Evaluate
How the search has a setting played: given one try on the stage of that setting (entrant index, seed, the turn it stops at) and the tries to play, their report, judged. autobalance plays them on its threads.
PlayTry
A plan’s one try (PlaytestPlan::play): entrant index, seed, the turn it stops at.
PlaytestChecks
A plan’s checks (PlaytestPlan::checks): given the names of the entrants that play, the checks over them.
StagePlay
A Tunable’s one try: the stage, entrant index, seed, the turn it stops at.
StageWrite
A Tunable’s writer: the files it wrote of a changed stage.