Expand description
Shuyi Engine’s assets: the bundle of files a game embeds, laid in layers
the game gives (bundle), errors that name a file, line and column
(error), and RON files read with those errors (ron). On top of
them, the kinds of file every game has: images (image) and their
one-bit versions (bitmap), a font atlas
(font), named colours (palette, ink) and their one-bit
patterns (onebit), lights (lighting),
the audio manifest (audio) and the credits (credits); the .map
text format of a grid map (grid_map) and a tileset’s terrain tiles
(tileset); keymap files, generic over a
game’s actions (keymap); and the text of a story game:
languages (lang), a names table (names), dialogue scripts
(dialogue), voice clips by line (voice), tips (tip) and
word wrap for text boxes (text); and
cinematics, timed shots of a game’s own kinds (cinematic); and
export targets’ profiles (target). Each
is a pure parser; the game names its files, says what its own rules add,
and reads them from its bundle.
Formats are plugins (format, ADR-0007): each kind of
asset is a plain type, the parsers above are formats of their kinds,
and a game registers its own kinds and formats beside the engine’s in
a Formats registry, then asks it for an asset by id. A game may
ship its assets baked into one pack (.shuyipak), proven equal to
its sources. A value read through the registry can reload when its files
change on disk (hot).
For tests, behind the golden feature: golden tables (golden),
values a build gives pinned in a file, the same on every platform.
Re-exports§
pub use bundle::Bundle;pub use bundle::Files;pub use bundle::Layer;pub use error::ContentError;pub use error::ContentErrors;pub use error::line_of;pub use format::AssetKind;pub use format::AssetPath;pub use format::DecodeCx;pub use format::Encode;pub use format::Format;pub use format::Formats;pub use format::Limits;pub use grid_map::GridMap;pub use grid_map::MapFeature;pub use grid_map::MapFormat;pub use grid_map::MapLook;pub use ron::parse_ron;
Modules§
- audio
- The audio manifest: every sound and music cue a game can play, the music pools, and the credits for every third-party work. Screens name cues; the platform layer plays the files.
- bitmap
- One-bit pictures (game ADR-0085): the file a one-bit screen draws in place of
a PNG, made ahead of time by
convertso the device never decodes a PNG. Pixels are packed one bit a pixel in rows, the Playdate’s own bitmap layout: each rowstridebytes, a byte’s highest bit its left pixel, a set bit white. - bundle
- The asset bundle: the files a game embeds in its binary, read from layers the game gives, in order. A file is read from the first layer that has it, so a layer laid over another replaces its files at the same paths and adds its own; a listing merges every layer’s files.
- cinematic
- Cinematic files: a list of shots and when each starts, over a length
of time (ticket 1113; game ADR-0060). The engine reads the file’s
frame and checks its times; what a shot shows is the game’s own (
S), checked by the game (ShotCheck) and played byshuyi_ui::cinematic. - credits
- The credits: every third-party work a game uses, for its credits
screen. Music and sounds are credited in the audio manifest
(
crate::audio); everything else (fonts, bought art, vendored software) in a credits file.mergemakes the two one list, so nothing is typed twice. - dialogue
- Dialogue scripts (
.dlgfiles): scenes of portraits, speech, narration, reply choices and music changes.parse_dlgturns a file into scenes,check_sceneandcheck_duplicatesvalidate them against the game’sSceneRules, andprint_scenewrites a scene back out. Every line that shows text has aLineId. Lines in an@ifblock play only while a character is there (Present). - error
- Content errors: every problem names the file and, when known, the line and
column, so a broken asset can be fixed without reading Rust. An error of
a class the tools know carries its problem
Code(codes), whichshuyi explainprints the page of. - fnv
- The word-wise FNV-1a hash the pack’s checksum and a bundle’s
fingerprint share: FNV-1a’s constants over 64-bit words (the last few
bytes one at a time), each step followed by a shift that folds the
high bits into the low ones. Each step is a bijection of the hash so
far, so any one word changed changes it. Every integer is a
u64, whatever the platform. A frame’s snapshot hashes a painted picture with it too (ADR-0078). - font
- A bitmap font atlas: a grid of fixed-size glyph cells in one image, and
a glyph map (a RON file) from
charto cell index. The game names the two files and the glyphs it needs. As a format (ADR-0007), the glyph map is a sidecar read with the PNG beside it (FontAtlasRon). Once the atlas and the game’s text both load,undrawnfinds every character of the text the atlas can’t draw. - format
- Formats are plugins (ADR-0007, ADR-0019). An asset kind is a plain
type (
AssetKind): an image’s size, a palette, a dialogue file’s scenes. A format is a value that reads one kind from the bytes of one file (Format).Formatsholds the formats of every kind; the engine’s standard ones are there from the start (Formats::standard), and a game registers its own kinds and formats at start-up. Code that uses an asset asks for its kind by id (Formats::load) and never sees which file it came from. - grid_
map - The
.maptext format of a grid map: a RON header, a---line, then one character per tile, top row first. - hot
- Values that reload (ADR-0071). A
Hotvalue is an asset decoded through the registry by id, which remembers every file its decode asked for: the file itself, the files its format read throughDecodeCx(an atlas’s picture, a level’s tileset) and its import settings, found or not. When the platform says files changed,Hot::refreshdecodes it again if one of them did. If the new decode fails, the old value stays and the errors come back (Reload::Failed), so a broken file never takes a running game down. - image
- The image table: every PNG in a
Bundlethe game names, by bundle path, with its size. Screens name a picture by anImageIdfrom this table; the platform layer decodes and draws it. Only each file’s header is read here, never its pixels. - import_
settings - Import settings (ADR-0057): how one file, or every file of a folder, is
read or baked. A file’s own settings are beside it, its full name kept
(
images/hero.png.meta); a folder’s defaults are in its_folder.meta, for every file in it and below it. A settings file is RON, a struct of sections, each read by the step it is named after:(onebit: (dither: bayer), indexed: (group: "ui")). - ink
- One-bit inks and their palette (the Playdate’s, game ADR-0074): a palette
file of inks gives each colour name an
Inkinstead of an RGB value. It loads as aPaletteDeflike any other, each colour being its ink’s reservedcode, so screens and skins draw with it unchanged and a one-bit renderer reads the codes back as inks. - keymap
- The keymap file format, generic over a game’s
ActionSet(game ADR-0015, game ADR-0031, game ADR-0034, tickets 1106 and 1107):Keys andChords, controllerButtons andButtonChords (two buttons together), the namedLayouts a file lists, andKeymapDef, a validated keymap file: each layout’s default keys, the keys that work before a layout is chosen, the default buttons, key-repeat timings and the sticks’ thresholds. - lang
- Languages: the source language’s screen text by key (
en/ui.ron), and the packs that overlay it (<tag>/): their screen text (ui.ron), the game’s data text (data.ron: names, and whatever else the game hands over by key) and the dialogue’s lines and captions (dialogue/*.ron). - lighting
- Lights: named recipes for shading pictures, read from a RON file of
name: (grey: 0.35, tint: (0.62, 0.56, 0.46))entries. Look data only: a game’s rules never see it. As a format (ADR-0007):LightingRon. - names
- A names table: every display name of a story (characters, places,
factions, terms) by stable id, so a rename is one line. Text refers to a
name with a token,
{n:<id>}(or{N:<id>}for a capital first letter), filled in byNames::substitutewhen it is shown. As a format (ADR-0007):NamesRon. - onebit
- One-bit output by role (ADR-0008 §4): a fixed set of 8 × 8
Patterns, and the pattern map (palette@onebit.ron, beside the palette) that gives each of a skin’s palette roles a foreground and a background pattern, with the groups of roles that tell things apart and must stay distinct. As a format (ADR-0007):PatternMapRon.checkis whatshuyi check --targetchecks of a one-bit target; the renderer that draws with the map isshuyi_ui::frame::onebit. - pack
- The pack (
.shuyipak, ADR-0007 §4, ADR-0023): the optimized format a game may ship in place of its loose files.shuyi baketurns the sources into one file, and the game lays it in its bundle like any other layer (Pack::into_layer), under its loose files or alone. - palette
- Named colours: a palette file (
{"name": "#RRGGBB", ...}) that all drawing code refers to by name. The game says which names it needs; a theme is another palette file with exactly the names of the default one (theme_problems). As a format (ADR-0007):PaletteRon. - ron
- Reading RON assets with
file:line:colerrors. As a format (ADR-0007),Ronreads any kind that serde reads: a game’s own data tables. - target
- Export targets as data (ADR-0008 §1): a
TargetProfilesays what a target’s display shows, how fast it runs, what the player can press, what a game may spend there, and which platform backend builds it. The engine’s profiles are the files oftargets/at the repository’s root (playdate.ron,steam-deck.ron, …); a game adds one, or overrides one by its id, with a file of its own. As a format (ADR-0007):TargetRon. - text
- Word wrap for text boxes, the one the checks and the boxes share.
- tileset
- A tileset’s terrain tiles (game ADR-0052): the pictures a grid map’s sprite skin paints its ground with. For each look a map may ask for (outdoors, indoors), a tile for every terrain and the layers painted over those tiles. A layer’s picture is chosen from the tiles around it, so a terrain grid alone says what the map looks like: a map file only ever names terrain.
- tip
- One-time contextual tips: what triggers each and what it says. The
game’s own type names its triggers; its screens decide when one has
happened and remember which tips were seen. A tip’s text names keys with
placeholders (
{Confirm}), filled in with the player’s keys when shown. A tip may keep its instructions apart from its text (how): a game whose tips are spoken by a recorded voice keeps the keys there, since a clip made ahead of time can’t say a key the player rebound. - voice
- Voice clips: a manifest that lists every clip by dialogue line id, and a cast that says which voice says each speaker’s lines. A game ships its clips beside it, so nothing here reads a file: the game reads the text and these functions parse and validate it.