Introduction

Generation II of the Pokémon games seen a lot of TASes over the last few month (1, 2, 3, 4, 5), and none of them lasted very long before being beaten. The fact that only one of them made it to a publication at all is a good indicator on how fast the TAS strategies for this game evolved lately. So, here comes another attempt I guess.
This submission uses the same basic route I used in my previous run, but with several improvements, some of which FractalFusion introduced in his submission, and some of which are new. Most of the basic game and route information is explained in detail in my previous submission text and remains valid for this run, I encourage you to read it if you haven't seen a run using the Coin Case glitch before. In this submission text, I will merely point out the differences and improvements compared to FractalFusion's submission, which is the fastest submitted route at the time of writing.

Categories

  • Aims for the fastest completion time
  • Heavy luck manipulation
  • Executes arbitrary code
Used emulator: BizHawk 1.5.3

About the run

Most basic information can be found in my previous submission text.

Version choice

There is virtually no inherent time difference between the Gold and Silver version. The largest inherent time difference that I'm aware of is the title screen loading 2 frames slower in Silver compared to Gold. That means whether Gold or Silver is faster depends completely on the route.
This run uses the Silver Version for a couple of reasons:
  • Faster luck manipulation of the Trainer ID: This run depends on having a specific Trainer ID, which is faster to get in Silver by 14 frames.
  • Different sprites: Pokémon sprites are different in Gold and Silver, which has no real time implications (some load a frame faster than others, but nothing significant), but helps making the run more enjoyable to watch for everyone who saw the previous submissions and doesn't want to see the exact same images all over again.
  • "Because I can": Silver has been ignored to an extend where some people asked whether the Coin Case glitch is even possible in Silver. Here is your answer.

Coin Case Glitch improvements

While the Coin Case glitch setup is pretty much fixed up to the point where your program counter lands in the party Pokémon data, you have multiple options from there on. This run uses the same basic idea as FractalFusion's run, namely using the move Tackle, which conveniently corresponds to ld hl,d16, to load a jump to the Box names which are set up to spell out our program. It uses some improvements, though, the biggest one is skip teaching Mud-Slap, but instead exploit that an empty move slot has the value 00. That means, instead of
Move 3  Move 4  Trainer ID    Code
  21      BD      D8 E9       ld hl,D8BD; jp (hl)
we use
  21      00      D9 E9       ld hl,D900; jp (hl)
