Skip to content

FRLG AutoStory: stage 8's rows as JSON (00.28, 00.29) - #340

Merged
dayfine merged 58 commits into
frlg/stage8-rocktunnelfrom
frlg/stage8-json
Nov 10, 2026
Merged

dayfine merged 58 commits into
frlg/stage8-rocktunnelfrom
frlg/stage8-json

Conversation

@dayfine

@dayfine dayfine commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Depends on #293 (base frlg/stage8-rocktunnel, with frlg/checkpoint-replay and #339 merged in).

Stage 8's rows were still C++ on the old step fields. This moves 00.28 and 00.29 into StoryData/ in #312's step format, the way #338 did for stage 7, on the one reader in PokemonFRLG_AutoStoryTable.

  • Each file has "metadata": {"phase": "testing"}; the row comments became the files' notes.
  • PokemonFRLG_AutoStoryTableLavender.cpp and TableSteps.h go with the C++ rows; the Lavender and FaultSweep tests read step args and name their maps themselves, and add_tests_AutoStoryLavender moves to PokemonFRLG_AutoStoryRows_Tests.h.
  • The row sims keep stage 8's sim_step_once/sim_turn_to and the battle-end check, with directions and poses from args.
  • The spin, hole and button tiles go into Pokemon_MapTiles.h, where the parent moved TileKind.
  • Review commit by commit: the merge keeps stage 8's C++ rows in a parity test; the next commit deletes it.

Testing: full build; --command-line-test-mode --profile unit-tests: the parity test passed on the merge; at the tip PokemonFRLG::AutoStory*, Pokemon::Story* and StoryReplay pass apart from the 12 FileException image tests and AutoStoryResources, which wants PokemonFRLG/PlayerSprites/red_normal.png, not in upstream Packages. Code health against frlg/stage8-rocktunnel: 0 failures. Nothing ran on a console.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

