#6622: CasualPokePlayer's GBC Pokémon Card GB2: GR-dan Sanjou! "game end glitch" in 01:53.41

Submission Text Full Submission Page
Isn't the tutorial optional?

Game objectives

  • Emulator used: BizHawk 2.4
  • Major skip glitch
  • Executes arbitrary code
  • Heavy glitch abuse
  • I copied this from gifvex's TCG1 comments

Attempt at not having a TODO: describe this movie here

Pokémon Card GB2: GR-dan Sanjou! is the Japan-only sequel to Pokémon Trading Card Game. Team Great Rocket has stolen TCG Island's Pokémon cards and kidnapped the Club Masters, and you must travel to GR Island to put an end to their evil plans, by defeating them in Pokémon card duels.
Blazephlozard needs a refresher on the rules, but his oddly-named deck ends the tutorial (and the game) a bit early.
(Is that too stupid of a movie description?)

Comments

I suggest checking out the TCG1 submission text, it probably explains some similar things better than I can. Simply put, a simultaneous Down+A input while viewing the board state (with the cursor as low as it legally should be) messes up the cursor's position, and can lead to jumping into unintended code. In the first game, most versions crash from these jumps; the US version usually ends up finishing the duel, or rarely, starts executing the duel status variables. (I should mention Up+A when the cursor is as high as it can be also causes bad jumps, but nothing useful has been found)
This game handles it better at first, as it takes two executions of Down+A to reach bad things. The first execution just brings up a description of Grass Energy, aka card ID #1, a failsafe of sorts. But then it jumps to the deck edit information storage. Oopsies.
gifvex discovered that the glitch can run your duel name in TCG2, and CasualPokePlayer on the Pokemon Speedruns Discord helped immensely with taking initiative, finding the credits function, and theorizing a plan to run the credits.
Unlike TCG1, using our deck is not as good of an ACE option in this game. This is because all card IDs are now 2 bytes, one of which being a 00 or 01. So, it is impossible to write any good loads or jumps. Also, this game gives you NO spare cards at the start of the game, so, we would need to obtain more cards to be able to write anything meaningful. Luckily, this game's handling of the Down+A Glitch can send it into an area where many deck-edit-related values are temporarily stored and left behind. This can include your edited deck, but it also includes your deck's name. And that's 10 characters of relative freedom, enough to make a credits warp possible.
Characters are 2 bytes long, with the first byte only having four possible options: 04 (increment B), 05 (decrement B), 0E (load the next byte into C), and 0F (rotate A rightward). For the second byte, we have access to opcodes 01-08, 10-6B, 6D-70, 77, and 78 (with restrictions on what the first byte is). Deleting a character from the name will remove its first byte, but leave its second byte, so the payload can finish off with an opcode normally absorbed by 0E. Generally, hirigana characters are 0E, katakana characters are 0F, English characters are 04, and I think only the energy symbols and No/Lv are 05. There are many exceptions for the punctuation symbols. I documented a lot of this here: https://pastebin.com/HEhbHeJp
The plan to reach the credits is as follows:
  • Use the Down+A Glitch to execute code starting at $D0D2, sliding to our deck name located at $D2E0
  • Place an E9 (jump to HL) byte into $D3xx, to be executed soon
  • Set HL = 314A (credits)
When we reach $D2E0, register A is equal to D2. This makes it easy to get a D3 byte. But much more interestingly, D3 rotated rightward equals E9. And we have extremely easy access to rotating register A rightward. It's the perfect plan. I have absolutely no clue how we would have gotten an E9 in only a couple characters if not for this binary rotation being so close. So, more technically, the plan is this:
  • Increment register A to D3, and put it somewhere where it can be read as the first part of an address (register B or D work well)
  • Rotate register A to E9, and put it in that address
  • Write 31 into register H, using opcode 21 "load yyxx into HL", with yy inevitably being 04/05/0E/0F
  • Write 4A into register L, using register C as a middleman (since 0E gives us easy access to register C)
  • Let execution slide to the planted E9, which jumps execution to 314A
There are many variants to what the payload can be and what registers get used, but this is what the TAS ends up using, to minimize alphabet switches:
Hirigana (default alphabet)
  • 0E 4A
    • Register C = 4A
Lowercase
  • 04 3C
    • Increment A to D3
  • 04 57
    • Register D = register A (D = D3)
Uppercase
  • 0F 59
    • Rotate A rightwards (E9), register E = register C (E = 4A)
  • 04 12
    • Place A into address DE ($D34A = E9)
  • 04 21
    • Begin setting HL
Lowercase
  • 04 31
    • Finish setting HL (HL = 3104)
  • 00 6B
    • Register L = register E (L = 4A)