which puts us in Box 8 instead. The time saved by not learning Mud-Slap outweighs the additional time needed to scroll down when renaming the boxes.
Another improvement is the written program itself, now only requiring two box names instead of three.
Disclaimer: The explanation of the inner workings of the arbitrary code execution follows, which is lengthy, technical an maybe boring to you. So if you're not interested you can just call it magic and skip the rest of this section.
The program itself is a simple interpreter loop, it reads joypad inputs and executes them as opcodes:
Bytes Instruction Comment
Box 7
aa xor d d stores last joypad input: find out differences to current input
ea fd f8 ld (f8fd),a Write difference; will be executed as opcode later in the cycle
aa xor d Restore current joypad input value
f5 push af Copy current joypad input from a...
d1 pop de ... to d (store it as last joypad input)
f1 pop af Restore a and f from the previous cycle
50 ($f8fd) (any) Execute opcode written earlier this cycle
Box 8
f5 push af Save a and f for next cycle
a4 and h Clears carry flag, needed for the jump
fa a6 ff ld a,(ffa6) Entry point; reads current joypad inputs into a
d2 f5 f8 jp nc,f8f5 Loop back to start of Box 7; carry will never be set
Since this loop will run hundreds of times per frame, but we can only give it one input per frame, we need to prevent it from running the same opcode over and over again. This is done by not using the input directly as the opcode, but the difference of the input from the previous one. This means that for all cycles in a frame after the first one, the executed opcode is 0, which conveniently is nop.
Note that there is no way to give the opcodes additional data, so you are limited to using opcodes that don't require any (using other opcodes doesn't break the program, but messes with the stack since the push af is not executed but used as data instead). This may seem quite limiting at first, since there is no way to set a register to a value you want directly, but it's possible to circumvent this using the properties of the xor operation.
It's easiest to see in an example from the actual inputs used in this run: Our goal is to set l to 0x22 (the current value is 0x83), and the last input (stored in d) is set to 0xB3. This can be done using only 2 frame cycles:
Input    opcode                     operation    comment
0x48     (0xb3 xor 0x48 = ) 0xfb    ei           Does nothing important.
0x22     (0x48 xor 0x22 = ) 0x6a    ld l,d       loads d=0x22 into l
The trick is to set it up so that the pressed buttons are your data while the difference is your desired opcode. Because of the properties of xor, there is always such a number to achieve this and it takes only 1 frame to set it up. The opcode executed during the setup cycle is irrelevant, as long is does not crash the program or corrupt the values you currently care about.
The inputs used in this run make use this technique extensively:
Joypad     Command
e1                           // Initial value of d when entering the loop
e8         09 (add hl,bc)    // d900 + 00a4 = d9a4
cd         25 (dec h)
e0         2d (dec l)
97         77 (ld (hl),a)    // d8a3 <- 0; Enable Red in Mt. Silver
b3         24 (inc h)
48         fb (ei)           // setup cycle
22         6a (ld l,d)
06         24 (inc h)
71         77 (ld (hl),a)    // da22 <- 0; Having no Pokémon in your party wins all battles instantly
b0         c1 (pop bc)       // setup cycle
d2         62 (ld h,d)
61         b3 (or e)         // setup cycle
0b         6a (ld l,d)
04         0f (rrca)         // setup cycle
76         72 (ld (hl),d)    // d20b <- 76; Change tile the character stands on, needed for warping
63         15 (dec d)        // setup cycle; This temporarily corrupts d, but it is fixed in the next cycle
19         7a (ld a,d)
bb         a2 (and d)        // setup cycle; 0xbb and 0x19 = 0x19
d9         62 (ld h,d)
fb         22 (ld (hl+),a)   // d90b <- 19; Y coordinate of the character position
79         82 (add d)        // setup cycle
03         7a (ld a,d)
21         22 (ld (hl+),a)   // d90c <- 03; X coordinate of the character position
65         44 (ld b,h)       // setup cycle
17         72 (ld (hl),d)    // d90d <- 17; (Glitch) map entrance 0x17, directly in front of Red
34         23 (inc hl)
16         22 (ld (hl+),a)   // d90e <- 03; Map group
0c         1a (ld a,(de) )   // setup cycle
46         4a (ld c,d)
36         70 (ld (hl),b)    // setup cycle
44         72 (ld (hl),d)    // d90f <- 44; Map index: In Mt. Silver
2d         69 (ld l,c)
71         5c (ld e,h)       // setup cycle
0b         7a (ld a,d)
29         22 (ld (hl+),a)   // d946 <- 0b; Set warp pointer to our fake warp data
5d         74 (ld (hl),h)    // d947 <- d9
79         24 (inc h)        // setup cycle
81         f8 (ld hl, sp+f5)
eb         6a (ld l,d)
12         f9 (ld sp,hl)     // Fix the stack pointer; leave directly to the overworld
db         c9 (ret)          // Return to normal game code

Route details and improvements

Intro

  • I set the text speed to fast, turn off battle animations and set the battle style to "SET" to make the overall game play faster.
  • The Trainer ID is manipulated to be 0xD9E9, which is important for the Coin Case glitch setup.
  • Date and time are irrelevant to the route, using the defaults is the fastest.
  • I name the player "A". Like in Gen I, each character printed on the screen cost one frame, making shorter names faster. Also, "A" and all characters which are only one button press away (namely "B", "I", "J" and "a") cost no extra frames to input.

New Bark Town

  • Totodile's DVs don't need to be very specific for this run, 14 Attack, 6 Defense, 8 Speed and 15 Special suffice to kill everything as fast as possible. I got 10 Defense and 15 Speed instead, oh well.

