Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f185de0
BDSP AutoStory: no route ends beside a warp walking toward it
dayfine Nov 9, 2026
c19b411
BDSP AutoStory: the story sim's old steps in their own file
dayfine Nov 9, 2026
26b4ed4
BDSP AutoStory: a dim cave floor is not a tap step's fade
dayfine Nov 9, 2026
a6641e7
BDSP AutoStory: mark the tap step's fade and through-already checks a…
dayfine Nov 9, 2026
8758c35
BDSP AutoStory: dump every story ROUTE step's planned legs to a golde…
dayfine Nov 9, 2026
b73ffa5
BDSP AutoStory: the story's route plans golden file
dayfine Nov 9, 2026
12e1203
Merge bdsp/autostory-mine-floaroma-wip (with #269) into bdsp/autostor…
dayfine Nov 9, 2026
afe4c45
BDSP AutoStory: a wall leg that never moved waits, then plans from it…
dayfine Nov 9, 2026
e94a655
BDSP AutoStory: red tests for routes along wander zones and short wal…
dayfine Nov 9, 2026
814a825
BDSP AutoStory: no route runs along a wander zone; short wall legs wa…
dayfine Nov 9, 2026
b9c2d8b
BDSP AutoStory: red tests for 01.10's line-5 recovery wall and a batt…
dayfine Nov 9, 2026
f844923
BDSP AutoStory: recovery takes the cheapest whole walk; 01.10 runs in…
dayfine Nov 9, 2026
b6a554a
BDSP AutoStory: keep the story table under the length limit; line-7 c…
dayfine Nov 9, 2026
83c09c7
BDSP AutoStory: red sim test for 01.11's walk to the old woman
dayfine Nov 9, 2026
dd502a1
BDSP AutoStory: 01.11 walks west to the field's edge, then 4 taps east
dayfine Nov 9, 2026
6437c1b
Merge bdsp/autostory-old-couple-clip (#279) into bdsp/autostory-route…
dayfine Nov 9, 2026
8c9ba9b
BDSP AutoStory: regenerate the route plans golden after #277, #278 an…
dayfine Nov 9, 2026
9167eba
BDSP AutoStory: move the story sim's executor out of its tests
dayfine Nov 9, 2026
ca4d9ab
BDSP AutoStory: console failure cases on the story sim, known failing…
dayfine Nov 9, 2026
769e8b7
BDSP AutoStory: console failure cases on the story sim (known failing…
dayfine Nov 9, 2026
d8b812d
BDSP AutoStory: a warp is a fade or a banner; walks report warps (#26…
dayfine Nov 9, 2026
56a487b
Merge bdsp/autostory-route-plan-dump (#281 squash-merged) into bdsp/a…
dayfine Nov 9, 2026
7aeb9e9
Merge bdsp/autostory-mine-floaroma-wip (#279 with #285 squash-merged)…
dayfine Nov 9, 2026
3ad9fa1
Merge bdsp/autostory-route-plan-dump (#270, with #255) into bdsp/auto…
dayfine Nov 9, 2026
b5f352e
Merge bdsp/autostory-mine-floaroma-wip (#270 squash-merged) into bdsp…
dayfine Nov 9, 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <algorithm>
#include <cstdlib>
#include <format>
#include "Common/Cpp/Exceptions.h"
#include "PokemonBDSP_AutoStory_StoryWorld.h"
Expand Down Expand Up @@ -294,6 +295,37 @@ std::optional<TilePos> step(const StoryWorld& world, const TilePos& from, Direct
return std::nullopt;
}

std::vector<TilePos> leg_path(const StoryWorld& grid, TilePos from, Direction direction, size_t tiles){
std::vector<TilePos> path;
size_t travelled = 0;
while (travelled < tiles){
const std::optional<TilePos> next = step(grid, from, direction);
if (!next){
break;
}
travelled += std::abs(next->x - from.x) + std::abs(next->y - from.y);
from = *next;
path.push_back(from);
}
return path;
}

bool warp_within(const StoryWorld& world, const std::vector<TilePos>& from, Direction direction, size_t reach){
for (TilePos pos : from){
for (size_t i = 0; i < reach; i++){
if (world.tile(pos.next(direction)) == TileKind::DOOR){
return true;
}
const std::optional<TilePos> next = step(world, pos, direction);
if (!next){
break;
}
pos = *next;
}
}
return false;
}

// Someone standing in the way stops us too, but is no wall to stop against:
// they may turn and talk, or walk off (r29 ran east into Mom, who talked).
bool at_wall(const StoryWorld& world, const TilePos& pos, Direction direction){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ std::optional<Pokemon::TilePos> step(const StoryWorld& world, const Pokemon::Til
// in place. Doors and tiles off the maps are not walls: walking into a
// door enters the building, and ground off the maps may be an exit.
bool at_wall(const StoryWorld& world, const Pokemon::TilePos& pos, Pokemon::Direction direction);
// The tiles the player passes when walking `tiles` tiles from `from`, the
// first one after `from` first. Stops early where the player is stopped.
std::vector<Pokemon::TilePos> leg_path(const StoryWorld& grid, Pokemon::TilePos from, Pokemon::Direction direction, size_t tiles);
// Whether a warp (a door's tile) lies within `reach` tiles `direction` of
// one of `from`, nothing stopping the player before it: where a walk that
// ran on past its leg's end may have gone through (#268 slice 2).
bool warp_within(const StoryWorld& world, const std::vector<Pokemon::TilePos>& from, Pokemon::Direction direction, size_t reach);
// "Route 201 (45, 3)", or "world (x, y)" if no map holds it.
std::string describe(const StoryWorld& world, const Pokemon::TilePos& pos);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* BDSP Recovery Walk Tests

Check warning on line 1 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_RecoveryWalk_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=839 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -86,9 +86,9 @@
virtual void fight(const std::string&) override{ throw GridSimFailure{"unexpected trainer"}; }
virtual void walk_until_stopped(Direction, size_t, const std::string&) override{ throw GridSimFailure{"unexpected blind hold"}; }
virtual bool run_until_map(Direction, Milliseconds, const std::string&, const std::string&) override{ throw GridSimFailure{"unexpected banner walk"}; }
virtual bool run_into_door(Direction, bool, Milliseconds = Milliseconds(12000), Milliseconds = Milliseconds(0)) override{ throw GridSimFailure{"unexpected door"}; }
virtual WarpSeen run_into_door(Direction, bool, Milliseconds = Milliseconds(12000), Milliseconds = Milliseconds(0), const std::string& = "") override{ throw GridSimFailure{"unexpected door"}; }
virtual std::optional<size_t> tap_to_banner(Direction, const std::string&, size_t) override{ throw GridSimFailure{"unexpected banner"}; }
virtual void settle(Button, const std::string&, bool) override{ throw GridSimFailure{"unexpected scene"}; }
virtual void settle(Button, const std::string&, bool, const std::string&) override{ throw GridSimFailure{"unexpected scene"}; }
private:
RouteIO& m_route;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ Outcome StoryExecutor::heal(RunState&, const StoryStep& step){
// Out the same way: south until the fade. The walk out's indoor check
// read "not a room" a step from the counter and stopped inside (r50, r59).
route_turn(stream(), context(), Direction::SOUTH);
const bool out = m_io.run_into_door(Direction::SOUTH, m_walks.can_run());
const bool out = m_io.run_into_door(Direction::SOUTH, m_walks.can_run()).any();
stream().log(std::format("[{}] {}: south out of the Center: {}.", m_checkpoint, step.name, out ? "faded" : "no fade yet"));
m_io.settle(BUTTON_B, label_of(step), !out);
m_io.settle(BUTTON_B, label_of(step), !out, "");
// r143a's heal said it had walked out while still inside.
context().wait_for_all_requests();
VideoSnapshot screen = stream().video().snapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,25 @@ const std::string& story_banner_name(const std::string& map){
return banner_name(map);
}

std::string story_arrival_banner(const std::string& from, const std::string& to){
// The named places, by the place each map is part of: the mine's two floors are one.
static const std::map<std::string, std::string> caves{
{"OreburghGate", "OreburghGate"},
{"OreburghMine", "OreburghMine"},
{"OreburghMineB1F", "OreburghMine"},
{"RavagedPath", "RavagedPath"},
};
const auto place = [](const std::string& map) -> std::string{
if (banner_names().contains(map)){
return banner_name(map);
}
const auto cave = caves.find(map);
return cave == caves.end() ? "" : cave->second;
};
const std::string there = place(to);
return there.empty() || there == place(from) ? "" : story_banner_name(to);
}

const StoryWorld* story_plan_world(const std::string& from, const std::string& to){
for (const PlanWorld& world : plan_worlds()){
if (world.maps.contains(from) && world.maps.contains(to)){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const StoryWorld* story_plan_world(const std::string& from, const std::string& t
// The location banner of the JSON map `map` ("Route 204" for both of its
// halves), or `map` itself for one no banner list names.
const std::string& story_banner_name(const std::string& map);
// The banner (story_banner_name()) a warp from the JSON map `from` onto
// `to` shows, or "" if none: arriving in another town, route or cave shows
// its name (out of the Gym, Oreburgh City's), arriving in a house, a lab,
// a school or another floor of the same cave shows none.
std::string story_arrival_banner(const std::string& from, const std::string& to);

// The tile `local` of the map `map` in `world`.
Pokemon::TilePos story_to_world(const StoryWorld& world, const std::string& map, const Pokemon::TilePos& local);
Expand Down
Loading
Loading