In the end, the payload is 8 characters long, and only switches alphabets 3 times, which cut out a lot of lag frames. In particular, it uses an odd katakana character in the Uppercase alphabet to gain access to 0F while also preparing register E. Originally, it ended with 00 69 (register L = register C), but I realized that while I'm rotating A, I can make E = C, then use L = E which is in Lowercase (L = C is in Uppercase). Hope this stuff makes sense, haha.
Inputting this naming is very complicated, and I can't say with 100% certainty that it is perfect due to how many options there are for moving the cursor around. A couple key techniques are of course using Start to warp the cursor to the bottom right, and using the bottom row to save horizontal inputs. The "Up/Down + Left/Right" technique mentioned in the TCG1 notes also applies here to move up/down every frame instead of every other frame. Overall, the amount of needed characters that are on the top or bottom rows is excellent, and almost every character's input enters the bottom row, either as a wraparound or a horizontal shortcut.
 Press B four times: 5 frames (B, x, B, x, B) (while moving to hirigana 4,3)
 づ: 4 frames (A, Start, Left, Up+A)
 s: 14 frames (Down, A, 7 lag, Start, Right, Down, Down+L, Down+R+A)
 _: 4 frames (Down+L, Right, Down, Right+A)
 ゥ: 14 frames (Start, L+A, 10 lag, Right, Down+A)
 C: 5 frames (Down, Left, x, Left, Down+A)
 R: 4 frames (Start, Down, Down+L, Right+A)
 h: 9 frames (Select, 6 lag, Start, Down+A)
 -: 5 frames (Left, Down, Left, Down, Down+R+A)
Also, I checked each possible step to stop and pause, to see if I could reduce lag frames. (No steps happened to be faster by a couple frames.) And by the way, this doesn't actually touch the game save in any way, like TCG1. Although, funnily enough, after these credits play, if you press Start it'll go back to the duel, and then you can play the credits again! Which is great, because the credits song is a masterpiece of slow and sad credits music. TCG1 has more fast and happy credits music, the two genres of credits music. Hmm... Dynamite Headdy has both...

Actual TCG2 TAS plug

Hey, would you like to see the game actually played? Well, I'm not Japanese, so too bad! Luckily, someone Japanese did make one!
There's quite a few reasons why a TCG2 TAS is not a project I want to take on, but having to do it in Japanese is one of the factors for sure. I also find the amount of deck edit options to be too giant, what with the 4 free decks you receive, the easy access to the Auto-Deck Machine, and the requirements some trainers have (specific type of energy, no trainers, 4 of a specific Pokemon, etc.). The idea that I could do an edit for a future duel within an edit, save it midway, and load it later, is just a little too much freedom to be able to get the run to a level of optimization I'd like. The RNG manipulation is more difficult as well, and the booster pack manipulation is extremely restrictive due to needing the ingredients for the Legendary Cards, as well as needing access to Scoop Up and Item Finders.
The ability to use the Legendary Zapdos's Peal of Thunder to make every duel 1 turn on GR Island is both exciting and terrifying, as having such an over-reliance on a specific card (as well as the Scoop Ups) means you're basically required to do a deck edit for every single duel, or dig very very deep into your deck. I loved TCG1's optimization because of the ability to use Machop, or Staryu, or Rattata, maybe a DCE Ponyta, maybe a Nidoran/Farfetch'd. TCG2 is all Zapdos and Digger... But this guy did a fantastic job from the looks of it, and in 2009 no less! (What the hell, that's a year before p4wn3r's TCG1 TAS!)

Screenshot

Well, being a 2 minute run with Japanese text, nothing seems too interesting... 6343 shows off the payload
frame 6460 in english translation says "Have a practice duel with Sam?" frame 6464 in english translation says "If you ever need to relearn the basics, come at any time!" but I can't confirm what they are in japanese
Please don't use the Gambatte palette for encoding, "VBA Accurate" was agreed upon for TCG1. Gambatte palette is really bad, orange turns into pink... (I still like Vivid...)

ThunderAxe31: Judging.
ThunderAxe31: File replaced with a 4 frames improvement.
ThunderAxe31: This is another unexpected submission, especially so soon after that the prequel game got a game end glitch submission as well. The comparison between the two movies is unavoidable, for which I noticed a colder response for this submission, which is the result of various reasons. Yet, the movie itself is optimized and aims for fastest completion, so at least it's applicable for Vault.
Accepting for Vault.

