pub trait GameTools {
Show 21 methods
// Required methods
fn frame_options(&self) -> &[GameOption];
fn frame(
&self,
options: &[GameArg],
script: &Script,
scale: Option<u32>,
) -> Result<Shot, String>;
fn lang(&self) -> Result<GameLang, String>;
// Provided methods
fn frame_notes(&self) -> &'static str { ... }
fn frame_one_bit(
&self,
target: &str,
options: &[GameArg],
script: &Script,
scale: Option<u32>,
) -> Result<Shot, String> { ... }
fn check(&self) -> Result<Vec<ContentError>, String> { ... }
fn session(&self, options: &[GameArg]) -> Result<Box<dyn Session>, String> { ... }
fn session_on(
&self,
target: &str,
options: &[GameArg],
) -> Result<Box<dyn Session>, String> { ... }
fn session_from(
&self,
record: &SessionRecord,
stamps: Stamps,
) -> Result<Box<dyn Session>, String> { ... }
fn replay(&self, record: &Record) -> Result<ReplayRun, String> { ... }
fn made(&self) -> Option<Made> { ... }
fn playtest_stages(&self) -> Vec<String> { ... }
fn playtest_plan(
&self,
stage: Option<&str>,
input: &PlaytestInput,
) -> Result<PlaytestPlan, String> { ... }
fn playtest_defaults(&self) -> Tries { ... }
fn autobalance_plan(
&self,
stage: Option<&str>,
input: &AutobalanceInput,
) -> Result<AutobalancePlan, String> { ... }
fn importers(&self) -> Importers { ... }
fn controls(&self) -> Option<Result<Box<dyn Controls>, String>> { ... }
fn font_atlas(&self) -> Option<Result<FontAtlasDef, String>> { ... }
fn one_bit(&self, _target: &str) -> Option<Result<OneBitSkin, String>> { ... }
fn bake(&self, target: Option<&str>) -> Result<GameBake, String> { ... }
fn audio(&self, target: &str) -> Result<GameAudio, String> { ... }
}Expand description
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.
Required Methods§
Sourcefn frame_options(&self) -> &[GameOption]
fn frame_options(&self) -> &[GameOption]
The options the game adds to frame-png, which also start its
game for run, scene and playtest (none: &[]).
Provided Methods§
Sourcefn frame_notes(&self) -> &'static str
fn frame_notes(&self) -> &'static str
What else frame-png --help says about the game’s pictures.
Sourcefn frame_one_bit(
&self,
target: &str,
options: &[GameArg],
script: &Script,
scale: Option<u32>,
) -> Result<Shot, String>
fn frame_one_bit( &self, target: &str, options: &[GameArg], script: &Script, scale: Option<u32>, ) -> Result<Shot, String>
frame-png --target <id> on a one-bit target: as
frame, but painted as the target’s display shows
it, most simply with to_one_bit
and one_bit_picture, each of
its pixels scale × scale (1 if None).
Sourcefn check(&self) -> Result<Vec<ContentError>, String>
fn check(&self) -> Result<Vec<ContentError>, String>
check: every error of every validator of the game’s content,
each with its file and, when known, its line.
Sourcefn session(&self, options: &[GameArg]) -> Result<Box<dyn Session>, String>
fn session(&self, options: &[GameArg]) -> Result<Box<dyn Session>, String>
run and scene: the game started headless as options say
(its frame_options), most simply a
Headless over its Harness.
Sourcefn session_on(
&self,
target: &str,
options: &[GameArg],
) -> Result<Box<dyn Session>, String>
fn session_on( &self, target: &str, options: &[GameArg], ) -> Result<Box<dyn Session>, String>
bench on a one-bit target: the game started headless as options
say on target target (its console and its buttons), each frame
converted as the device converts it, most simply a
Headless over its Harness on
that target with a
set_present_hook
that runs to_one_bit on the
frame. Left at its default, bench measures session
there and says the frames weren’t converted.
Sourcefn session_from(
&self,
record: &SessionRecord,
stamps: Stamps,
) -> Result<Box<dyn Session>, String>
fn session_from( &self, record: &SessionRecord, stamps: Stamps, ) -> Result<Box<dyn Session>, String>
run --session and scene --session: the game’s real start, made
ready to play record, most simply a
Headless over
Harness::from_session,
its error as text. The engine plays it. Give made
too, so a record another build made is refused as such.
Sourcefn replay(&self, record: &Record) -> Result<ReplayRun, String>
fn replay(&self, record: &Record) -> Result<ReplayRun, String>
replay: record, in the game’s record format, re-run by its
rules (for a turn game, turns).
Sourcefn made(&self) -> Option<Made>
fn made(&self) -> Option<Made>
This build’s stamp (shuyi_core::made): the game’s word for its
build and the fingerprint of the bundle it ships, most simply
Made::new(stamp, bundle.fingerprint()). replay refuses a record
stamped otherwise, and playtest keeps it in its history. None,
the default: no record is checked.
Sourcefn playtest_stages(&self) -> Vec<String>
fn playtest_stages(&self) -> Vec<String>
playtest --stage: the ids of the game’s playtest stages, in the
order --every-stage plays them. Empty, the default: one unnamed
stage.
Sourcefn playtest_plan(
&self,
stage: Option<&str>,
input: &PlaytestInput,
) -> Result<PlaytestPlan, String>
fn playtest_plan( &self, stage: Option<&str>, input: &PlaytestInput, ) -> Result<PlaytestPlan, String>
playtest: the plan of stage (one of
playtest_stages, None if there are
none), started as input’s game options say. Its numbers are those
the tries are played with, the game’s defaults filled in. A game’s
bot run is a plan too: one entrant and no checks.
Sourcefn playtest_defaults(&self) -> Tries
fn playtest_defaults(&self) -> Tries
playtest: how many tries, from which seed, stopped at which turn,
when the input doesn’t say. The engine’s defaults
(DEFAULT_TRIES) unless the game has its own.
Sourcefn autobalance_plan(
&self,
stage: Option<&str>,
input: &AutobalanceInput,
) -> Result<AutobalancePlan, String>
fn autobalance_plan( &self, stage: Option<&str>, input: &AutobalanceInput, ) -> Result<AutobalancePlan, String>
autobalance: the plan of stage (one of
playtest_stages, None if there are
none), started as input’s game options say. Its numbers are those
the search runs with, the defaults filled in.
Sourcefn importers(&self) -> Importers
fn importers(&self) -> Importers
import: the kinds and formats to read a file with. The engine’s
standard ones unless the game adds its own.
Sourcefn controls(&self) -> Option<Result<Box<dyn Controls>, String>>
fn controls(&self) -> Option<Result<Box<dyn Controls>, String>>
check --target: the game’s keymap and every screen it can show,
for the check that its controls fit each target (ADR-0008 §3), most
simply a GameControls.
None, the default, doesn’t offer them: check --target then
checks the display alone and says so. An error (the game’s files
don’t load) fails the check.
Sourcefn font_atlas(&self) -> Option<Result<FontAtlasDef, String>>
fn font_atlas(&self) -> Option<Result<FontAtlasDef, String>>
check: the game’s font atlas, for the check that it draws every
character of the game’s text (lang;
shuyi_assets::font::undrawn), most simply the atlas it loads.
None, the default, doesn’t offer it: check then says the text
isn’t checked against it. An error (the atlas doesn’t load) fails
the check.
Sourcefn one_bit(&self, _target: &str) -> Option<Result<OneBitSkin, String>>
fn one_bit(&self, _target: &str) -> Option<Result<OneBitSkin, String>>
check --target on a one-bit target: the skin’s palette and its
pattern map for target, for the check that every role has
patterns and the roles that tell things apart stay distinct
(ADR-0008 §4; shuyi_assets::onebit::check). None, the default,
doesn’t offer them, and check --target says they weren’t checked.
An error (the files don’t load) fails the check.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".