Repository navigation
PokemonFRLG: EXP Farmer (One Island / Seven Island VS Seeker rematches) - #1887
thewhitewolfking wants to merge 1 commit into
Conversation
|
curious about a couple things:
|
There was a problem hiding this comment.
I haven't really looked at the overworld navigation and path finding stuff in detail, but I have some feedback:
- support languages other than English, either by adding resources to Packages or avoiding the need for OCR when possible
- I think that this should probably be split into several PRs, since you're adding a lot here
- auto battler stuff
- overworld navigation stuff
- new inference stuff
- for small things that might be reusable (menu navigation, etc), it might make sense to separate them out of your ExpFarmer program and put them somewhere like PokemonFRLG_Navigation
| const MoveInfo MOVES[] = { | ||
| {"pound", "POUND", BattleType::NORMAL, 40, 100, MoveKind::NORMAL}, | ||
| {"karate-chop", "KARATE CHOP", BattleType::FIGHTING, 50, 100, MoveKind::NORMAL}, | ||
| {"doubleslap", "DOUBLESLAP", BattleType::NORMAL, 15, 85, MoveKind::MULTI_HIT}, | ||
| {"comet-punch", "COMET PUNCH", BattleType::NORMAL, 18, 85, MoveKind::MULTI_HIT}, | ||
| {"mega-punch", "MEGA PUNCH", BattleType::NORMAL, 80, 85, MoveKind::NORMAL}, |
There was a problem hiding this comment.
This kind of data usually lives in https://github.com/PokemonAutomation/Packages/ in a JSON file. The move data for the SwSh MaxLair programs and the SwSh MoveDatabase are worth looking at.
Ideally, will also support non-English versions (Spanish, French, German, Italian, and Japanese). Everything needed might already be in the move OCR data for SV, but I'm not sure if there were any translation changes between gen III and gen IX.
| enum class BattleType : uint8_t{ | ||
| NORMAL, | ||
| FIGHTING, | ||
| FLYING, | ||
| POISON, | ||
| GROUND, | ||
| ROCK, | ||
| BUG, | ||
| GHOST, | ||
| STEEL, | ||
| NONE, // "???" (Curse). Never deals typed damage. | ||
| FIRE, | ||
| WATER, | ||
| GRASS, | ||
| ELECTRIC, | ||
| PSYCHIC, | ||
| ICE, | ||
| DRAGON, | ||
| DARK, | ||
| }; |
There was a problem hiding this comment.
Because auto battler stuff will be useful for other programs (e.g. AutoStory), it might be best separated out into its own PR
| {"summary", "SUMMARY"}, | ||
| {"switch", "SWITCH"}, | ||
| {"item", "ITEM"}, | ||
| {"mail", "MAIL"}, | ||
| {"cancel", "CANCEL"}, | ||
| {"flash", "FLASH"}, | ||
| {"cut", "CUT"}, | ||
| {"fly", "FLY"}, | ||
| {"strength", "STRENGTH"}, | ||
| {"surf", "SURF"}, | ||
| {"rock-smash", "ROCK SMASH"}, | ||
| {"waterfall", "WATERFALL"}, | ||
| {"teleport", "TELEPORT"}, | ||
| {"dig", "DIG"}, | ||
| {"milk-drink", "MILK DRINK"}, | ||
| {"softboiled", "SOFTBOILED"}, | ||
| {"sweet-scent", "SWEET SCENT"}, |
There was a problem hiding this comment.
Other programs require HMs or other actions (e.g. Dig or Sweet Scent) to be in a particular position, avoiding the need for any OCR.
If you want to use OCR for this, support for other languages would be nice.
| if (text_contains_any(name, {"seven", "even isl"})){ | ||
| return true; | ||
| } |
There was a problem hiding this comment.
This only really works for English, right?
| // The Six/Seven Island page of the Fly map is a 22 x 15 grid and the cursor | ||
| // stops at its edges (region_map.c and region_map_layout_sevii_67.h in the | ||
| // decomp). Seven Island's town is at (5, 8), Six Island's at (17, 5). | ||
| // How long to hold a direction on the Fly map to move the cursor n cells. | ||
| Milliseconds cursor_hold_ms(int cells){ | ||
| return frames_to_ms(5.0 * cells - 2.5); | ||
| } | ||
|
|
||
| // Move the Fly map cursor one cell (a tap shorter than a cursor move). | ||
| void fly_cursor_tap(ProControllerContext& context, DpadPosition direction){ | ||
| pbf_press_dpad(context, direction, 50ms, 300ms); | ||
| } |
There was a problem hiding this comment.
Anything that places the cursor for flying should probably live in PokemonFRLG_Navigation.
Blindly placing the cursor has been reliable enough for programs so far, though some extra detection (of something in the text display, even if it isn't read) might be a good addition
| /* Overworld Readers | ||
| * | ||
| * From: https://github.com/PokemonAutomation/ | ||
| * | ||
| * Overworld helpers that work in GBA tiles around the player: | ||
| * - find a trainer with purple hair (Cooltrainer sprites) on given tiles, | ||
| * or a sprite's feet on tiles at the top of the screen, | ||
| * - find the VS Seeker's "!!" / "X" icon above a trainer, | ||
| * - find the Sevault Canyon house's roof (a landmark for the player's tile), | ||
| * - tell whether the screen scrolled by one tile (did a step happen?), | ||
| * - detect any region's Fly map (Kanto or the Sevii Islands). | ||
| * | ||
| * The camera keeps the player on the same tile of the screen: the 16x16 | ||
| * tile whose top-left corner is at (112, 72) of the 240x160 GBA screen. | ||
| * (dx, dy) below are tile offsets from the player (right and down positive). |
There was a problem hiding this comment.
This is another thing that might merit its own PR, since it could be useful for other programs as well
How the move choice worksEvery turn, in 1. Read the situation
2. Score each move (
Base stats stand in for the real stats. Moves are ranked by score; a move scoring 0 is never chosen to attack. 3. Situational rules
Example: Starmie (Water/Psychic) with Surf / Psychic / Thunderbolt / Ice Beam vs. Primeape: Not covered: predicting the opponent, switching, items, stat stages, weather, status, crits. It's a "strongest hit this turn" picker, not a full battle AI. Why not just use move 1? The Pokémon being leveled can battle alone, so its moveset isn't controlled. Move 1 may be a status move or hit an immunity (Normal vs. Ghost, Ground vs. Levitate/Flying), and over hundreds of battles PP, Disable and Grudge come up. If you'd prefer the simpler route (require a strong battler and use |
|
So the simpler the program, the more easily the users can use it correctly and reliably. For example, maybe it's sufficient to just do the Seven Island routes? Then there is less walk, fewer different trainers, and a shorter loop. If you limit the scope to Seven Island Cooltrainer rematches, マコト/Leroy & カズミ/Michelle each have 5 mons. So your lead needs a plan to defeat them reliably anyway (at least one of them). If not 1HKO, likely 2HKO; otherwise you have to consider the chance being fainted and need to do healing (inside the battle), right? So ideally there is a way to describe / require that in the problem, to prevent the user bring in too weak a lead. So with a "functional" lead, how that lead should battle Leroy / Michelle is a much simpler problem. You can pre-plan it at the beginning of the program. e.g. for each of the Leroy / Michelle mon, the lead should choose a specific move, and you can say that at least there is some move to hit neutral, all move should be 100% accurate, at least 60 base power etc, etc. That could simplify it a lot. |
Adds a new FRLG program, EXP Farmer, under the "Untested/Beta/WIP" section.
It farms EXP by rebattling trainers with the VS Seeker until a target level is reached.
Modes
New pieces
PokemonFRLG_ExpFarmer.cpp/.h: the programPokemonFRLG_OverworldReaders.cpp/.h: VS Seeker icon detection and screen-based position tracking for overworld navigationPokemonFRLG_DialogTextReader.cpp/.h: dialog / bag-description OCRPokemonFRLG_BattleMoveReader.cpp/.handPokemonFRLG_BattleMoveData.cpp/.h: move selection and PP/type data for battles (singles and doubles)Testing
Tested on Switch with FRLG over many full One Island cycles (fly, heal, trek, repel burn, VS Seeker, battles incl. the double battle, spa heal). Seven Island mode tested earlier. Still marked beta. Feedback welcome.