Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
219 commits
Select commit Hold shift + click to select a range
3d9bf94
Pokemon navigation: story steps, one table vocabulary for FRLG and BDSP
dayfine Nov 1, 2026
474c2a0
Pokemon navigation: one retry policy for every story segment
dayfine Nov 1, 2026
f140830
Pokemon navigation: story executors hear of each attempt (begin_attempt)
dayfine Nov 1, 2026
03298de
Pokemon navigation: a shared checks level for story steps (Thorough o…
dayfine Nov 1, 2026
daf7b8f
Pokemon navigation: story steps take the game's language, and never n…
dayfine Nov 1, 2026
93075ab
Merge nav/shared (a38e45766, #114) into nav/story-steps
dayfine Nov 1, 2026
b5ebf9a
Merge nav/shared (4991c0806: #43-#45 under it) into nav/story-steps
dayfine Nov 1, 2026
48ff39d
Pokemon navigation: start and end checkpoint dropdowns, and the share…
dayfine Nov 1, 2026
ea5820d
Merge nav/shared (#43's select-database test moved) into nav/story-steps
dayfine Nov 1, 2026
fd3f311
Merge nav/shared (84093b021, #114: the story engine in Pokemon/AutoSt…
dayfine Nov 1, 2026
daf7a09
Pokemon AutoStory: the story steps move out of Pokemon/Navigation
dayfine Nov 1, 2026
55accbc
Merge nav/shared (a6a0920b9, #114: code health) into nav/story-steps
dayfine Nov 1, 2026
e67d36c
Pokemon AutoStory: the executor's step-kind methods are protected
dayfine Nov 1, 2026
b966c5d
Merge nav/shared (af1b526cb, #114: story lines on the overlay) into n…
dayfine Nov 1, 2026
705b81f
Merge nav/shared (b0ebe0b9d, #114: the fields BDSP and FRLG maps need…
dayfine Nov 2, 2026
1d42635
Merge origin/nav/shared into nav/story-steps
dayfine Nov 2, 2026
371ac70
Merge nav/shared into nav/story-steps
dayfine Nov 2, 2026
1981ec6
Merge branch 'nav/shared' into nav/story-steps
dayfine Nov 3, 2026
e53defa
Merge nav/shared (verify_checkpoint) into nav/story-steps
dayfine Nov 3, 2026
24444f0
Pokemon AutoStory: verify mode in the story run options
dayfine Nov 3, 2026
bb6db58
Merge commit '546b3c0d1d44f361bc29e6cfa1ad2e12d5cd3de2' into HEAD
dayfine Nov 5, 2026
2d0fdbd
Merge remote-tracking branch 'origin/nav/shared' into nav/story-steps
dayfine Nov 5, 2026
58aa81d
Pokemon navigation: bring nav/story-steps into #231 lint conventions
dayfine Nov 5, 2026
95db8ed
Merge origin/nav/shared into nav/story-steps
dayfine Nov 6, 2026
849e1e5
Merge origin/nav/shared into nav/story-steps
dayfine Nov 7, 2026
c4ad85c
Merge origin/nav/shared into nav/story-steps
dayfine Nov 8, 2026
6454027
Add shared story checkpoint JSON codec and portable tests (#250)
dayfine Nov 8, 2026
14c0c01
Merge branch 'sync/story-export-nav' into sync/story-export-steps
dayfine Nov 8, 2026
a778a30
Merge branch 'sync/story-export-nav' into sync/story-export-steps
dayfine Nov 8, 2026
46d000f
Pokemon AutoStory: once-per-save steps and Outcome::changed_nothing
dayfine Nov 8, 2026
0afc7c7
Merge branch 'b1-nav-shared' into b1-story-steps
dayfine Nov 8, 2026
edc3a19
Share authored checkpoint envelopes and embedded resource loading (#266)
dayfine Nov 8, 2026
f01947b
AutoStory: shared screen events and the judgements over them
dayfine Nov 9, 2026
d0c49bb
FRLG AutoStory: screen events from FRLG's detectors
dayfine Nov 9, 2026
4259210
FRLG AutoStory: screen events test builds an empty snapshot plainly
dayfine Nov 9, 2026
1460617
FRLG AutoStory: drop the flat grey frame from the screen-event tests
dayfine Nov 9, 2026
8b32091
AutoStory screen events: fit the code-health limits
dayfine Nov 9, 2026
176c540
Merge #291: AutoStory shared screen events and FRLG adapter
dayfine Nov 9, 2026
a7e440c
AutoStory: story action table, variant parser and TableExecutor
dayfine Nov 9, 2026
3a7e743
AutoStory: timed screen-event log, interrupt classifier and warp judge
dayfine Nov 9, 2026
46b688e
AutoStory: transition tracker and per-game fade profiles
dayfine Nov 9, 2026
b3aa69e
AutoStory: time an interrupt's step from its screen events
dayfine Nov 9, 2026
bfaaab0
AutoStory: clear interrupts between story steps
dayfine Nov 9, 2026
a023433
Merge nav/shared into nav/story-steps (hold watchers for the warp fade)
dayfine Nov 9, 2026
680662b
StoryInterrupts: a battle's opening before a battle step is the step's
dayfine Nov 9, 2026
46c99dc
StoryInterrupts tests: a battle's opening before a walk step (red)
dayfine Nov 9, 2026
0be68ac
StoryInterrupts: wait for a battle's opening before any step
dayfine Nov 9, 2026
500e624
Scene judges tests: a closing fade is no quiet (red)
dayfine Nov 9, 2026
7c6e9bd
Scene judges: a fade ends no quiet; log the screen before every step
dayfine Nov 9, 2026
9b00e53
Story interrupts: red tests for a step that starts on the Switch HOME…
dayfine Nov 9, 2026
fd603ca
Story interrupts: the HOME menu is not an overworld; a step on it fai…
dayfine Nov 9, 2026
14010d1
Merge nav/screen-state into nav/story-steps (#122 split into three la…
dayfine Nov 10, 2026
1db4a28
Merge nav/screen-state into nav/story-steps (#312 review: Types/, dat…
dayfine Nov 10, 2026
6b908f4
AutoStory: TableExecutor without per-kind virtuals
dayfine Nov 10, 2026
c224081
Merge nav/screen-state into nav/story-steps (structured step args)
dayfine Nov 10, 2026
2984456
AutoStory: actions declare their args; lint checks steps against them
dayfine Nov 10, 2026
fd6de90
Merge nav/screen-state into nav/story-steps (story range options and …
dayfine Nov 10, 2026
c656501
Merge nav/screen-state into nav/story-steps (range end lock mode)
dayfine Nov 10, 2026
46c65d7
Merge nav/screen-state into nav/story-steps (one story test registrat…
dayfine Nov 10, 2026
c53f345
Merge nav/shared (one-line route plan) into nav/story-steps
dayfine Nov 10, 2026
a91cd6a
Merge remote-tracking branch 'origin/nav/screen-state' into review312…
dayfine Nov 10, 2026
a03bfe6
AutoStory: StoryActions lint lists every args error
dayfine Nov 10, 2026
51f72b1
Merge nav/story-engine (#312) into nav/story-steps
dayfine Nov 10, 2026
d9d2e64
AutoStory: the action table and its tests read StoryStep::action and …
dayfine Nov 10, 2026
8cc0d89
AutoStory: lookup test names actions, not variants
dayfine Nov 10, 2026
1f44949
Merge branch 'nav/story-engine' into nav/story-steps
dayfine Nov 10, 2026
7d04d13
AutoStory: split over-limit headers, drop char* for code health
dayfine Nov 10, 2026
f03df6f
AutoStory: one story engine over a backend, with save policy from met…
dayfine Nov 10, 2026
45d4332
AutoStory engine: pin the steps hash; MIGRATION.md for the game moves
dayfine Nov 10, 2026
5274bc1
AutoStory engine: ZonePose, instantiated beside GridPose
dayfine Nov 10, 2026
81929f6
AutoStory engine: close the gaps the PLZA move found
dayfine Nov 10, 2026
8fd89e4
AutoStory engine: MIGRATION.md for the closed gaps
dayfine Nov 10, 2026
113082d
AutoStory engine: opt-in readers, still states, stick release, button…
dayfine Nov 10, 2026
91641f5
Merge autostory/save-policy (run report / range options split) into a…
dayfine Nov 10, 2026
9045932
Merge nav/screen-state (run report / range options split, header spli…
dayfine Nov 10, 2026
d483857
Merge branch 'autostory/save-policy' into autostory/engine
dayfine Nov 10, 2026
1cfdd67
Merge branch 'nav/screen-state' into nav/story-steps
dayfine Nov 10, 2026
d886d32
Merge remote-tracking branch 'origin/autostory/save-policy' into HEAD
dayfine Nov 10, 2026
45923c7
Merge nav/screen-state into nav/story-steps
dayfine Nov 10, 2026
1faf03e
Merge nav/screen-state into nav/story-steps
dayfine Nov 10, 2026
75489c2
AutoStory engine: output parameters last, std::format
dayfine Nov 10, 2026
b822ad7
Story steps: run(step, state), outputs last, std::format, FRLG test h…
dayfine Nov 10, 2026
d8c69c9
Merge autostory/save-policy into autostory/engine
dayfine Nov 10, 2026
bf2fce6
Merge nav/screen-state into nav/story-steps
dayfine Nov 10, 2026
3d20324
Merge autostory/save-policy into autostory/engine
dayfine Nov 10, 2026
af421f6
Merge nav/story-steps into autostory/engine
dayfine Nov 11, 2026
3f29e55
AutoStory: Add the INTEGER_ROWS story arg type
dayfine Nov 11, 2026
0d569c9
AutoStory: story-data-tests links the checkpoint metadata source
dayfine Nov 11, 2026
b582413
AutoStory: declared poses and args by game kind
dayfine Nov 11, 2026
f360dd3
AutoStory: drop the story JSON writers; hash the steps JSON as read
dayfine Nov 11, 2026
b6c802c
Merge pull request #358 from dayfine/autostory/declared-pose
dayfine Nov 11, 2026
5b95505
Merge nav/screen-state into autostory/engine
dayfine Nov 11, 2026
06c239c
Merge autostory/save-policy into autostory/engine
dayfine Nov 11, 2026
b305df5
AutoStory core: move nav/story-steps' 2D actions out of autostory/engine
dayfine Nov 11, 2026
eccd30f
Revert "AutoStory core: move the tile navigation package out of nav/s…
dayfine Nov 11, 2026
993be45
AutoStory 2D core: bring back the scene judges and interrupts
dayfine Nov 11, 2026
19b6f2e
Revert "AutoStory core: move nav/story-steps' 2D actions out of autos…
dayfine Nov 11, 2026
aa0597b
AutoStory: shared program shell for BDSP and FRLG
dayfine Nov 11, 2026
b43ebed
AutoStory: rename the program shell to StoryRun
dayfine Nov 11, 2026
d460243
Merge pull request #380 from dayfine/autostory/program-shell
dayfine Nov 11, 2026
87a9d32
AutoStory: start gate before a story run presses anything
dayfine Nov 11, 2026
a3b1c8e
AutoStory: Fold the start gate into the preflight hook
dayfine Nov 11, 2026
20e625b
AutoStory: StoryStart and its save rule in their own header
dayfine Nov 11, 2026
fb95f02
AutoStory: StoryStart under Types; one StoryPreflight with read()
dayfine Nov 11, 2026
5d01ba7
Merge #396 (nav/story-start-gate) into nav/grid-story-steps
dayfine Nov 11, 2026
1345efc
Pokemon Navigation: one movement mechanics table per game
dayfine Nov 12, 2026
d1359c7
Pokemon Navigation: MoveMechanics tests from a table of cases
dayfine Nov 12, 2026
dbe09a7
Pokemon Navigation: connected maps, one world type for BDSP and FRLG
dayfine Nov 12, 2026
b64cd70
Pokemon Navigation: connected maps tests take an expectation struct; …
dayfine Nov 12, 2026
a0991bc
Pokemon Navigation: ConnectedMaps::size()
dayfine Nov 12, 2026
b4b5f5e
Merge origin/nav/screen-state into autostory/engine
dayfine Nov 12, 2026
30b573b
Merge origin/autostory/engine into nav/grid-nav
dayfine Nov 12, 2026
d0a90b5
Merge origin/nav/grid-nav into nav/grid-screen-state
dayfine Nov 12, 2026
ea17f73
Merge origin/nav/grid-screen-state into nav/grid-story-steps
dayfine Nov 12, 2026
a17a983
Merge origin/nav/grid-story-steps into nav/move-mechanics
dayfine Nov 12, 2026
e5e09c2
Merge origin/nav/grid-story-steps into nav/connected-maps
dayfine Nov 12, 2026
182ec55
AutoStory: share screen_observation(), describe(ScreenEvents), same_s…
dayfine Nov 12, 2026
a8d5467
AutoStory: forward-declare Pokemon::ScreenEvents in Pokemon_StoryBack…
dayfine Nov 12, 2026
e0c9142
AutoStory: move screen_observation() into Pokemon_ScreenObservation.h
dayfine Nov 12, 2026
f8a22bc
Merge remote-tracking branch 'origin/autostory/engine' into nav/grid-nav
dayfine Nov 12, 2026
e8d9664
Merge remote-tracking branch 'origin/nav/grid-nav' into nav/grid-scre…
dayfine Nov 12, 2026
b59ef84
Merge remote-tracking branch 'origin/nav/grid-screen-state' into nav/…
dayfine Nov 12, 2026
8af084a
AutoStory: name the codec test's temporaries (GCC dangling-pointer)
dayfine Nov 11, 2026
2217fda
Merge branch 'nav/grid-screen-state' into nav/grid-story-steps
dayfine Nov 12, 2026
da24bcd
Merge branch 'autostory/engine' into nav/grid-nav
dayfine Nov 12, 2026
a4d67ed
Merge branch 'nav/grid-nav' into nav/grid-screen-state
dayfine Nov 12, 2026
dfe064a
Merge branch 'nav/grid-story-steps' into nav/move-mechanics
dayfine Nov 12, 2026
78abee2
Pokemon Navigation: step taps per gait; default member values; failur…
dayfine Nov 12, 2026
15c68cf
Merge branch 'nav/grid-screen-state' into nav/grid-story-steps
dayfine Nov 12, 2026
253928c
Merge branch 'nav/screen-state' into autostory/engine
dayfine Nov 12, 2026
f90c571
Merge branch 'autostory/engine' into nav/grid-nav
dayfine Nov 12, 2026
27734cf
Merge branch 'nav/grid-nav' into nav/grid-screen-state
dayfine Nov 12, 2026
91ea114
Merge branch 'nav/grid-story-steps' into nav/connected-maps
dayfine Nov 12, 2026
7f63e8b
Merge branch 'nav/grid-story-steps' into nav/move-mechanics
dayfine Nov 12, 2026
371bd8d
Pokemon Navigation: ConnectedMaps refuses temporaries, checks map ind…
dayfine Nov 12, 2026
213ceb7
Pokemon Navigation: stale-place cases carry their expectation (code h…
dayfine Nov 12, 2026
208f732
Pokemon Navigation: golden files for the overworld simulations
dayfine Nov 12, 2026
db23c63
Pokemon Navigation: sim golden tests as input and expectation cases
dayfine Nov 12, 2026
ab559c9
Pokemon Navigation: shared fault classes and per-class fault counters…
dayfine Nov 12, 2026
0ac724b
Merge #402 nav/move-mechanics into nav/grid-story-steps
dayfine Nov 12, 2026
29841ed
Merge origin/nav/grid-story-steps into nav/connected-maps
dayfine Nov 12, 2026
8be521c
Merge #408 nav/connected-maps into nav/grid-story-steps
dayfine Nov 12, 2026
81efa4b
Merge origin/nav/screen-state into autostory/engine
dayfine Nov 12, 2026
a3f3bc1
Merge origin/autostory/engine into nav/grid-nav
dayfine Nov 12, 2026
a1b9ccc
Merge origin/nav/grid-nav into nav/grid-screen-state
dayfine Nov 12, 2026
b6995fb
Merge origin/nav/grid-screen-state into nav/grid-story-steps
dayfine Nov 12, 2026
473dcb6
Merge origin/nav/grid-story-steps into nav/sim-goldens
dayfine Nov 12, 2026
ef68008
Merge origin/nav/sim-goldens into nav/sim-faults
dayfine Nov 12, 2026
625bc00
runtime-map-tests: link Pokemon_Direction.cpp (MapData uses direction…
dayfine Nov 12, 2026
a1d548c
Merge origin/nav/grid-nav into nav/grid-screen-state (runtime-map-tes…
dayfine Nov 12, 2026
54100ca
Merge origin/nav/grid-screen-state into nav/grid-story-steps (runtime…
dayfine Nov 12, 2026
90ad763
Merge origin/nav/grid-story-steps into nav/sim-goldens (runtime-map-t…
dayfine Nov 12, 2026
e3bea0d
Merge origin/nav/sim-goldens into nav/sim-faults (runtime-map-tests l…
dayfine Nov 12, 2026
f10f18f
StoryRun tests: one case struct per UnitTest (code-health test-case r…
dayfine Nov 12, 2026
f1e4502
Merge branch 'nav/grid-story-steps' into nav/sim-goldens
dayfine Nov 12, 2026
6abccc2
Merge branch 'nav/sim-goldens' into nav/sim-faults
dayfine Nov 12, 2026
ea9b142
Tests: nest Input and Expectation inside each native test case struct
dayfine Nov 12, 2026
e0fd679
Merge branch 'nav/grid-nav' into nav/grid-screen-state
dayfine Nov 12, 2026
3be04b2
Tests: nest Input and Expectation inside each native test case struct
dayfine Nov 12, 2026
9a43acd
Merge branch 'nav/grid-screen-state' into nav/grid-story-steps
dayfine Nov 12, 2026
3c4d867
Tests: nest Input and Expectation inside each native test case struct
dayfine Nov 12, 2026
21b5c2e
Merge branch 'nav/grid-story-steps' into nav/sim-goldens
dayfine Nov 12, 2026
b3990fd
Tests: nest Input and Expectation inside each native test case struct
dayfine Nov 12, 2026
6fd20a8
Merge branch 'nav/sim-goldens' into nav/sim-faults
dayfine Nov 12, 2026
373d5bc
Tests: nest Input and Expectation inside each native test case struct
dayfine Nov 12, 2026
b681c75
StoryRun tests: use ReloadCase::Expectation in the reload test
dayfine Nov 12, 2026
2fba611
Merge branch 'nav/grid-story-steps' into nav/sim-goldens
dayfine Nov 12, 2026
6d55195
Merge branch 'nav/sim-goldens' into nav/sim-faults
dayfine Nov 12, 2026
91d6235
Review fixes: comment content, designated initializers, include place…
dayfine Nov 12, 2026
3361d0b
Merge nav/grid-nav into nav/grid-screen-state
dayfine Nov 12, 2026
2c1815b
Review fixes: comment content, optional instead of a max() sentinel, …
dayfine Nov 12, 2026
f89bc00
TestExpect.h: namespace-close comments
dayfine Nov 12, 2026
cea7989
Merge nav/grid-screen-state into nav/grid-story-steps
dayfine Nov 12, 2026
8eb6f34
StoryActions: tests for a handler that throws and the HOME menu after…
dayfine Nov 12, 2026
27f8186
Review fixes: a throwing interrupt handler fails the step, HOME after…
dayfine Nov 12, 2026
b55d780
Merge nav/grid-story-steps into nav/sim-goldens
dayfine Nov 12, 2026
047fd8a
Review fixes: first_golden_difference returns an optional, with_crlf …
dayfine Nov 12, 2026
5939c68
Merge nav/sim-goldens into nav/sim-faults
dayfine Nov 12, 2026
801c8bf
Review fixes: fault_classes() checked against the enum, plain separat…
dayfine Nov 12, 2026
c2101fe
runtime-map tests: README passes the pinned publisher revision
dayfine Nov 12, 2026
ae1941b
Merge nav/grid-nav into nav/grid-screen-state
dayfine Nov 12, 2026
8e67a91
Merge nav/grid-screen-state into nav/grid-story-steps
dayfine Nov 12, 2026
9d73176
Merge nav/grid-story-steps into nav/sim-goldens
dayfine Nov 12, 2026
c55e280
Merge nav/sim-goldens into nav/sim-faults
dayfine Nov 12, 2026
1836dd3
AutoStory: shared RNG handoff contract
dayfine Nov 13, 2026
00624b4
AutoStory RNG handoff: a program's end can be the user's turn
dayfine Nov 13, 2026
eed3b65
AutoStory RNG handoff: options struct for the mode, test table
dayfine Nov 13, 2026
c4acda6
Merge autostory/rng-handoff (#445) into autostory/engine
dayfine Nov 13, 2026
2569cc5
Merge branch 'nav/grid-nav' into autostory/engine (#360)
dayfine Nov 13, 2026
8e0fa63
Transitions: ignore samples with no stats
dayfine Nov 13, 2026
45a46f7
AutoStory RNG handoff: red test: a stop reports its message and lines
dayfine Nov 13, 2026
6f8b402
Merge branch 'nav/grid-screen-state' into autostory/engine (#361)
dayfine Nov 13, 2026
32dfed5
Merge branch 'nav/grid-story-steps' into autostory/engine (#362)
dayfine Nov 13, 2026
0877430
AutoStory RNG handoff: report_rng_handoff_stop, the stop's log, overl…
dayfine Nov 13, 2026
a07b020
Merge branch 'nav/sim-goldens' into autostory/engine (#419)
dayfine Nov 13, 2026
45b04c5
Merge branch 'nav/sim-faults' into autostory/engine (#422)
dayfine Nov 13, 2026
1d4ff4b
Merge remote-tracking branch 'origin/autostory/engine' into HEAD
dayfine Nov 13, 2026
11f4a68
Merge branch 'nav/screen-state' into autostory/engine
dayfine Nov 13, 2026
fe7779e
Merge branch 'nav/screen-state' into autostory/engine
dayfine Nov 13, 2026
822301d
Merge remote-tracking branch 'origin/nav/screen-state' into HEAD
dayfine Nov 13, 2026
b688196
Merge origin/nav/screen-state into autostory/engine: #45 review fixes
dayfine Nov 13, 2026
0fe1130
Merge origin/nav/screen-state into autostory/engine: #45 review fixes
dayfine Nov 13, 2026
a347522
Merge origin/nav/screen-state into autostory/engine: shared checkpoin…
dayfine Nov 13, 2026
a76f816
AutoStory engine: retries through run_checkpoint_attempts()
dayfine Nov 13, 2026
33fccf1
Leg planner: optional open_stop_risk() and tap_stop_risk() on the ste…
dayfine Nov 13, 2026
26f1edd
Merge origin/nav/screen-state into autostory/engine
dayfine Nov 13, 2026
ae806d2
Merge origin/nav/screen-state into autostory/engine: screen events mo…
dayfine Nov 14, 2026
91c12d2
ScreenMachine: use the shared ScreenEvent vocabulary
dayfine Nov 14, 2026
5b56709
Merge nav/screen-state into autostory/engine
dayfine Nov 14, 2026
48f37b4
Story engine: a reload writes checkpoint_reset_line with the attempt …
dayfine Nov 14, 2026
4e354c5
Merge nav/screen-state into autostory/engine: add_checkpoint_prefix (…
dayfine Nov 14, 2026
fea49ba
Merge nav/screen-state into autostory/engine
dayfine Nov 14, 2026
b04652c
Merge nav/screen-state into autostory/engine
dayfine Nov 14, 2026
0acb65e
AutoStory TalkOver: a rule's `calm` sets the no-box time that ends a …
dayfine Nov 14, 2026
b432d7c
AutoStory tests: name each case outside its input
dayfine Nov 14, 2026
564859c
Merge nav/screen-state into autostory/engine: conformance run dropped…
dayfine Nov 14, 2026
9637e7c
Merge nav/screen-state into autostory/engine: review fixes from #312 …
dayfine Nov 14, 2026
6935936
AutoStory engine: name the text press timing (#332 review)
dayfine Nov 14, 2026
10b6a33
Merge nav/shared into autostory/engine: #312 and #313 merged
dayfine Nov 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/runtime-map-reader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Runtime map reader
on:
pull_request:
workflow_dispatch:
jobs:
native-schema:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@v7
with:
repository: dayfine/PokemonSimulation
ref: 906956e94fc912ae9adb0e44845da780f3bc7e4c
path: publisher
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- run: python devtools/runtime-map-tests/prepare_parity.py --publisher publisher --publisher-revision 906956e94fc912ae9adb0e44845da780f3bc7e4c --out runtime-map-pairs.json
- run: cmake -S devtools/runtime-map-tests -B build-runtime-maps -DCMAKE_BUILD_TYPE=Debug
- run: cmake --build build-runtime-maps --config Debug -j4
- run: ctest --test-dir build-runtime-maps -C Debug --output-on-failure
- if: runner.os != 'Windows'
run: ./build-runtime-maps/RuntimeMapTests runtime-map-pairs.json
- if: runner.os == 'Windows'
run: ./build-runtime-maps/Debug/RuntimeMapTests.exe runtime-map-pairs.json
2 changes: 2 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ add_library(SerialProgramsLib STATIC ${CORE_LIBRARY_SOURCES} ${LIBRARY_SOURCES})

# Data files built into the program (see cmake/EmbedTextFiles.cmake).
include(cmake/EmbedTextFiles.cmake)
pa_embed_text_files(SerialProgramsLib Source/Pokemon/Navigation/TestMaps
Pokemon/Navigation/Pokemon_NavigationTestMaps.h PokemonAutomation::Pokemon navigation_test_map_json)


# Create binary target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <cstdint>
#include <initializer_list>
#include <string>
#include <string_view>

namespace PokemonAutomation{

Expand Down Expand Up @@ -82,8 +83,9 @@ class ScreenEvents{

uint32_t m_bits = 0;
};
// "dialog box, player can move"; "nothing" when empty.
std::string describe(const ScreenEvents& events);
// "dialog box, player can move" (joined by `separator`); "nothing" when
// empty.
std::string describe(const ScreenEvents& events, std::string_view separator = ", ");



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ WarpFade fade_in(const ScreenEvents& events){
}
return WarpFade::NONE;
}
std::string describe(const ScreenEvents& events){
std::string describe(const ScreenEvents& events, std::string_view separator){
std::string out;
for (size_t c = 0; c < SCREEN_EVENT_COUNT; c++){
const ScreenEvent event = (ScreenEvent)c;
if (!events.has(event)){
continue;
}
if (!out.empty()){
out += ", ";
out += separator;
}
out += screen_event_name(event);
}
Expand Down
108 changes: 91 additions & 17 deletions SerialPrograms/Source/CommonTools/ScreenMachine/ScreenMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <algorithm>
#include <format>
#include <string>
#include <utility>
#include "CommonFramework/ImageTools/ImageDiff.h"
#include "ScreenMachine.h"

Expand All @@ -18,7 +20,7 @@

const ScreenState* classify(const std::vector<ScreenState>& states, const ImageViewRGB32& screen){
for (const ScreenState& state : states){
if (state.matches(screen)){
if (state.matches && state.matches(screen)){
return &state;
}
}
Expand All @@ -28,6 +30,23 @@
} // namespace


bool same_screen(const VideoSnapshot& a, const VideoSnapshot& b){
if (!a || !b || a->width() != b->width() || a->height() != b->height()){
return false;
}
return ImageMatch::pixel_RMSD(a, b) < 2.0;
}

const ScreenState* match_screen_state(const std::vector<ScreenState>& states, const ScreenObservation& observation){
for (const ScreenState& state : states){
if (state.matches_observation && state.matches_observation(observation)){
return &state;
}
}
return nullptr;
}


const ScreenState& read_screen_state(
VideoStream& stream, CancellableScope& scope,
const std::vector<ScreenState>& states, StepTrace& trace, VideoSnapshot& frame
Expand Down Expand Up @@ -64,38 +83,93 @@


void ScreenMachineChecks::check(const ScreenState& state, VideoSnapshot frame){
const bool same_size = m_last_frame && frame &&
m_last_frame->width() == frame->width() && m_last_frame->height() == frame->height();
if (same_size && ImageMatch::pixel_RMSD(m_last_frame, frame) < 2.0){
if (++m_unchanged >= MAX_UNCHANGED){
m_trace.fail(std::format(
"The screen stopped changing: {} steps on \"{}\" did nothing.", MAX_UNCHANGED, state.name
));
const std::optional<std::string> found = problem(state, std::move(frame), current_time());
if (found){
m_trace.fail(*found);
}
}

std::optional<std::string> ScreenMachineChecks::problem(const ScreenState& state, const ScreenObservation& observation){
return problem(state, observation.frame ? *observation.frame : VideoSnapshot(), observation.when);
}

std::optional<std::string> ScreenMachineChecks::unchanged_problem(const ScreenState& state, WallClock when){
if (state.max_still > Milliseconds::zero()){
if (when - m_changed_at > state.max_still){
return std::format("The screen stayed still on \"{}\" for more than {}s.", state.name, state.max_still.count() / 1000);
}
return std::nullopt;
}
if (++m_unchanged >= MAX_UNCHANGED){
return std::format("The screen stopped changing: {} steps on \"{}\" did nothing.", MAX_UNCHANGED, state.name);
}
return std::nullopt;
}

std::optional<std::string> ScreenMachineChecks::problem(const ScreenState& state, VideoSnapshot frame, WallClock when){

Check warning on line 109 in SerialPrograms/Source/CommonTools/ScreenMachine/ScreenMachine.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::ScreenMachineChecks::problem( const ScreenState & state , VideoSnapshot frame , WallClock when): function_lines=27 (advisory above 25, limit 50)
if (same_screen(m_last_frame, frame)){
std::optional<std::string> stalled = unchanged_problem(state, when);
if (stalled){
return stalled;
}
}else{
m_unchanged = 0;
m_changed_at = when;
}
m_last_frame = std::move(frame);

if (m_previous != nullptr && m_previous != &state && !m_previous->next.empty() &&
std::find(m_previous->next.begin(), m_previous->next.end(), state.name) == m_previous->next.end()
){
m_trace.fail(std::format("Unexpected screen after \"{}\": \"{}\".", m_previous->name, state.name));
return std::format("Unexpected screen after \"{}\": \"{}\".", m_previous->name, state.name);
}
m_in_a_row = m_previous == &state ? m_in_a_row + 1 : 1;
if (m_in_a_row > state.max_in_a_row){
m_trace.fail(std::format(
"Screen \"{}\" came up {} times in a row: the step for it is not getting anywhere.",
state.name, m_in_a_row
));
return std::format("Screen \"{}\" came up {} times in a row: the step for it is not getting anywhere.", state.name, m_in_a_row);
}
if (++m_visits[state.name] > state.max_visits){
m_trace.fail(std::format(
"Screen \"{}\" came up more than {} times: the step for it is not working.",
state.name, state.max_visits
));
return std::format("Screen \"{}\" came up more than {} times: the step for it is not working.", state.name, state.max_visits);
}
m_previous = &state;
return std::nullopt;
}


ScreenMachineResult run_screen_machine_on_observations(

Check warning on line 138 in SerialPrograms/Source/CommonTools/ScreenMachine/ScreenMachine.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::run_screen_machine_on_observations( const std :: function<ScreenObservation()> & observe , CancellableScope & scope , const std :: vector<ScreenState> & states , Milliseconds timeout , StepTrace & trace): function_lines=36 (advisory above 25, limit 50)
const std::function<ScreenObservation()>& observe, CancellableScope& scope,
const std::vector<ScreenState>& states, Milliseconds timeout, StepTrace& trace
){
// Looks before the run stops even when nothing else ends it (looks with
// no time, states with no visit limit).
constexpr size_t MAX_LOOKS = 10000;
ScreenMachineChecks checks(trace);
std::optional<WallClock> start;
for (size_t looks = 0; looks < MAX_LOOKS; looks++){
scope.throw_if_cancelled();
const ScreenObservation observation = observe();
if (!start){
start = observation.when;
}
if (observation.when - *start > timeout){
return {.terminal = "", .failure = std::format("Did not finish within {}s.", timeout.count() / 1000)};
}
const ScreenState* state = match_screen_state(states, observation);
if (state == nullptr){
return {.terminal = "", .failure = "The screen matches none of the known states."};
}
trace.screen(state->name);
std::optional<std::string> found = checks.problem(*state, observation);
if (found){
return {.terminal = "", .failure = std::move(*found)};
}
if (state->act){
state->act();
}
if (state->terminal){
return {.terminal = state->name, .failure = ""};
}
}
return {.terminal = "", .failure = std::format("Did not finish within {} looks.", MAX_LOOKS)};
}


Expand Down
58 changes: 57 additions & 1 deletion SerialPrograms/Source/CommonTools/ScreenMachine/ScreenMachine.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Screen Machine

Check warning on line 1 in SerialPrograms/Source/CommonTools/ScreenMachine/ScreenMachine.h

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<header>: header_symbols=7 (advisory above 6, limit 8)
*
* From: https://github.com/PokemonAutomation/
*
Expand All @@ -16,13 +16,15 @@
#include <stdint.h>
#include <functional>
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "Common/Cpp/Time.h"
#include "Common/Cpp/CancellableScope.h"
#include "CommonFramework/ImageTypes/ImageViewRGB32.h"
#include "CommonFramework/Tools/VideoStream.h"
#include "CommonFramework/VideoPipeline/VideoFeed.h"
#include "ScreenObservation.h"
#include "StepTrace.h"

namespace PokemonAutomation{
Expand All @@ -34,6 +36,11 @@
// Whether this is the screen. States are tried in order; the first match wins, so
// the last state should match anything.
std::function<bool(const ImageViewRGB32& screen)> matches;
// Whether this is the screen, from what a look at the game observed
// instead of from its pixels, so the state also runs in a simulation.
// A state may have either or both; read_screen_state() uses `matches`
// and skips a state without it.
std::function<bool(const ScreenObservation& observation)> matches_observation = nullptr;
// The one step to take on this screen.
std::function<void()> act;
// The screens the step may lead to besides staying here. Empty: any.
Expand All @@ -44,6 +51,13 @@
bool terminal = false;
// Fail once the screen has been seen this many times in a row.
size_t max_in_a_row = SIZE_MAX;
// How long the screen may stay unchanged on this state. A waiting
// state (a fade, a still cutscene, a hold before a screen counts) sets
// it: its looks never count as a stall, and it fails only once the
// screen has not changed for longer than this. Zero: the state's step
// is input that should change the screen, and MAX_UNCHANGED such
// steps that do not are a stall.
Milliseconds max_still = Milliseconds::zero();
};


Expand All @@ -54,16 +68,30 @@
const std::vector<ScreenState>& states, StepTrace& trace, VideoSnapshot& frame
);

// The first of `states` whose matches_observation() accepts `observation`;
// null when none does. States without one are skipped.
const ScreenState* match_screen_state(const std::vector<ScreenState>& states, const ScreenObservation& observation);

// The checks between reads: the screen must be one the previous state can lead
// to, no state may come up too often, and steps must keep changing the screen.
// to, no state may come up too often, and steps must keep changing the screen
// (a waiting state's only for its ScreenState::max_still).
class ScreenMachineChecks{
public:
ScreenMachineChecks(StepTrace& trace)
: m_trace(trace)
{}
// Fails through the trace on a problem.
void check(const ScreenState& state, VideoSnapshot frame);
// The problem with `state` coming up on `observation`, if any. The
// screen counts as unchanged only when it and the look before both have
// a frame and the frames match; how long, by the looks' `when`.
std::optional<std::string> problem(const ScreenState& state, const ScreenObservation& observation);

private:
std::optional<std::string> problem(const ScreenState& state, VideoSnapshot frame, WallClock when);
// The stall problem, if any, of `state` on a frame unchanged since `m_changed_at`.
std::optional<std::string> unchanged_problem(const ScreenState& state, WallClock when);

// A step that changes nothing on screen is a dead end (e.g. a menu the states do
// not know): fail after a few instead of running out the visit limit.
static constexpr size_t MAX_UNCHANGED = 8;
Expand All @@ -72,6 +100,8 @@
std::map<std::string, size_t> m_visits;
const ScreenState* m_previous = nullptr;
VideoSnapshot m_last_frame;
// When the screen last changed (or was first read).
WallClock m_changed_at = WallClock::min();
size_t m_unchanged = 0;
size_t m_in_a_row = 0;
};
Expand All @@ -85,6 +115,32 @@
const std::vector<ScreenState>& states, Milliseconds timeout, StepTrace& trace
);


// How a run of states over observations ended.
struct ScreenMachineResult{
// The terminal state that acted; empty when the run failed.
std::string terminal;
// Why it failed: no state matched, an unexpected screen, a state seen too
// often, a stall, or the timeout.
std::string failure;

bool succeeded() const{
return failure.empty();
}
};

// The same loop as run_screen_machine() over looks from `observe` instead of
// frames, so it runs on a console and in a simulation alike: each look picks
// the first state whose matches_observation() accepts it (one look, no second
// read: an observation is already settled), the trace records it, the checks
// apply, then the state acts. Time is the looks' own (`when`): the run fails
// once `timeout` has passed since the first look, and after 10000 looks in
// any case. A failure is returned, not thrown.
ScreenMachineResult run_screen_machine_on_observations(
const std::function<ScreenObservation()>& observe, CancellableScope& scope,
const std::vector<ScreenState>& states, Milliseconds timeout, StepTrace& trace
);

template <typename ControllerContext>
std::string run_screen_machine(
VideoStream& stream, ControllerContext& context,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* Screen Observation
*
* From: https://github.com/PokemonAutomation/
*
* What one look at the game showed, as facts rather than pixels: the
* events on screen (a fade, a dialog box, a battle) and named readings. A
* console fills it from a frame with the game's detectors; a simulation
* fills it from its model and has no frame. A ScreenState that matches on
* an observation (ScreenState::matches_observation) therefore runs in
* both.
*
*/

#ifndef PokemonAutomation_CommonTools_ScreenObservation_H
#define PokemonAutomation_CommonTools_ScreenObservation_H

#include <functional>
#include <map>
#include <optional>
#include <string>
#include "Common/Cpp/Time.h"
#include "CommonFramework/VideoPipeline/VideoFeed.h"
#include "CommonTools/ScreenEvents/ScreenEventTypes.h"

namespace PokemonAutomation{


// One look at the game.
struct ScreenObservation{
WallClock when = WallClock::min();
ScreenEvents events = {};
// Named numbers a reader found: "bag.RARE_CANDY", "facing",
// "heading" (degrees clockwise from north, [0, 360)).
std::map<std::string, int, std::less<>> readings = {};
// The frame looked at; none in a simulation. A state that needs it
// can only run on a console.
std::optional<VideoSnapshot> frame = std::nullopt;
};

// Whether `a` and `b` both have a frame of the same size within the
// still-screen RMSD threshold (2.0).
bool same_screen(const VideoSnapshot& a, const VideoSnapshot& b);



} // namespace PokemonAutomation
#endif
Loading
Loading