TASVideoAgent
They/Them
Experienced Forum User, Moderator
Joined: 8/3/2004
Posts: 11812
Location: 127.0.0.1
Post subject: Re: #6622: Blazephlozard's GBC Pokémon Card GB2: Here Comes Team GR! in 01:54.19
fsvgm777
She/Her
Experienced Forum User, Published Author, Senior Publisher (261)
Joined: 5/28/2009
Posts: 1074
Location: Luxembourg
TASVideoAgent wrote:
I'm not sure if you'd prefer "GR Dan Sanjou!" in the game name; googling Pokemon Card GB2 suggests that "Here Comes Team GR!" has become the most common subtitle (and is used on Bulbapedia and Speedrun.com).
We always use the romanised title when the game was never released in the USA, not the translated title. There's at least one precedent.
Twitter account - Steam Community page Oh, I'm just a concerned observer. Memory, GoddessMaria and Samsara are my sisters~♥
Fortranm
He/Him
Editor, Experienced Forum User, Published Author (536)
Joined: 10/19/2013
Posts: 1000
It seems playing as the girl wastes (at least) 1 frame. Does doing this actually make the setup faster?
Blazephlozard
He/Him
Banned User
Joined: 2/27/2013
Posts: 175
Location: Ohio
Fortranm wrote:
It seems playing as the girl wastes (at least) 1 frame. Does doing this actually make the setup faster?
Nah, the gender selection is done with a Right+A input on the same frame, and "boy" and "girl" are the same number of Japanese characters ("boy" would be faster in the US fan translation) So gender and name don't lose time (as long as the name is input in one frame, so you could do A, Left+A, Down+A, or Right+A)
Post subject: Re: #6622: Blazephlozard's GBC Pokémon Card GB2: Here Comes Team GR! in 01:54.19
Experienced Forum User
Joined: 12/29/2007
Posts: 482
fsvgm777 wrote:
TASVideoAgent wrote:
I'm not sure if you'd prefer "GR Dan Sanjou!" in the game name; googling Pokemon Card GB2 suggests that "Here Comes Team GR!" has become the most common subtitle (and is used on Bulbapedia and Speedrun.com).
We always use the romanised title when the game was never released in the USA, not the translated title. There's at least one precedent.
Does this apply to bootlegs also? As a fan of Pokemon TASes specifically, it's frustrating to see "Platinum Edition" smack dab in the middle of this page where its placement (right after Pearl, by coincidence) makes it much more easily confused with Platinum Version. If we're using romanized titles instead, the bootleg's title screen says 口袋妖怪 白金版 and the romanization can be found in the submission's ROM filename. Sorry for the slight off-topic.
Post subject: Re: #6622: Blazephlozard's GBC Pokémon Card GB2: Here Comes Team GR! in 01:54.19
Blazephlozard
He/Him
Banned User
Joined: 2/27/2013
Posts: 175
Location: Ohio
Zowayix wrote:
fsvgm777 wrote:
TASVideoAgent wrote:
I'm not sure if you'd prefer "GR Dan Sanjou!" in the game name; googling Pokemon Card GB2 suggests that "Here Comes Team GR!" has become the most common subtitle (and is used on Bulbapedia and Speedrun.com).
We always use the romanised title when the game was never released in the USA, not the translated title. There's at least one precedent.
Does this apply to bootlegs also? As a fan of Pokemon TASes specifically, it's frustrating to see "Platinum Edition" smack dab in the middle of this page where its placement (right after Pearl, by coincidence) makes it much more easily confused with Platinum Version. If we're using romanized titles instead, the bootleg's title screen says 口袋妖怪 白金版 and the romanization can be found in the submission's ROM filename. Sorry for the slight off-topic.
That's an interesting example. Especially since "Pokemon Platinum" is clearly a much worse search term to find the game than "Kou Dai Yao Guai - Bai Jin Ban". Using translated titles is definitely tricky because they can be translated differently by different people. Heck, the English translation we all use has a title screen of "Pokemon Trading Card Game 2: The Invasion of Team GR!" so that's different than what everyone else seems to be using. Although the romanization could be "GR Dan Sanjou!" or "GR-dan Sanjou!" For bootlegs, I guess it makes sense their English box art name would be used, as its just as official a release as the country it originated from. I cannot personally find any picture of a box or cartridge for this Pokemon Platinum Edition. But the use of the word "Edition" instead of "Version" is curious, and makes me assume it did originate from the name on an 'official' release outside of China. So I do think commonly-accepted English branding of bootlegs is okay, as confusing as it may be in that case. And I do think "GR-dan Sanjou!" is the best name for this submission. (Going by the Giant Bomb wiki, like Twitch does.)
Blazephlozard
He/Him
Banned User
Joined: 2/27/2013
Posts: 175
Location: Ohio
I just realized an improvement, as I wasn't totally happy with how technically useless the "rotate A leftwards" is and double-checking if it was necessary. Turns out I did overlook that "_" is an option for opcode 57 in the lowercase alphabet, and it means I don't have to rotate A leftwards anymore to use 0F 57. It saved 2 frames. It also makes the payload 8 characters, which saves 2 frames (since I can press B one less time at the start). I definitely can't see any way to compress the payload any more than that now. Here's the file: http://tasvideos.org/userfiles/info/61405334239396869
Post subject: Needs more audience response
ThunderAxe31
He/Him
Experienced Forum User, Judge, Moderator, Published Author (1258)
Joined: 9/12/2016
Posts: 1460
Location: Southern Italy
Gameboy TASer of 2017
I wonder why this submission got less (and worse) votes than the TGC1 one. Is it because this is Japanese? Or because it's shorter? Or maybe just because it got less attention due to the other submission(s)? In any case, I need more votes, or even posts, if anyone is kind enough. Thanks.
my personal page - my YouTube channel - my GitHub - my Discord: ThunderAxe31#1512 <Masterjun> if you look at the "NES" in a weird angle, it actually clearly says "GBA"
Bloopiero
He/Him
Experienced Forum User, Published Author (474)
Joined: 1/9/2017
Posts: 56
Location: Mill Creek, WA
Exotic platforms TAS of 2019
I didn't vote on the other game, but just from my own perspective, this movie is... incredibly boring. I'm very impressed on a technical level, and I do love it, but 2 minutes of textboxes that I can't even read is about as low as you can go entertainment-wise. I'm sorry, but I guess I'm the first No vote. At least the last 2 seconds were exciting.
Whale eat again
Blazephlozard
He/Him
Banned User
Joined: 2/27/2013
Posts: 175
Location: Ohio
Hmm, I would agree, the 2:40 of intro time in TCG1 is more entertaining than the 1:40 of intro time in TCG2, since you can read it. The RNG manip and clock cycle manip required in TCG1 is also more impressive on a technical level. I have a 1:59 RTA time in TCG2 with this strategy, since there's no RNG involved and it always succeeds. So it's less of a technical achievement as well, and really just shows TAS levels of keyboard navigation compared to RTA. (Though I do think CasualPokePlayer's idea of placing an E9 inside D3xx was a genius work around to deck naming not having direct access to any Jump opcodes)
Blazephlozard
He/Him
Banned User
Joined: 2/27/2013
Posts: 175
Location: Ohio
Just posting this here for possible future reference I began work on updated TCG1 TAS, and thoroughly checked the starting name used, something that hadn't been checked before. Oddly, though they all take the same number of frames to input, "No" (as was chosen for humor purposes) is fastest in the TCG1 ACE TAS, with the other 9 options having extra lag frames the first time your hand is displayed in the tutorial. ("R" got 2 extra, the rest had 4 extra.) I wanted to confirm there was no possible time save based on name choice in this game as well. My options are drastically more limited, as name entry in this game is 3 frames instead of 4. (In TCG1, we had to wait for A to be de-pressed) Default character (A, Start, A) had 3 extra lag frames displaying the Grass Energy text in duel. The other three options (Right/Down/Left+A, Start, A) all have identical end. As TCG1's No saved more than 1 frame, I decided to try 4-frame names in TCG2 as well. They all had identical Grass Energy lag length, but lost 2 extra lag frames before the duel, so they came out 3 frames slower (and they appeared to sync regardless of name). To be extra thorough, I checked choosing Boy as gender. Oddly, Right+A then was 2 lag frames slower. Left+A and Down+A remained the same that's submitted, and A was still 3 slower. I also tried different valid inputs like "Left+A, Up, A" or "Left+A, x, Up+A" (since Left wraps you around to be an Up away from Start), and they all came out the same. tl;dr: Name and gender CAN matter, but as far as I tested, I happened to choose one that doesn't lose time.
Post subject: Movie published
TASVideoAgent
They/Them
Experienced Forum User, Moderator
Joined: 8/3/2004
Posts: 11812
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. ---- [4120] GBC Pokémon Card GB2: GR-dan Sanjou! "game end glitch" by CasualPokePlayer in 01:53.41
Blazephlozard
He/Him
Banned User
Joined: 2/27/2013
Posts: 175
Location: Ohio
I realized Left+Right can be used to input Left on two consecutive frames. This is (hopefully) saving frames in both TCG1 runs, but it also has one usage in this run (when inputting "C"), saving 1 frame in the deck naming. Unfortunately, on the interim build (which is console accurate), saving this one frame in the deck edit adds 4 lag frames to the duel. There's not much to work with in this run for lag reduction, and since it's only a 1 frame input improvement, I think just documenting it here is best.