Cherrygrove City

  • Rival's Chikorita has 21 HP, Scratch does 5 HP and a critical hit 8 HP of damage. That means it can be killed with two crits and a non-crit (doing non-crits is faster since the "Critcal Hit!" message costs time). Like in Gen I, however, getting max damage out of a move has a significantly lower chance (1/39) than any other value, due to the way integer rounding is done. That means that max crits have a 1/624 (= 1/16 * 1/39) chance of happening. Being able to perform these max damage attacks will save time in multiple fights throughout the run.
  • Poison warping is not used, since is costs more time than it gains. It saves 00:03.72s to do, but you miss out on getting Pokéballs, which are important and take longer to pick up (00:05.76s) later or buy in a mart (00:13.56s).

Violet City

  • The AI of Bird Keepers forces them to use a damaging move whenever possible, so taking damage from Spearow's Peck and Pidgeotto's Gust is unavoidable.
  • Falkner's Pidgey could be killed using only two Rage crits, but using three noncrits allows a OHKO on Pidgeotto and is therefore faster.
  • After beating Falkner, the Boxes are renamed to spell out the program for the Coin Case glitch.
  • Togepi's DVs are manipulated to be 0x18A9, which sets up a relative jump (jr a9) needed in the Coin Case glitch. There are plenty of other values that would work as well, since it's not important where we land exactly.
  • I skip visiting the mart; again, it costs more time than using X-Attack in battles save. I also don't need to buy a Pokéball since I skipped poison warping.

Route 32

  • After beating Albert, a wild Bellsprout is encoutered to create its PokéDex entry. It is later needed to trigger the Coin Case glitch.

Union Cave

  • Using Rage is the fastest way to beat Russell's Geodudes without X-Attacks.

Slowpoke Well

  • I catch a Slowpoke in Slowpoke Well, since it (along with Rattata) knows exactly 3 moves including Tackle, which is needed for the Coin Case glitch setup. Because of very technical details (a carry flag being set or not at the right time), Rattata does not work with the setup I'm using.
  • The final Rocket's Koffing is another example of saving a crit and therefore time by hitting max crits.

Azalea City

  • Without X-Attacks, beating the arena before the rival is way faster (it may even be faster when using X-Attacks as well).

Ilex Forest

  • When hunting Farfetch'd, the route used here is not the shortest route in terms of steps, but it is faster by around 1.5 seconds (assuming you get no encounters of course).
  • Cut is taught to Croconaw. Ideally, you would want to teach it to your caught Pokémon which hasn't got four moves already, but there is no convenient Pokémon that can learn both Tackle and Cut (Sentret is the closest to it, but it has only one move when caught and teaching it 2 moves takes longer than teaching Cut to Croconaw).
  • Slowpoke's moves are swapped and it is switched with Togepi while we are in the menu for using Cut anyway, which saves time.

Goldenrod City

  • Super Nerd Eric is the last trainer before finally getting the Coin Case and performing the glitch. Cut is used to OHKO the Grimers, its shorter name makes it faster than the other moves.
  • The text box for picking up the Coin Case resets the BG map window, so taking 3 steps to the left puts us in the right position to enable the needed jump when activating the Coin Case.
  • Bellsprout's cry is played by checking the PokéDex and the Coin Case glitch is triggered.
  • Due to the executed code, there now is a warp to Mt. Silver directly to our left, so by walking to the left we end up in Mt. Silver right in front of Red. Also, because we returned directly to the overworld without leaving the item menu first, the screen is not redrawn and we see the item menu instead of the overworld until the map transition is done.
  • When talking to Red, the fight is skipped since the game thinks we have no Pokémon in our party, and the credits roll.

Route frame differences

Here is an exact section-by-section breakdown of the amount of frames gained or lost, compared to FractalFusion's run.
Section Time difference Comment
Title screen -00:00.75s Faster luck manipulation of the Trainer ID
Oak's introduction -00:02.38s Leaving the default time of day and using a faster name
Get starter -00:01.12s Faster DV manipulation
Cherrygrove Rival -00:00.52s Using 2 max crits + max noncrit instead of three crits
Finish Mystery Egg errant +00:03.72s Not using the poison warp
Youngster Mikey -00:00.37s
Violet City Gym -00:00.37s
Leave Violet City -00:16.02s Not visiting the mart
Enter Union Cave -00:00.50s
Hiker Russell +00:01.66s No X-Items results in a slower fight
Slowpoke Well +00:29.35s Catching a Slowpoke
Slowpoke Well cleared -00:00.52s Max crit + max noncrit against Koffing
Azalea Gym and Rival +00:00.40s No X-Items results in a slower fight
Enter Goldenrod City -00:23.44s Skip catching Rattata; doing Coin Case glitch setup
Coin Case used -00:14.67s All Coin Case glitch setup already done
Sum -00:25.53s

