Submission #6228: TiKevin83's GBC Pokémon: Yellow Version "game end glitch" in 09:47.92

Game Boy Color
(Submitted: Pokémon: Yellow Version)
game end glitch
(Submitted: game end glitch)
(Submitted: Pokemon Yellow (UE).gbc USA/Europe)
BizHawk 2.3.1
35115
59.727515718578175
9679
Unknown
Submitted by TiKevin83 on 1/16/2019 10:43 PM
Submission Comments
This is an explanation of the strategy behind a console-verified Pokemon Yellow Any% NSC TAS in 9:47.
Credit goes to Luckytyphlosion and Gifvex for glitch routing and Stringflow and MrWint for manip bot hunting. MrWint specifically botted out a path to the new Pikachu DV manip used in this TAS.

Setup

We now use the pipeline described here to verify console accuracy of gameboy TASes. https://pastebin.com/DXiDT9ZT
This pipeline has been used to verify TASes by both me and Extrems, and it has been demonstrated publicly in the practice rooms at SGDQ 2018 and AGDQ 2019. Using GBHawk on BizHawk 2.3.1 may make it more likely for TASes of non-Pokemon games to sync on real hardware.
I used a gbc_bios.bin for the GBC firmware and set CGB in GBA to True for GBP verification purposes.

General Strategy

RAM Addresses in BizHawk are offset C000 lower than those listed in other sources; addresses are Big Endian and in WRAM.
End of Paragraph Textboxes that can be cleared with B faster than with A/without a jingle can frequently be cleared faster by adding B presses earlier in the textbox due to JoyPadLowSensitivity

Route

Intro

Manip TID 26F1 (RAM Address 1358 in BizHawk), current manip waits 4-3-12-2 frames on the first 4 inputs of the TAS to get this. This data matches the first half of the party count address.
Start a new game, and hold B while text is appearing while clearing text with A, switching which input holds and which one clears as needed to avoid consecutive input lag. This achieves the same effective text speed as Fast without setting options before New Game.
Name your character the default Yellow, which corresponds to a data value of 61 which can be swapped into the owned pokemon count.
Name your rival the default Blue, which has a side effect of improving the speed of the battle transition before Oak catches Pikachu. The transition reads from invalid memory because battle transitions are based on your first pokemon's level and the opponent's level, but you don't have any owned pokemon yet! This out of bounds read ends up pulling from rival name. By either writing 5 characters into a non default name and then deleting 4 of them (useful for glitchless) or in a shorter run like NSC using a default name, you'll guarantee the ~30 frame faster transition.
Set options using fast options: inputs Start->Up->Up->Left+A->B->Start. This is the payoff for not setting options before new game, it is faster in TAS timing to set options after the game loads as the start menu is a few frames less laggy than entering options from the main menu.
Pikachu Manipulation Strategy
Before leaving the house, set up rDIV in System Bus FF04 so that the desired Pikachu DVs are possible. A Pikachu with DVs 70C8, 70C9, 70D8, 70D9, 71D8 or 71D9 is needed for ACE and the optimal rival battle. These DVs are generated from successive calls to HRandomAdd, and HRandomAdd is calculated by addition of its current value and rDIV, so for instance to generate Pika 70C9 HRA=C9 and rDIV=A7 are needed so that HRA2 = HRA + rDIV= C9 + A7 = 70. In decimal the ACE-worthy Pikas come from rDIV values of 151,152,167,168, and 169. Within a given map, rDIV tends to be stuck cycling in increments of 18.3125 so that it repeats every 14 frames. In order to break the cycle efficiently, the amount of time spent on previous maps needs to be varied to find different LCD disable lengths between maps. The last textbox before DVs can then be delayed to get to the right part of the cycle for 151-152 or 167-169. Also, in Oak's house where Pika DVs are obtained, textbox delays (especially before the last end of paragraph text box) will shift the initial HRA value (C9 in the example) without shifting rDIV on a given frame.
Practically this means delaying the last input before Pika DVs at least 14 frames to provide buffer space for the rDIV cycle, then changing up turns while walking, delaying walking, pressing A to check for NPCs, and delaying textboxes (especially end of paragraph boxes) on a previous map such as parts of Mom's house while watching Pika's DVs until DVs that correspond to the good rDIV values are found. Then in Oak's house removing a frame before Pika DVs and adding it in different areas of Oak's house will generate several different initial HRA rolls, hopefully landing on or near C8/C9/D8/D9. If C7/CA/D7/DA are found, removing another frame from before Pika DV generation and adding it to the immediately prior textboxes is more likely to shift HRA by a single value.
For this TAS, MrWint was able to find a 5 frame delay for a 70D9 Pika, putting us at only 17 frames of intentional delay to setup both Trainer ID and Pikachu DV RNG. This TAS gets Pika DVs at frame 7789, whereas the previous TAS in 9:52 got Pika DVs 128 frames later at 7917.

Rival One and Cutscenes