dayfine and others added 30 commits November 9, 2026 21:36
route_plan_line() put each planned leg on its own line under "plan from
X:", so one log record wrapped across several lines while every other
route line is one. The legs now follow on the same line, separated by
"; ", in the same text route_leg_line() writes for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
They build and read a TilePose, so they live with it instead of in the
story step executor header (#312 review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…utor, StoryChecks to StoryCheckLevel

File moves and path updates only (#312 review): the story-step and
authored-checkpoint JSON modules are I/O, so they go under
Pokemon/AutoStory/Data/; Pokemon_StorySteps is named for what it holds,
the StoryStepExecutor; Types/Pokemon_StoryChecks becomes
Pokemon_StoryCheckLevel ahead of the type's rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
- StoryStepExecutor.h keeps the executor and building checkpoints:
  tile_pose() and facing_of() are in Pokemon_TilePose (merged from #114),
  record_story_stats() becomes SegmentReport::story_counts() for
  record_story_counts(), and build_story_checkpoint() takes an optional
  PreparedSteps* instead of a second overload.
- StoryLog: default arguments instead of overloads; the segment's reload
  line is segment_reload_line().
- StoryChecks is StoryCheckLevel; names come back as std::string, and
  GAME_NOT_RUNNING is a std::string_view constant: no char* in new code.
- StoryArgType::FLAG is BOOLEAN; story_args_errors() returns every error.
- Authored checkpoint JSON: validate_json_fields(), `game`, and an
  EmbeddedJsonFile alias for the embedded resources.
- StoryRunOptions takes the game's languages from the new
  Pokemon_GameLanguages (generations 8-9, and FireRed/LeafGreen), and the
  checkpoint dropdown is built from a span of checkpoints without the
  StoryCheckpointEntry adapter.
- Read-only strings and sequences as std::string_view and std::span.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…/screen-state

# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
…/story-steps

# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
story_args_errors() now returns each error (#312 review); the action table's
checkpoint lint reports one problem per error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
- StoryArgs -> StoryActionArg(s) (Types/Pokemon_StoryActionArg.h) and
  StoryActionSpec (Types/Pokemon_StoryActionSpec.h): typed values (boolean,
  integer, word, direction, grid pose, legs, words, items), specs with
  fallbacks and a why line.
- StoryStep keeps only the shared fields plus `action` (was `variant`) and
  `args`; target/direction/legs/fight_wild/yes/may_lose/battles/items are
  args of the built-in actions (Pokemon_StoryActions.h).
- GridPose (Types/) aggregates map, tiles and facing for 2D grids; a
  step's pose_after and a checkpoint's start use it.
- JSON is parsed in one layer: read_story_step() parses args against the
  action's spec and fills fallbacks; the authored envelope hands its
  execution object to the game's reader instead of keeping JSON.
- Explicit map utils taking the find() iterator (Pokemon_MapUtil.h)
  replace the story_arg_* helpers; story_arg<T>() reads a loaded arg.
- StoryVariant is dropped: tables move to JSON args.
- Check levels: TESTING, THOROUGH, DEFAULT, FAST, SPEEDRUN (DEFAULT is
  the default).
- SegmentPolicy drops stop_at_first_failure (attempts 1 does it) and
  recoveries_per_event (with SegmentHooks::recover); the plain segment
  types move to Types/Pokemon_StorySegmentTypes.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…ng gives them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…#320)

StoryLog (checkpoint log lines, stats counts) and StoryRangeOptions (the
start/end checkpoint dropdowns, story_checkpoint_database()) moved
unchanged from #312, so the SV program (#320) and the engine (#114) can
share them without the story engine. story_checkpoint_database() now takes
the checkpoints' labels instead of StoryCheckpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…ySegments edits

Moved from #312 per its review: StoryEvents' and StorySegments' changes
(StoryLog lines), SegmentPolicy without stop_at_first_failure and
recoveries_per_event, and the plain segment types in
Types/Pokemon_StorySegmentTypes.h. StoryLog comes from the prep PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…tions and the segment edits now come from below

StoryLog and StoryRangeOptions (with story_checkpoint_database(), which now
takes labels) live in the prep PR on #45; StoryEvents' and StorySegments'
edits and Types/Pokemon_StorySegmentTypes.h live in #114. This PR keeps
story_checkpoint_label() and registers only the engine's own suites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…122's action table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…typed arg specs (after #312's review)

The variant word tests go with Pokemon_StoryVariant; the segment test no
longer sets in-place recoveries, which SegmentPolicy dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The newer code-health rules (header symbol counts, no char* / char[],
no prefix overloads) failed 34 times against this branch. Declarations
move unchanged into headers by concern, each included by the header they
came from (StoryEvents: pose, outcome, event, checkpoint types; LegWalker:
leg types; MapData: tiles, features; RouteLog: types, legs). The *_name()
helpers return std::string, test tables hold std::string(_view), and
outcome_ok() takes an optional pose. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
The newer code-health rules failed 22 times against nav/story-engine.
Declarations move unchanged into headers by concern, each included by the
header they came from (ScreenEvents: event types, fades, event log;
Interrupts: warp judge; StoryInterrupts: interrupt handlers; Transitions:
fade profiles; AutoStory_Tests: the screen-state suites). The *_name()
helpers return std::string and test rows hold std::string. No behavior
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 27 commits November 10, 2026 07:00
…ction/args steps

The FRLG stack stopped building after #312: the C++ rows set step.target,
legs, direction, fight_wild and may_lose directly, StoryChecks became
StoryCheckLevel, Pokemon_StorySteps.h moved to Pokemon_StoryStepExecutor.h
and the JSON codecs to Data/.

- Each checkpoint is StoryData/frlg-<id>.plan.json (pokesim-authored-
  checkpoint/1), read with read_authored_checkpoint() against FRLG's
  actions: the built-in ones plus ROUTE/LEGS "run". The parser fills in
  the fallbacks (fight_wild, may_lose, yes), so the files give only what
  differs. FRLG's execution object carries the START menu, the supplies,
  the lead after Brock and the notes that were C++ comments.
- The executor, the step-table, sim and route tests read typed args
  (story_arg<T>()); the sim's fake game dispatches by kind in run().
- Check levels: DEFAULT and above check the screen as THOROUGH did;
  FAST and SPEEDRUN trust counts as FAST did.
- AutoStory: StoryRunOptions with the FRLG languages, the check level and
  language into StoryEnv, record_story_counts().

The old C++ rows stay in PokemonFRLG_AutoStoryTableParity_Tests.cpp for
this commit only: each file loads to the same steps, args, poses,
supplies and START menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The previous commit's parity test passed: every StoryData file loads to
its old C++ row. The rows and the test go; StoryData/ is the table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…s JSON

Stage 1 moved 00.01-00.10 into StoryData/ on #312's action/args steps.
Stage 2's own rows follow it:

- 00.01 (handoff sid_helper, the new intro why), 00.01b (live start, the
  GAME step close_trainer_card), 00.04 (to the ball, handoff starter_rng)
  and 00.04b are files; FRLG's execution object reads "handoff" and
  "live_start".
- close_trainer_card is an FRLG GAME action with no args; StoryExecutor's
  GAME action dispatches on step.action instead of overriding the old
  per-kind game().
- AutoStory: check level and language into StoryEnv, record_story_counts();
  the run-plan tests convert the start GridPose.

The C++ rows stay in PokemonFRLG_AutoStoryTableParity_Tests.cpp for this
commit only, and every file loads to its row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The merge's parity test passed: every StoryData file, 00.01b and the
00.04/00.04b split included, loads to its C++ row. The rows and the test go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG AutoStory stage 2: 00.01b and the 00.04 split as JSON
… JSON

Stage 3 ported to #312's action/args steps, its checkpoints moved into
StoryData/ the way #330 and #331 moved stages 1 and 2.

- 00.11, 00.12, 00.12b, 00.12c and 00.13 are files, and 00.10 gains its
  walk to below Pewter's Center. Each carries "metadata": {"phase":
  "testing"}, which FRLG's reader checks and strips before the shared one.
- FRLG's GAME actions declare typed args in place of the variant strings:
  pc (do, slot, box, if_present), capture, fossil, level, mart, teach and
  grind (whose nurse is now its "nurse" arg), plus leave_gift_summary.
  Their specs are in story_action_specs(); the step table binds each to
  the GAME action with its args. VariantWords became GameArgs.
- The execution object's handoff takes gift_rng.

The old C++ rows stay in PokemonFRLG_AutoStoryTableParity_Tests.cpp for
this commit only: every file loads to the same steps, args, poses,
supplies and START menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The parity test passed on the merge before this commit: every StoryData
file through 00.13 loads to the C++ row it replaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG AutoStory stage 3: 00.10-00.13 as JSON, GAME steps with typed args
… as JSON

Stage 4's checkpoints 00.14 to 00.16 (with 00.14b, 00.14c and 00.15b) as
StoryData files in the #312 step format, each marked "phase": "testing".
The STEP "trainer_line" action is a spec, Mart and TEACH steps load as
once per save, and stage 4's tests read steps through their args.
A parity test checks the files load to the C++ rows they replace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The parity test passed in the merge before this commit: every story file
loads to the C++ row it replaces. The rows went with the merge's Table.cpp;
this removes the parity test that held them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG AutoStory: stage 4's checkpoints as JSON
…ws as JSON

Stage 5's checkpoints 00.17 to 00.20, and 00.14's Mega Kick tutor, as
StoryData files in the #312 step format, each marked "phase": "testing".
TEACH takes the tutor as its item; pacing and the walk back after a
trainer's battle read the GRIND's or capture's args. A parity test checks
the files load to the C++ rows they replace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The parity test passed in the merge before this commit: every story file
loads to the C++ row it replaces. This removes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG AutoStory: stage 5's checkpoints as JSON
…s JSON

Stage 6's checkpoints 00.21 to 00.25 as StoryData files in the #312 step
format, each marked "phase": "testing". The row-building TableSteps and
TableVermilionGym files go with the C++ rows. Cut, the trash cans, the
trainer wait and the GRIND check are action specs; a GAME action with
its own row keeps that row's console action. The row sims and stage 6's
tests read step args. A parity test checks the files load to the C++
rows they replace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The parity test passed in the merge before this commit: every story file
loads to the C++ row it replaces. This removes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG AutoStory: stage 6's checkpoints as JSON
…ows as JSON

Stage 7's checkpoints 00.26 and 00.27 as StoryData files in the #312 step
format, each marked "phase": "testing". The Celadon and TableSteps rows
go with the C++ rows. Stage 7's own JSON pilot (Data/JsonParser, the
Parcel capture and plan, its README and the Parcel sim test) is dropped
for the one reader in PokemonFRLG_AutoStoryTable; Data/JsonWriter and its
export tests stay. step_onto() is a hop: a STEP with a direction and a
declared end. A parity test checks the files load to the C++ rows they
replace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The parity test passed on the merge before this commit: every StoryData
file through 00.27 loads to the C++ row it replaces. The row tests'
registrations move to PokemonFRLG_AutoStoryRows_Tests.h and Viridian's
SHOP step to PokemonFRLG_AutoStoryViridianMart, which keeps the story
table header and the events file within their size limits; the shop is
moved unchanged but for reading its args through story_arg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG AutoStory: stage 7's rows as JSON (00.26, 00.27)
…play reads #312 steps

Stage 7 now reads its rows from StoryData in the #312 step format and
has one checkpoint reader, without the legacy export reader or the
Parcel capture the replay read. The replay keeps the capture's exact
bytes as ReplayData/capture.json, which binding.json pins, and reads its
checkpoint in the step format: a route's target and a step's direction
(north where the export left the default out) become args. The executor
reads targets, directions and poses through story_arg and pose_of; its
report gives the engine's pose as a grid pose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG story replay: read the capture in #312's step format after stage 7's JSON
…rows as JSON

Stage 8's checkpoints 00.28 and 00.29 as StoryData files in the #312 step
format, each marked "phase": "testing"; the Lavender rows and TableSteps
go with the C++ rows. Stage 8's FaultSweep and Lavender tests read step
args; the row sims keep stage 8's sim_step_once/sim_turn_to and battle
end check with the args. The spin, hole and button tiles go into
Pokemon_MapTiles.h, where the parent moved TileKind. A parity test checks
the files load to the C++ rows they replace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The parity test passed on the merge before this commit: every StoryData
file through 00.29 loads to the C++ row it replaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine
dayfine marked this pull request as ready for review November 10, 2026 19:35
@dayfine
dayfine merged commit bf5f498 into frlg/stage8-rocktunnel Nov 10, 2026
8 of 12 checks passed
@dayfine
dayfine deleted the frlg/stage8-json branch November 13, 2026 03:26
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