Noxxa: Judging.
Noxxa: It's time to see if we finally can get a really good glitched Gold/Silver run published. Accepting as an improvement to the published movie.
Guga: Processing...


TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15569
Location: 127.0.0.1
Spikestuff
They/Them
Editor, Publisher, Expert player (2638)
Joined: 10/12/2011
Posts: 6437
Location: The land down under.
OMG POKEMON~! CALLING IT FOR FINAL~! stares at Ilari Temp. Encode: Link to video
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
ALAKTORN
He/Him
Former player
Joined: 10/19/2009
Posts: 2527
Location: Italy
fantastic job! sounds like a great run from the description :)
Experienced player (691)
Joined: 11/23/2013
Posts: 2232
Location: Guatemala
I always loved Silver more so... Voting yes. EDIT Holy crap thats an INSANE amount of rerecords...
Here, my YouTube channel: http://www.youtube.com/user/dekutony
ALAKTORN
He/Him
Former player
Joined: 10/19/2009
Posts: 2527
Location: Italy
question: that fat guy before the Union Cave, is it slower if you talk directly to him from the left instead of making him talk to you?
Editor
Joined: 11/3/2013
Posts: 506
I'm struggling to think of any game that has seen such an explosion of TAS activity after such a long time in the doldrums. Will watch later, but it looks like the routing has been really deeply analysed.
Experienced player (689)
Joined: 2/5/2012
Posts: 1794
Location: Brasil
love you
I want all good TAS inside TASvideos, it's my motto. TAS i'm interested: Megaman series, specially the RPGs! Where is the mmbn1 all chips TAS we deserve? Where is the Command Mission TAS? i'm slowly moving away from TASing fighting games for speed, maybe it's time to start finding some entertainment value in TASing.
Skilled player (1039)
Joined: 7/24/2013
Posts: 175
ALAKTORN wrote:
question: that fat guy before the Union Cave, is it slower if you talk directly to him from the left instead of making him talk to you?
Unlike trainers, this guy does not show the (!), which costs around a second and makes it faster to talk to trainers directly instead of letting them spot you. I ran a quick test, talking directly seems to be slower by 9 frames, not sure where the difference comes from.
Editor, Experienced player (570)
Joined: 11/8/2010
Posts: 4036
Very nice run, seems optimized. Some smart improvements over FractalFusion's run too. Way to go!
Experienced player (584)
Joined: 2/23/2008
Posts: 266
Location: CA, USA
Looks great! Amazing how far gen II has come in such a short time. Big yes vote.
Sanqui
Any
Player (26)
Joined: 4/25/2011
Posts: 33
Awesome work. I especially appreciate your ingenious bootstrapping code. Kudos to FractalFusion, too.
ovo
Joined: 12/29/2007
Posts: 489
About poison deathwarping being slower due to lack of Poke Balls, would it be possible to set it up so that you receive the 5 Poke Balls from the Aide and then immediately warp back to Cherrygrove? Would it be slower?
Skilled player (1039)
Joined: 7/24/2013
Posts: 175
It would. Poison warping gains less than 4 seconds, and talking to the aide would cost more than that. As soon as you get the balls from the Aide, walking is faster than poison warping in any case.
Joined: 6/6/2004
Posts: 223
Does it gain more than 4 seconds if you get into the poison fight before going to Rival 1, instead of backtracking afterward like the Pi run does? The 2 poison damage you'll incur during the Rival fight this way should be easy to work around with potion timing, and while the messages may take a couple seconds, this is surely less time than retracing those 60 steps.
Skilled player (1039)
Joined: 7/24/2013
Posts: 175
Mr. Pwnage wrote:
Does it gain more than 4 seconds if you get into the poison fight before going to Rival 1, instead of backtracking afterward like the Pi run does? The 2 poison damage you'll incur during the Rival fight this way should be easy to work around with potion timing, and while the messages may take a couple seconds, this is surely less time than retracing those 60 steps.
You can't. The game automatically heals you after the rival fight, so you need to backtrack in order to poison warp (Route 29 has no wild Pokémon that can poison you). For the same reason, poison warping back from Oak to Cherrygrove doesn't work, you'll be healed by Oak's assistant.
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15569
Location: 127.0.0.1
This movie has been published. The posts before this message apply to the submission, and posts after this message apply to the published movie. ---- [2565] GBC Pokémon: Silver Version "game end glitch" by MrWint in 30:39.49
Editor
Joined: 11/3/2013
Posts: 506
Just saying I boldly changed the submission text, because it didn't actually mention anything about the TAS itself (just described the game). If the technical details are wrong, please correct them.
Guga
He/Him
Joined: 1/17/2012
Posts: 838
Location: Chile
Plain and simple, I suck at (and hate) writing descriptions and I entrust that work to our (vested) editors. :]
Joined: 12/29/2007
Posts: 489
As I mentioned earlier for the Cooltrainer glitch Pokemon Blue run, the movie screenshot should probably be changed to something more descriptive of the run; the current screenshot would appear in literally any playthrough that beats the game. For the previous submission, I would have recommended the screen immediately before the warp to Mt. Silver, as several glitch characters are written to the screen as the arbitrary code is carried out. In this submission, it's barely noticeable unfortunately (look at the letter i in Coins). Anyone have any ideas?
Skilled player (1738)
Joined: 9/17/2009
Posts: 4980
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Zowayix wrote:
Anyone have any ideas?
I think a pic of the player grabbing the coin case might work, since I think that item would never be used in a glitchless run. (unless I remember wrong)
Joined: 12/29/2007
Posts: 489
Since the submission text already mentions the Coin Case glitch, that might be redundant. EDIT: Here's an idea that sounds pretty good: How about a screenshot of the player renaming the boxes? A lot of people aren't even aware that the boxes can be renamed (I certainly wasn't, at least in Gen II), and no one would ever consider such a feature useful in any way, giving it the perfect "WTF is this doing in a speedrun?" feeling while not giving away the final outcome (especially as it happens early in the run and doesn't come into play until a while later).
Editor, Experienced player (570)
Joined: 11/8/2010
Posts: 4036
Zowayix wrote:
Since the submission text already mentions the Coin Case glitch, that might be redundant.
The publication text can always be changed. If you think noting what glitch was used to break the game spoils the run, someone can just remove that little detail. I agree that naming the box should be the new screenshot. Here are a few good ones (frame 46841, 46945, and 47160):
ALAKTORN
He/Him
Former player
Joined: 10/19/2009
Posts: 2527
Location: Italy
^I like the 2nd one
Editor, Expert player (2073)
Joined: 6/15/2005
Posts: 3282
Well done, MrWint. I'm glad you found some use for some of my strategies. Though I kind of wish the poisonwarping route was faster. The program which you coded in the box names is pretty neat as well.
MrWint wrote:
ALAKTORN wrote:
question: that fat guy before the Union Cave, is it slower if you talk directly to him from the left instead of making him talk to you?
Unlike trainers, this guy does not show the (!), which costs around a second and makes it faster to talk to trainers directly instead of letting them spot you. I ran a quick test, talking directly seems to be slower by 9 frames, not sure where the difference comes from.
For some reason, talking to that guy from the left requires your player to do a turn afterward (~8 frames) but when walking under him to make him talk, there is no turn delay afterward. There seems to be no other difference in time (even though it looks like you have to turn to talk in the latter case.)
Skilled player (1039)
Joined: 7/24/2013
Posts: 175
FractalFusion wrote:
Though I kind of wish the poisonwarping route was faster.
I did, too, it was such a nice addition to the route. Apparently many others felt like that too, considering all the suggestions to make it faster somehow. Sadly, it seems it just isn't, as long as you can't skip catching a wild mon with Tackle. if you only needed *a* third Pokémon, getting Randy's Spearow ("Kenya") in Goldenrod City might be faster than catching a wild one, plus you don't need a Pokéball, so you can use poison warp.