Use this Strategy to manip a Pikachu with DVs 70C8, 70C9, 70D8, 70D9, 71C8, or 71C9
Win in 3 turns in red bar by critting Eevee with Thundershock, taking a 7 damage 1/39 high roll tackle, hitting Eevee with non-crit Thundershock, taking a 10 damage 1/39 high roll critical hit tackle, then critting Thundershock again. The new TAS gains another 7 frames on the 9:52 through improved rival RNG, 135 frames ahead total at 10249 vs 10384.
Avoid encounters, get the parcel, take all yolograss, deliver the parcel, avoid encounters again and buy two poke balls.
Do the old man catch tutorial. This is an improvement from a previous route which would lose about 7 seconds by catching the extra pokemon and using the Viridian Center instead of deathwarping to Pallet and catching the extra pokemon on the way back to Viridian.

ACE

Take all the yolograss and DeathFly off a Pidgeotto, it needs 8 Attack for a better range to 1 shot this Pikachu. DSUM seems to line up pretty consistently for Pidgeotto to be in a good spot after the earlier RNG manipulation. The new TAS saves 38 frames between delay to avoid route 1 encounters, forest encounters, and delay for finding Pidgeotto, blacking out to Pidgeotto 173 frames ahead of the 9:52 at frame 26454 vs 26627.
On the way back to Viridian, catch any encounter with DVs 76XX (here 76X3 with the Special value of 3 causing a Voltorb encounter in the forest). The new TAS saves 46 frames (2 steps and 12 frames of extra delay) on manipulating the DVs 76XX, entering the Viridian Center 219 frames ahead at frame 29490 vs 29709.
Deposit Pikachu, ideally moving the NPC who blocks the optimal path out of the way.
We no longer need to reset here, resetting in TAS only serves to avoid a later encounter and the reset is slower than the encounter by ~7s.
Don't flash the pokedex, this was a relic from the RTA route (saved ~5s).
Go back towards the forest and enter the 2nd house on a frame where the bird moves left and the girl moves up immediately. This starts what is referred to in RTA as "THE manip." The NPCs will have timers that are randomly set between 0 and 127 after each movement; we want to manipulate them to roll low so we can repeatedly move them.
Girl NPC Timer: BizHawk Address 0228
Bird NPC Timer: BizHawk Address 0238
Manipulate the Bird to move left 3 times and the girl to move up twice in total, including their movements as you're entering. While you're doing this flash the town map in the back of the room once. Walk to the tile 1 up and 3 right from the entrance as the NPCs finish getting into place.
Manipulate the bird to move left again just after you stop on that tile, then move right on a frame that puts FE in RAM Address 0331 and continue walking down and then left to leave the house. The new TAS saves another 37 frames manipulating NPC movement for THE manip leaving the bird house 246 frames ahead at 31589 vs 31835.
Walk back to the forest and hop the first ledge you see once on your way there.
Choose Buy in the Mart, Double input 12 down then hold Down through 4 click items which need a B press to pass, then double input 6 down, press A scroll down to 89 and press B. Then double input 5 down and buy 4F.
Press B and hold with Left to reapply B to leave the buy menu, then press B twice more to close the shop.
Don't step right (no longer needed), open the menu, open items and use 4F only once to use the manipulated TID, Pikachu's DVs, and the stat experience gained from Eevee as code to set party count to 84 causing party underflow.
Open the party, your cursor location during these swaps can be tracked at RAM Address 0C26 starting at 0:
Swap slots 0 and 13
Swap slots 12 and 23
Swap slots 23 and 15
Swap slots 17 and 83 (scroll up past 0)
Close the menu and press up to enter the Hall of Fame. These swaps use the wild encounter's DVs (76 from attack and defense) to point to the Hall of Fame and then the item count to set the Hall of Fame Script straight to the credits past the initial Oak dialogue. The Yellow character name is also swapped into owned Pokemon count to prevent an input when Oak assesses your pokedex. This saves 18 seconds over an ACE route that does not change the quantity of seen Pokemon. The TAS ACE route now used is unique from the RTA route due to the near impossibility of manipping the unbuffered trainer ID (4 consecutive 1 frame 60fps inputs) and the impracticality of manipping Pikachu DVs through several textboxes and NPC timers. We save another 47 frames through the end in part due to the Voltorb encounter from 3 special on the Pidgey instead of the old Nidoking encounter from C special on a Rattata.
In summary, we save 128 frames from MrWint's botted Pika DV manip, 7 frames finding crits in the rival battle, 38 frames to encounter manip through Pidgeotto deathfly, 46 frames manipulating a 76XX DV encounter, 37 frames executing THE manip, and 47 frames on Voltorb's cry+sprite decrompression lag vs Nidoking alongside triple-checked mart and party underflow inputs. This leaves us 293 frames ahead in total for a 5 second improvement to 9:47.

ThunderAxe31: Judging.
ThunderAxe31: File replaced for a corrected author name. All inputs and sync settings are unchanged.
Great job with the optimizations. Accepting as improvement over the current publication.
Dacicus: Processing...
Last Edited by adelikat on 10/29/2023 6:54 PM
Page History Latest diff List referrers