Skip to content

CommonTools: screen events and a screen state machine - #667

Draft
dayfine wants to merge 4 commits into
autostory/story-range-options-svfrom
autostory/screen-machine
Draft

dayfine wants to merge 4 commits into
autostory/story-range-options-svfrom
autostory/screen-machine

Conversation

@dayfine

@dayfine dayfine commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Depends on #572

This adds a small game-agnostic screen layer under CommonTools. ScreenEvents names what a frame shows (a black or white fade, a dialog or choice box, a battle, a still screen, the HOME menu) and reads fades and still screens from pixels; a game plugs its own detectors in through ScreenEventObserver. ScreenMachine runs a closed loop over known screens: look, take that screen's step, look again, and fail on an unknown screen, a stalled screen, too many visits or a timeout. It is split out of #648 so it can be reviewed at the infra bar on its own; the code is unchanged apart from dropping an unused from_bits. Tested with the ScreenEvents and ScreenMachine unit test suites, which run on the fake observations and synthetic frames, no console needed.

ScreenEvents names what a frame shows (fades, dialog, battle, still
screen, HOME menu) in words every game shares; ScreenMachine runs a
closed loop over known screens: look, take that screen's step, look
again, failing on unknown screens, stalls, too many visits or timeout.

Split out of the AutoStory shared core (#648) so it can be reviewed on
its own. Drops the unused ScreenEvents::from_bits.
Names via EnumStringMap (SCREEN_EVENT_NAMES, WARP_FADE_NAMES), ScreenEvents
prints via std::formatter, ScreenState's stored callables are
MoveOnlyFunction (run_screen_machine takes the states by value), fields get
defaults, fade thresholds move into the .cpp, unused bits() goes, and
run_screen_machine's per-look body becomes take_look().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant