Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
a40f0e0
BDSP navigation: the story maps as JSON, their grids and plan costs, …
dayfine Nov 1, 2026
4383d4e
Unit tests: run the PokemonBDSP tests
dayfine Nov 1, 2026
5c553b3
Merge bdsp/maps-v4 into bdsp/nav-v4: the maps come from the generator
dayfine Nov 1, 2026
22aea33
BDSP navigation: the story world and the route planner on the shared …
dayfine Nov 1, 2026
dc74ccb
BDSP navigation: the story code reads the JSON maps; the per-map grid…
dayfine Nov 1, 2026
ce58d01
Merge branch 'bdsp/maps-v4' into bdsp/nav-v4
dayfine Nov 1, 2026
c83b4e4
BDSP navigation: slide_to_wall(), and Route 202's areas from the map'…
dayfine Nov 1, 2026
75aedce
Merge bdsp/maps-v4 (45a2eaf73: the loader takes string_view) into bds…
dayfine Nov 1, 2026
fd2202d
BDSP navigation tests: name every field, or give it a default
dayfine Nov 1, 2026
2d4bed5
Merge bdsp/maps-v4 (7c21897ce: nav/story-steps e67d36ccb) into bdsp/n…
dayfine Nov 1, 2026
282212e
BDSP navigation: change grid cells with Pokemon::cell_at()
dayfine Nov 1, 2026
b798ef3
BDSP navigation: StoryWorld keeps seven methods; walking rules are fr…
dayfine Nov 1, 2026
32af0ff
Merge bdsp/maps-v4 (#122 at b966c5d93) into bdsp/nav-v4
dayfine Nov 1, 2026
b585b8c
BDSP navigation: Segment 00 tests header in CRLF
dayfine Nov 1, 2026
2daaa60
BDSP navigation: people on the maps are no wall to stop against
dayfine Nov 2, 2026
aade883
BDSP navigation: occupied() tells people from blocked tiles, in Story…
dayfine Nov 2, 2026
1b7b60f
Merge the BDSP chain forward
dayfine Nov 2, 2026
058c104
BDSP maps: the lab's door mat in Sandgem, a row below its door
dayfine Nov 2, 2026
3090e64
Merge the BDSP chain forward
dayfine Nov 2, 2026
34a0d2c
Merge the BDSP chain forward
dayfine Nov 2, 2026
b8dbc5d
Merge the BDSP chain forward
dayfine Nov 2, 2026
e815395
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 2, 2026
11d3f93
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 2, 2026
d5c17a0
BDSP navigation: build against the new MapData tile kinds and fields
dayfine Nov 2, 2026
7e5f739
Merge bdsp/maps-v4 (coord events) into bdsp/nav-v4
dayfine Nov 2, 2026
71ad2b2
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 2, 2026
e531694
Merge bdsp/maps-v4 (20b518e5a: verify mode from #122) into bdsp/nav-v4
dayfine Nov 3, 2026
8805523
Merge commit '7e1bc25ebb37c16870937026e1b099e7c189c4a5' into HEAD
dayfine Nov 5, 2026
8b1e730
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 6, 2026
990a0e0
BDSP AutoStory nav: align with PR #231 lint conventions
dayfine Nov 6, 2026
6985ef9
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 7, 2026
40cc6a7
BDSP nav: fix C4456 local declaration shadowing in static lambdas
dayfine Nov 7, 2026
513fa15
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 8, 2026
d29fcef
BDSP AutoStory nav: adopt wall recovery localization and hazard modeling
dayfine Nov 8, 2026
911c82c
Merge remote-tracking branch 'origin/bdsp/maps-v4' into bdsp/nav-v4
dayfine Nov 8, 2026
d5eaf12
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 8, 2026
3e53237
Merge remote-tracking branch 'origin/bdsp/maps-v4' into HEAD
dayfine Nov 9, 2026
d606225
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 9, 2026
c8780c4
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 9, 2026
ba18d4c
BDSP: fold #226 fixes into the story maps and route planner
dayfine Nov 9, 2026
b892158
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 9, 2026
325d5f0
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 9, 2026
bd9f31f
Merge bdsp/maps-v4 (merge of #122 b3aa69e19) into bdsp/nav-v4
dayfine Nov 9, 2026
efcf07b
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 9, 2026
cdd8896
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 9, 2026
10d4149
Merge bdsp/maps-v4 into bdsp/nav-v4 (wait for a battle's opening befo…
dayfine Nov 9, 2026
1465bba
Merge bdsp/maps-v4 into bdsp/nav-v4 (scene ends after its fade; scree…
dayfine Nov 9, 2026
2cb905b
Merge bdsp/maps-v4 into bdsp/nav-v4: a step on the Switch HOME menu f…
dayfine Nov 9, 2026
2e3265d
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 10, 2026
0a03de7
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 10, 2026
72eecf7
BDSP AutoStory: split the nav headers by concern; no char* in new code
dayfine Nov 10, 2026
6e1ff40
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 11, 2026
68059ab
Merge bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 11, 2026
a83b323
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 12, 2026
3cd34d3
Merge branch 'bdsp/maps-v4' into bdsp/nav-v4
dayfine Nov 12, 2026
35e0abe
Merge branch 'bdsp/maps-v4' into bdsp/nav-v4
dayfine Nov 12, 2026
ad8206a
Merge origin/bdsp/maps-v4 into bdsp/nav-v4
dayfine Nov 12, 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
8 changes: 8 additions & 0 deletions SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "Common/Cpp/TestRunners/UnitTestDatabase.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_Maps_Tests.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_RoutePlanner_Tests.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_Segment00_Tests.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_StoryMaps_Tests.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_StoryWorld_Tests.h"
#include "PokemonBDSP_Tests.h"

namespace PokemonAutomation{
Expand All @@ -16,6 +20,10 @@ namespace PokemonBDSP{

void add_tests(UnitTestDatabase& database){
add_tests_AutoStory_Maps(database);
add_tests_AutoStory_StoryWorld(database);
add_tests_AutoStory_RoutePlanner(database);
add_tests_AutoStory_StoryMaps(database);
add_tests_AutoStory_Segment00(database);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* BDSP AutoStory - Plan Costs
*
* From: https://github.com/PokemonAutomation/
*
*/

#include "PokemonBDSP_AutoStory_PlanCosts.h"
#include "PokemonBDSP_AutoStory_RobustRoute.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonBDSP{



RobustPlanCosts route_plan_costs(){
RobustPlanCosts costs;
costs.exact_open_tiles = costs.max_open_tiles;
costs.per_open_tile = 2;
costs.leg_not_at_wall = 6;
return costs;
}

RobustPlanCosts waypoint_plan_costs(){
RobustPlanCosts costs;
costs.exact_open_tiles = costs.max_open_tiles;
costs.per_open_tile = 0;
costs.leg_not_at_wall = 0;
return costs;
}

RobustPlanCosts town_plan_costs(){
RobustPlanCosts costs;
// A tile's hold moves exactly a tile; a longer open leg may end a tile
// either way ("south 5" went 6 in r134a), so the plan ends on a wall.
costs.exact_open_tiles = 1;
costs.open_error_per = 8;
costs.leg_not_at_wall = 6;
costs.per_open_tile = 2;
return costs;
}



} // namespace PokemonBDSP
} // namespace NintendoSwitch
} // namespace PokemonAutomation
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* BDSP AutoStory - Plan Costs
*
* From: https://github.com/PokemonAutomation/
*
* The costs the story's walks are planned with on the BDSP maps
* (plan_robust_route()), apart from the walker, so the map
* tests plan each walk the way the program does.
*
*/

#ifndef PokemonAutomation_PokemonBDSP_AutoStory_PlanCosts_H
#define PokemonAutomation_PokemonBDSP_AutoStory_PlanCosts_H

#include "PokemonBDSP_AutoStory_RobustRoute.h"
#include "PokemonBDSP_AutoStory_RoutePlanner.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonBDSP{


// The default: open legs are whole tiles on the D-pad, so they land exactly
// at any length; a wall at a leg's end is still worth a little, and each
// open tile a little more.
RobustPlanCosts route_plan_costs();

// Between two corners of a walked line: whole tiles on the D-pad land
// exactly, so an open leg costs nothing extra and the straight leg to the
// corner beats a run to a wall and a tap back (r244a: "west 10 to the
// wall, east 1" through the wandering Youngster lost the count; "west 9"
// in taps keeps it).
RobustPlanCosts waypoint_plan_costs();

// In town: a one-tile step lands exactly, a short open leg a tile either
// way, and both cost little more than a leg to a wall, so a plan steps a
// tile across and walks straight through a gap rather than going round the
// town to end every leg on a wall (Sandgem: 13 legs, r127a and r128b
// walked into the Lab and the Mart). Pair it with a check at the end (a
// sign read) for the timed legs.
RobustPlanCosts town_plan_costs();



} // namespace PokemonBDSP
} // namespace NintendoSwitch
} // namespace PokemonAutomation
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* BDSP AutoStory - Robust route planner
*
* From: https://github.com/PokemonAutomation/
*
* Plans walks whose open legs may go a tile short or long: each leg
* lists every tile the player may end on, and later walls bring them
* back together.
*
*/

#ifndef PokemonAutomation_PokemonBDSP_AutoStory_RobustRoute_H
#define PokemonAutomation_PokemonBDSP_AutoStory_RobustRoute_H

#include <cstddef>
#include <functional>
#include <optional>
#include <string>
#include <vector>
#include "Pokemon/Navigation/Pokemon_Grid.h"
#include "PokemonBDSP_AutoStory_RoutePlanner.h"
#include "PokemonBDSP_AutoStory_StoryWorld.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonBDSP{


// A leg of a plan that allows for open legs going a tile short or long. A
// leg to a wall is walked until the player stops; an open leg is walked for
// `leg.tiles` tiles' worth of time. `after` lists every tile the player may
// stand on once the leg is done.
struct PlannedLeg{
TileLeg leg;
std::vector<Pokemon::TilePos> after;
};
// Formats planned route leg with uncertainties into human-readable representation.
std::string to_string(const PlannedLeg& leg);

// Cost configuration parameters accounting for movement execution tolerances.
struct RobustPlanCosts : TilePlanCosts{
// An open leg of n tiles may end open_error + n / open_error_per tiles
// short or long: on the console 7 tiles went 9.
int open_error = 1;
int open_error_per = 5;
// Open legs this many tiles or shorter land exactly: a short hold moves
// whole tiles. 0 keeps every open leg uncertain.
int exact_open_tiles = 0;
// Extra per tile of an open leg: its timing error grows with its length,
// so a short step after a wall beats a long open leg.
int per_open_tile = 0;
int max_open_tiles = 12; // longest open leg to consider
size_t max_spread = 5; // most tiles the player may be on after a leg
// Most sets of possible tiles to search before giving up. The search is
// over sets, not tiles, so it grows far faster than the map: all of
// Jubilife City from six start tiles ran for minutes with no plan
// (r224a, 2026-10-31); 200000 sets took 31 s there, so this gives up
// after about 3. Use town costs in towns (a whole-Jubilife plan then
// takes 1 s) and crop the map to the part a leg needs rather than
// raising this.
size_t max_searched = 20000;
};

// Cheapest legs that take the player from any of the tiles in `from` to tiles
// that are all `goal`, even if every open leg ends up to `open_error` tiles
// off: the walls of later legs must bring the possible positions together.
// Legs that would leave the maps or enter a door are not used, nor legs that
// run along a zone where someone wanders: two tiles of it in a row, the
// leg's start among them. Crossing a zone (one tile of it) costs
// `per_wander_tile`. On lab-B (2026-11-08, 01.08) Route 204's youngster,
// who wanders (12, 2) to (14, 2), stopped the leg "west 2 (to wall)" from
// (13, 2) twice. Nothing if no such plan exists, or none is found within
// `costs.max_searched` sets.
std::optional<std::vector<PlannedLeg>> plan_robust_route(
const StoryWorld& world,
const std::vector<Pokemon::TilePos>& from, const std::function<bool(const Pokemon::TilePos&)>& goal,
const RobustPlanCosts& costs = RobustPlanCosts()
);
// The same, from one tile to exactly `to`.
std::optional<std::vector<PlannedLeg>> plan_robust_route(
const StoryWorld& world,
const Pokemon::TilePos& from, const Pokemon::TilePos& to,
const RobustPlanCosts& costs = RobustPlanCosts()
);

// What plan_robust_route() charges for walking `legs` from any of `from`,
// each leg from the tiles the one before may end on. A leg it would not
// plan (along a wander zone, or off the maps) costs its tiles and legs
// without grass or wander tiles.
long long robust_route_cost(
const StoryWorld& world,
const std::vector<Pokemon::TilePos>& from, const std::vector<PlannedLeg>& legs,
const RobustPlanCosts& costs
);


} // namespace PokemonBDSP
} // namespace NintendoSwitch
} // namespace PokemonAutomation
#endif
Loading
Loading