Run attributes
  • Aims for fastest completion of the game
  • Manipulates luck
  • Abuses programming errors
  • Exploits a game-breaking glitch
  • Corrupts save data
Emulator: Visual Boy Advance re-recording v22
Comments
The movie file for this run was changed shortly after the submission due to a minor improvement. It improves gia's run by 1381 frames (23.01 seconds). Now the main character doesn't need to go outside his house to complete the game.
The improvement is because of a new trick to change the destination of the warp points in the map, making it possible to go to the Hall of Fame by exiting your room, and thus trigger the end game sequence.
I discovered this trick almost accidentally while I was trying to understand how the "Doko Kashira Door" glitch worked in the japanese version Pokemon Green, trying to improve primo's run. I found out that the game runs a special check every four steps you take, and this routine is responsible for decreasing your pokemon's HP if it's poisoned and checking if all your party has fainted. While performing the glitch, this function starts to look at data far beyond the area reserved for your pokemon party, and decreases by one bytes that hold important data, like the destination where the warps will send you. Because of this, if a door that's affected by this function sends you to map #45, for example, taking four steps and entering it again will take you to map #44.
I couldn't find anything more worthy than that, but this discovery made me see that it's possible to manipulate the destination of the warps by changing a single byte. With some RAM searching, gamesharking and a table with the map ID's, I could find the memory addresses needed for this run.
The byte which controls the destination of the warp while in your room is 0xD3B2 in Red/Blue and 0xD3B1 in Yellow. gia's run warped to the hall of fame by placing the HOF's ID (which is $76, 118 in decimals) at the byte determining the area you're at. However, in order to complete the glitch, you must get into a battle so that the game loads this information. Changing the destination of a warp, however, can be done much faster.
Then, it must be clear by now that the objective of this run is to input the gameshark code 0176B1D3 without a cheating device. This is done via save corruption. By resetting the game during a save process at the earliest frame that doesn't destroy your data causes your party counter to have garbage, allowing you to have much more than six pokemon. By switching the 1st with the 10th (EDIT: Switching the 2nd with the 10th is 2 frames faster and saves a lag frame later, thanks was0x), the byte that holds the amount of items you have is changed, and your bag can access much more memory than it's supposed to access.
Below the items is important data, including, but not limited to, the X-Y coordinates, the rival's name, your trainer's ID and the byte we need to change. Bytes that are in odd addresses can be changed by switching items, while the ones in even addresses can be more easily changed by tossing items. Since we need to change an odd byte, we must switch items and the only thing that can be changed to $76 that early in the game is the low byte of your trainer's ID. This is manipulated by inserting idle frames before the first four button presses. This was done optimally by gia in his run using a bot. (I tried to do it using a Lua script, but all desync'ed) Therefore, the start of this run is the same as gia's (I actually changed some buttons pressed hoping to avoid lag, but it didn't work). With the right ID bytes, we only need to switch this item that appears on the inventory with the item corresponding to our byte, and we can happily go downstairs into the Hall of Fame. (The item we need is shown as Iron, because Iron's ID is $25, the same of the map of player's house 1F)
Regarding TAS aspects, I don't put fast text speed, because I can make it go faster holding B, there's no need to change battle style or turn off animations, since no battles occur. I name the player ASH because it's the shortest name, making text scroll faster. I also move next to the stairs before saving because I get poisoned for some reason after corrupting the save file, if I walk too many steps after the glitch, the poison animation gets me and I lose some frames. The rival's name is an interesting question, all names in the game occupy 12 bytes, even yours and the rival's, that could be stored in 8. If you name the player or the rival with a default name, there'll be garbage data after the end-of-string marker, and naming them with a custom name causes the data beyond the EOS to be blank bytes. (It means that it's different to choose the name "BLUE" and give the name "BLUE" yourself). This is important because the garbage data from a default name makes some bad items appear, causing more lag at the item scrolling. You could name your rival with bytes that correspond to actual items, like was done on gia's run, to make the scrolling faster. However, I tested these two possibilities myself and getting the default name "BLUE" finishes the game around 40 frames faster, because less scrolling needs to be done in this run.
Possible improvements
It's getting really difficult to think of improvements for this. In gia's previous submission, he stated that red and blue could be finished faster. This, however, is not true. Yellow is less laggy than R/B and loads a lot faster, making it the faster of the three games.
Doko Kashira can change the tile of the location of the warps in the map. With more research, it could be possible to set the warp's location in your room right next to you, so that you don't need to walk. It needs to be done real quick though, as walking doesn't take too much time.
Special thanks
  • was0x, he found an improvement in my original movie shortly after the submission was posted and allowed me to replace my movie with one that's 3 frames faster
  • primorial#soup, for his previous runs and for disassembling the ROM, giving TAS'ers a lot of information about the game's RNG and input oddities
  • hanzou, his discovery on ZZAZZ glitch showed it was possible to manipulate the game's RAM by exploding the inventory
  • Chamale, for his discovery of save corruption
  • gia, for his excellent run, memory map and manipulation bots
  • Glitch City Laboratories, their AreaDex project helped me with RAM searching
As a final note, I hope the viewer enjoys this short run, and apologize for the lack of writing skills in English, which makes my text unclear sometimes.

adelikat: Replacing submission file with a 3 frames faster version. See here for details.

adelikat: Accepting as an improvement to the published movie.