Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ add_library(SerialProgramsLib STATIC ${CORE_LIBRARY_SOURCES} ${LIBRARY_SOURCES})
include(cmake/EmbedTextFiles.cmake)
pa_embed_text_files(SerialProgramsLib Source/Pokemon/Navigation/TestMaps
Pokemon/Navigation/Pokemon_Navigation_Tests.h PokemonAutomation::Pokemon navigation_test_map_json)
pa_embed_text_files(SerialProgramsLib Source/PokemonBDSP/Programs/AutoStory/Maps
PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h PokemonAutomation::NintendoSwitch::PokemonBDSP bdsp_map_json)


# Create binary target
Expand Down
2 changes: 2 additions & 0 deletions SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Programs/AutoStory/PokemonBDSP_AutoStoryTools.h"
#include "PokemonBDSP_Tests.h"
#include "Inference/PokemonBDSP_MenuDetector.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_Tests.h"

namespace PokemonAutomation{
Expand Down Expand Up @@ -289,6 +290,7 @@ bool run_bag_screenshot_tests(Logger& logger, const std::string& folder){
void add_tests(UnitTestDatabase& database){
database.add<Test_BagScreenshots>();
add_tests_MenuDetector(database);
add_tests_AutoStory_MapGrids(database);
add_tests_AutoStory(database);
}

Expand Down
26 changes: 14 additions & 12 deletions SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/MAPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Each map file's header starts with the same three lines, kept current with the code:

- **Map source**: where the tiles come from. "Decomp" means the Pokemon Platinum
decompilation's collision table (pret/pokeplatinum `map_data_NNN.bin`) with the
objects from its events file; BDSP keeps Diamond/Pearl's layout, and Platinum's
few changes show up on the console. "DP image" means a Bulbapedia map image
- **Map source**: where the tiles come from. "Decomp" means a decompilation's
collision table (pret/pokediamond `land_data` narc, or pret/pokeplatinum
`map_data_NNN.bin`) with the objects from its events file; BDSP keeps
Diamond/Pearl's layout, and Platinum's few changes show up on the console. "DP image" means a Bulbapedia map image
traced by hand or by colour; those images have 12 px rows for 16 px columns, so
a traced grid has 3/4 of a tile per row and drifts by the map's height
differences (cliffs are painted taller than their tiles).
Expand All @@ -15,12 +15,12 @@ Each map file's header starts with the same three lines, kept current with the c

| map | source | checkpoints passing | next |
|---|---|---|---|
| Route 201 | DP image (3/4 rows) | 00.02-00.04 | re-derive from the decomp |
| Route 202 | DP image (3/4 rows) | 00.04 | re-derive from the decomp |
| Sandgem Town | DP image rows 0-6, decomp rows 7+ | 00.04, 00.05 | two tiles on row 6; row-2 narrowing |
| Jubilife City | DP image (3/4 rows), console NPCs | 00.05, 01.01, 01.06, 01.07 | re-derive from the decomp |
| Oreburgh Mine B2F | DP image (stretched), console | 01.02, 01.03 (3x) | row 18 open, west ledge, top corridor row |
| Route 203 | DP image, east stretch from the console | 01.06 | re-derive the west and middle stretches |
| Route 201 | decomp (Diamond) | none yet (00.02-00.04 and mart_lady passed on the image grid) | re-run them |
| Route 202 | decomp (Diamond) | none yet (00.04 passed on the image grid) | re-run 00.04; the save-spot legs grew three rows |
| Sandgem Town | decomp (Diamond) | none yet (00.04, 00.05 passed with image rows 0-6) | re-run; the Route 202 entry stop is (29,1) |
| Jubilife City | decomp (Diamond), console NPCs | none yet (00.05, 01.01, 01.06, 01.07 passed on the image grid) | re-run; re-anchor the Mart clown and the steps walk |
| Oreburgh Mine B2F | decomp (Diamond) | none yet (01.02, 01.03 passed 3x on the stretched image grid) | re-run both |
| Route 203 | decomp (Diamond) | none yet (01.06 passed on the image grid) | re-run; the row to Jubilife is 18, four sand rows |
| Route 204 South | decomp | 01.08 (1x) | more passes |
| Ravaged Path | decomp rows 30-53 | 01.09 by hand | program pass |
| Route 204 North | decomp | 01.10 (1x) | probe column 23; (12,6) marked from the console |
Expand All @@ -33,5 +33,7 @@ Each map file's header starts with the same three lines, kept current with the c
Rules: terrain from the decomp, people and Platinum-only edits from the console;
a route is coded only over tiles a human or a probe has walked; a map change
re-runs every checkpoint listed on it. The decomp comparison that found the 3/4
rows is the 2026-10-31 report (`compare.md`, with the decoded grids), to be
checked in with the re-derivation.
rows is the 2026-10-31 report (`compare.md`, with the decoded grids); the
re-derivation of 2026-10-31 took every grid above from `devtools/maps decomp
--repo pret/pokediamond` and translated each file's named tiles with its
console anchors.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
*/

#include "PokemonBDSP_AutoStory_MapGrids.h"
#include "PokemonBDSP_AutoStory_FloaromaTown.h"

namespace PokemonAutomation{
Expand Down Expand Up @@ -66,42 +67,7 @@ using namespace Pokemon;
// has), and it has a Beauty at (10, 19) looking south instead of the man at
// (11, 26).
const TileGrid& grid(){
static const TileGrid grid({
// 0 1 2 3
R"(######........................##)", // 0
R"(##NN##........................##)", // 1
R"(..............................##)", // 2
R"(..............................##)", // 3
R"(..............................##)", // 4
R"(..............................##)", // 5
R"(..............................##)", // 6
R"(..................#####.......##)", // 7
R"(..................#####.......##)", // 8
R"(..................#####.......##)", // 9
R"(......N...........#####.......##)", // 10
R"(..........####...S##.##N......##)", // 11
R"(..........####................##)", // 12
R"(..........####................##)", // 13
R"(..........#D##................##)", // 14
R"(.......................####..S##)", // 15
R"(.......................####...##)", // 16
R"(.......................#D##...##)", // 17
R"(..............................##)", // 18
R"(.............S..................)", // 19
R"(................................)", // 20
R"(...................N............)", // 21
R"(................................)", // 22
R"(..NN..........#####....####...##)", // 23
R"(..............#####....####...##)", // 24
R"(..............#####....####...##)", // 25
R"(...........N..##D##....#D##...##)", // 26
R"(..............................##)", // 27
R"(..............................##)", // 28
R"(..............................##)", // 29
R"(########.#...###################)", // 30
R"(########.#...###################)", // 31
});
return grid;
return story_grid("FloaromaTown");
}

const TilePos ROUTE_204_ARRIVAL{11, 29};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*
*/

#include <string>
#include <vector>
#include "PokemonBDSP_AutoStory_MapGrids.h"
#include "PokemonBDSP_AutoStory_JubilifeCity.h"

namespace PokemonAutomation{
Expand All @@ -14,116 +17,93 @@ namespace JubilifeCity{
using namespace Pokemon;


// Map source: Bulbapedia DP map image, classified by colour (2026-10-28);
// rows are 3/4 of a tile (64 real rows in 48). The story NPCs are placed
// from the console.
// Console checks: lamps' row and the Center door (00.05), east stairs to
// Route 203 (01.06, r230a), the north street (01.07). The decomp puts
// the traced door columns one column east of the console's.
// Status: 00.05, 01.01, 01.06 and 01.07 pass on it. Next: re-derive from the
// decomp (cells (23..24, 4..5)); re-check door spacing.
// Map source: the decomp (pret/pokediamond land_data narc_0018, 0016, 0017
// and 0015, 2026-10-31) with the objects from its events file. Platinum
// differs only around the Global Terminal (columns 14..26, rows 30..45).
// Console checks (2026-10-30/31): the lamps (43,53) and (49,53), north from
// (52,53) to the Pokemon Center's door, the School's door from the
// Center's doorstep, the east street to Route 203 (01.06, r230a), the
// north street (01.07), and the four 00.05 people, placed from the
// console on the tiles the events file gives them.
// Status: no checkpoint has run on this grid yet. 00.05, 01.01, 01.06 and
// 01.07 passed on the colour-classified image grid it replaces (48 rows
// for 64) and must be re-run; re-check the Mart clown's tile (he wanders
// 182..184 on row 33 in Diamond) and the hand walk from the steps' top
// east to the house and north to the Center (the decomp has the plaza
// only 171..177 wide on rows 58..59).
//
// Read from Bulbapedia's DP map of Jubilife City (1024 x 772 px): 16 px tiles
// from the top-left corner; the last 4 px rows are left out. Road and paved
// plaza are walkable; buildings, roofs, trees, planters, lamps, signs, fences
// and fountains are blocked. Tiles were classified by colour and only the
// ones on the 00.05 route checked by eye, so some open plaza next to a lamp
// or a pattern line may read as blocked; the planner goes around those, and
// anything the map lacks is found by the route walker.
// The DP layout matches BDSP (console B, 2026-10-28): the Trainers' School
// and the Pokemon Center either side of the main road, the Poke Mart and the
// fountain park north of them, the TV station at the top of the main road
// and the Poketch Company in the north-west.
// NPCs are the 00.05 story people, placed from the console: they stand still.
// Columns 59..63 of rows 16..17 are the stairs east to Route 203 (from the
// image, 2026-10-31; not walked on the console yet).
// Decoded from Pokemon Diamond's collision table: cells (23..24, 4..5) of
// the Sinnoh matrix, with the objects from its events file. Local (x, y) =
// world (x - 128, z - 736); 64 x 64 tiles. The console's measurements on
// the image grid were a column east of its doors; on this grid the lamps,
// the doors and the four people all land where the console put them.
//
// Exits: south, the 3-wide neck (45..47, 61) down to Route 202; east, the
// street (rows 21..24) to Route 203; north, (42..55, 0..1) to Route 204;
// west, the Route 218 gate on rows 22..23 (its warp tiles are 'D'). Doors
// are 'D' tiles walked into from below; the Trainers' School's doorway
// (40,40) and the Global Terminal's (21,42) are warp tiles stepped onto and
// marked 'D' as well, so a plan never steps on them. The main road runs
// from the steps (46..47, 60..62) north between the lamps (43,53), (49,53)
// and on up to the north exit; the doors' row 40 is open between the School
// and the Center (43..49), and the plaza below it is rows 41..52.
// People who stand still, from the events file: the Poketch president
// (46,35) and the clown west of the TV station (36,16), the 00.05 story
// people (hidden by flags before and after); an Ace Trainer (36,25) on the
// north road's west side, a Cashier (26,42), an Expert (44,44), two kids
// (52,46), (54,46) on the plaza and a School Kid (17,55): none of these
// five has been seen on the console yet. The clown by the Mart (55,33) and
// the one by the Poketch Company (15,18) wander three tiles in Diamond but
// stood still on the console (00.05, three runs): on the grid at their
// spawn tiles. Wanderers left off: an Ace Trainer along row 20 (21..23),
// one along row 21 (45..47), a Twin around (33,18), a School Kid on column
// 51 (rows 33..35), a Pokefan around (41,30). Rowan and the grunts at the
// north exit, the Collectors and Dawn are hidden by story flags.
const TileGrid& grid(){
// 0 1 2 3 4 5 6
// 0123456789012345678901234567890123456789012345678901234567890123
static const TileGrid grid({
R"(################################################################)", // 0
R"(################################################################)", // 1
R"(##########################################......################)", // 2
R"(##########################################......################)", // 3
R"(##########################################......################)", // 4
R"(###########################...##########.......#################)", // 5
R"(###########################...##########........################)", // 6
R"(########.##########.#######...##########..#.....################)", // 7
R"(########.##########.#######...##########.......#################)", // 8
R"(########.##########.#######....#########..#....#################)", // 9
R"(########.##########.#######...#####D####..#....#################)", // 10
R"(########..#########.#######.......N.......#....#################)", // 11
R"(########............#######...............#....########....#####)", // 12
R"(########...##N......#######..........##...#....########....#####)", // 13
R"(######.#####.......#######.....................#######...#######)", // 14
R"(##........................................#....#...........#####)", // 15
R"(##...#..................................................#.......)", // 16
R"(##...#...###..............###...........................#.......)", // 17
R"(##...#..#####.################............#............#########)", // 18
R"(##############################..###########....#.###...#########)", // 19
R"(##############################..###########....######..#########)", // 20
R"(##############################..###########....#######..####.###)", // 21
R"(##############################..##########.....#################)", // 22
R"(##############################..###########....#......N#########)", // 23
R"(########.#####################..#.....##.......#........########)", // 24
R"(########.#####################.......####............#..####.###)", // 25
R"(########.#####.#########.######.##########..N.....###..#########)", // 26
R"(##############..########.######.###########....#######.#########)", // 27
R"(########.#####.############################....#################)", // 28
R"(########.#####.############################....#################)", // 29
R"(#################################.##.##D###....####D############)", // 30
R"(########.#####..#########.#####........................#########)", // 31
R"(#############....#######..####.####....................#####.###)", // 32
R"(#############....##.......########.....................#####.###)", // 33
R"(##############............##############...........N.N.#########)", // 34
R"(##############............##############...............#########)", // 35
R"(#############.............##############...........#############)", // 36
R"(########.#####.###...###.###############...........#############)", // 37
R"(########.#####.###...###.###############...........#############)", // 38
R"(########.#####.###...###.###############.#.....#...#############)", // 39
R"(########.#.#.#...........##########.....S..........#########.###)", // 40
R"(#########................##########................#########.###)", // 41
R"(########.........#.......##########................#########.###)", // 42
R"(########.#.#.#.#..........###############.......############.###)", // 43
R"(#########################################.........##############)", // 44
R"(###########################################....#################)", // 45
R"(###########################################DDDD#################)", // 46
R"(################################################################)", // 47
});
return grid;
return story_grid("JubilifeCity");
}

// Checked on the console (2026-10-30, CFR "walk"): 00.05's save stands
// below the steps, against the wall just east of them (the banner reads
// Jubilife City). West along that wall does not stop at the steps (it runs
// to the trees); a tile west, then north, climbs them. North up the main
// road from the steps passes the lamps (41,39), (47,39) and does not stop
// road from the steps passes the lamps (43,53), (49,53) and does not stop
// before the north exit. From the lamps' row, west stops at the house at
// (35..39, 34..39) and east at the house at (51..55, 36..42); north from
// (50,39) stops in front of the Pokemon Center. The road's white curbs
// (columns 42 and 47) are not walls, as the colour reading had them.
// (37..42, 47..52) and east at the house at (53..57, 49..56); north from
// (52,53) stops in front of the Pokemon Center. The steps are columns
// 45..47 of row 61; the save stands at (48,62) against (48,61), and the
// tile west then north puts us on column 47, a few rows up. On this grid
// east from rows 58..60 stops at column 49 and north from there at the lamp
// (49,53), not the Center: the climb must end on row 57 or above, or BDSP's
// plaza is wider than Diamond's there (re-check on the console).
const std::vector<TilePos>& up_the_steps(){
static const std::vector<TilePos> tiles{{45, 43}, {46, 43}, {45, 44}, {46, 44}, {45, 45}, {46, 45}};
static const std::vector<TilePos> tiles{{46, 58}, {47, 58}, {46, 59}, {47, 59}, {46, 60}, {47, 60}};
return tiles;
}

// Checked on the console (2026-10-30): from the Pokemon Center's doorstep,
// eleven one-tile holds west put us under this door, not the twelve these
// columns give; one of the two doors is a column off here.
const TilePos TRAINERS_SCHOOL_DOOR{39, 30};
const TilePos POKEMON_CENTER_DOOR{51, 30};
const TilePos TV_STATION_DOOR{35, 10};
// The School's doorway is a warp tile stepped onto from (40,41); the
// Center's door is walked into from (52,41). On the console (2026-10-30)
// eleven one-tile holds west from the Center's doorstep put us under the
// School's door: the doorstep was the tile east of the door's column, as
// story_door_front() allows.
const TilePos TRAINERS_SCHOOL_DOOR{40, 40};
const TilePos POKEMON_CENTER_DOOR{52, 40};
const TilePos TV_STATION_DOOR{36, 15};

// On the main road just north of the school and the Center. Talked to from
// the east, facing west (also works from the south).
const TilePos POKETCH_PRESIDENT{44, 26};
// Below the Poke Mart's planters, where the road meets the plaza.
const TilePos CLOWN_MART{54, 23};
// West of the TV station door.
const TilePos CLOWN_TV_STATION{34, 11};
// East of the Poketch Company's sign. Talked to from the south on the
// console; from the east a walk west along row 13 stops right beside him.
const TilePos CLOWN_POKETCH_COMPANY{13, 13};
// On the main road, five rows north of the School's and the Center's
// doors' row and six columns west of the Center's door. Talked to from the
// east, facing west (also works from the south).
const TilePos POKETCH_PRESIDENT{46, 35};
// Below the Poke Mart's planters, where the road meets the plaza: his spawn
// tile; he wanders a tile either side in Diamond, and the console had him
// a tile east of it.
const TilePos CLOWN_MART{55, 33};
// West of the TV station door, right below it.
const TilePos CLOWN_TV_STATION{36, 16};
// East of the Poketch Company's sign, a row below it. Talked to from the
// south on the console; from the east a walk west along row 18 stops right
// beside him.
const TilePos CLOWN_POKETCH_COMPANY{15, 18};



Expand Down
Loading
Loading