Skip to main content

Module session

Module session 

Source
Expand description

Session records: everything the platform gave a game in one run, frame by frame, and its playback (ADR-0072). A record is taken where the platform hands things to App (App::record), so no game code records anything: the clock, the system’s events, the input, the system keyboard’s answers, the music’s position, the display, the platform’s facts and the store as it was handed over. Each frame also holds a hash of what happened in it, never of its picture.

Playback plays a record on the HeadlessPlatform, from the game’s real Start, and says at which frame the game first did something else. Frames count App::frame calls from 1, as App::frame_number does.

A game’s rules records (a seed and commands, a hash per step) are one level up, and stay the game’s: playing a session runs the same rules, so a tick game’s steps and a turn game’s commands come out of it.

A record’s text is RON, one frame per line, so two records diff frame by frame (SessionRecord::to_ron). The suggested file name is *.session.ron. A record is a run’s log, not an asset, so it has no Format, and it is never migrated: a field added later is optional and leaves FORMAT_VERSION alone, and a change to what a field means raises it.

Structs§

FrameDifference
The first frame that played differently from its record.
FrameRecord
One frame of a run, in the order App reads the platform: empty lists and unchanged values are left out, so an idle frame is its dt alone, or its dt and music while music sounds.
KeyboardFrame
The system keyboard’s part in one frame.
Playback
A record playing, one frame at a time: on an App made from the game’s Start (prepare), on a platform from HeadlessPlatform::from_session. It needs no Harness, so a running build can replay a record too.
Played
How far the test Harness has played its record (Harness::play_to).
SessionRecord
One run of a game, as the platform gave it (module docs). App fills one in (App::session); from_ron reads one back.

Enums§

SessionError
Why a record can’t be played.
Stamps
Whether a playback checks that the record’s build is this one.

Constants§

FORMAT_VERSION
The version of a record’s text this engine reads and writes.
MAX_SESSION_FRAMES
The most frames one record holds: an hour at 60 frames a second. Recording stops there (SessionRecord::truncated).

Functions§

prepare
start made ready to play record: a record of another version refused, the record’s stamp checked against the start’s as stamps says, and the record’s voice manifest put in its setup. Beside it, what the playback can’t promise, one line each.