Isn't the tutorial 8 minutes?

Game objectives

  • Emulator used: BizHawk 2.4
  • Major skip glitch
  • Executes arbitrary code
  • Heavy glitch abuse

gifvex's comments

Pokémon Speedruns user entrpntr & I tried to replay #5597: anonymous user's GBC Pokémon: Trading Card Game in 21:30.96 on console this month. The movie wasn't supposed to sync through the end, and it didn't, but observing how it desyncs is a step in identifying differences between console and emulator. The movie wasn't supposed to sync through even the tutorial, and it didn't, but after 20 minutes the player had exited the duel and was about to choose a starter deck.
entrpntr's pet theory was the tutorial may have a time limit, which I didn't think about until the next desync suggested a different "time limit" (that's not a thing). The desynced inputs found a button combination to escape the tutorial duel, later confirmed to work in all duels and count as a victory. This glitch inspired a bit of fun for RTA speedrunners and is documented on Pastebin.
Sometimes the down+A glitch will not escape the duel, but instead send the player into an "infinite party screen." There are other, far less likely effects too. They depend on the timer interrupt handler as the documentation linked above details. Precise alignment of the timer interrupt can lead the invalid code path into player-affected memory, and that territory is where this movie has its fun.

Route

Outline

  • The player is named "No" (1 character). It's a little more interesting than "A" and the inputs to enter it happen to align the timer interrupt nicely
  • Choose HAND from the menu. Select a Water Energy card.
    Attach a Water Energy card to your active Pokémon, Goldeen.
    Choose ATTACK from the menu and select Horn Attack.
  • The tutorial is escaped as soon as possible instead of following Dr. Mason's instructions
  • Squirtle & Friends is chosen as the starter deck. The deck has the shortest name and contains good card IDs for the arbitrary code execution setup
  • Options are set to 5 (instant) text speed and skippable shuffle/draw animations
  • A deck edit is done (see below) before the duel with Aaron is started, where the down+A glitch is performed with the goal to jump to memory

Inputs

As an improvement over the full-game movie, which introduced directional+A/B to save input frames, this movie also includes a technique similar to other Pokémon movies. In many menus, directional inputs can be reapplied by adding a different directional after. For example, a down 2 sequence can be done with (down, down+left) instead of (down, none, down).

RNG & deck edit

The deck shuffle before the arbitrary code execution is very important as the shuffled indices are executed as opcodes. A few opcodes will stop the CPU or divert the code flow. The positions of cards (active, hand, etc.) are executed as opcodes as well. An active card's position value is the stop instruction, but this can be avoided by having another instruction precede it which interprets the value as data. The general idea is to play an active card that is 1 or 2 indices in the deck after any cards in the hand or prizes. Both the player and the opponent must meet these conditions, and a lot of testing is required to identify the shuffles that are safe to execute.
The deck shuffle RNG frame this movie aims for is C1 A8 CB, against Aaron's second deck. There are 3 frames of delay to advance to there before the duel with Aaron. The deck needs to be edited to not contain any basic Pokémon at the 7 indices drawn to the hand, because this RNG frame requires the player to reshuffle the deck to meet the conditions above. A deck edit consists of removing cards or appending cards to the end of the deck. The card IDs in the deck are what will be executed as the arbitrary code, in order from beginning to end, and per the rules of the trading card game the deck must contain 60 cards.
  • +Grass Energy
  • +Weedle
  • +Arcanine
    • These three card IDs are interpreted as ld bc, $380F
  • -Water Energy, +Water Energy, -Water Energy, +Water Energy, +Lightning Energy
    • Water Energy is interpreted as inc bc (twice)
    • Lightning Energy is interpreted as inc b
  • -Professor Oak, -Bill, +Bill, -Switch, +Switch, -Poke Ball
    • Professor Oak and Poke Ball are removed to not be executed
    • Bill is interpreted as push bc
    • Switch, as the last card, is interpreted as jp nc, $0000
  • -Abra
  • -Machop
    • These two cards are only removed to shift down certain other cards
The card shifting is to have no basic Pokémon at indices 10, 26, 31, 33, 39, 40, and 50 (the first 7 drawn) to cause a reshuffle, and to have a basic Pokémon at index 37 to play after, as index 36 will be in the hand. The instructions appended to the end of the deck make up this sequence:
 ld bc, $380f ; bc   = $380f
 inc bc       ; bc   = $3810
 inc bc       ; bc   = $3811
 inc b        ; bc   = $3911
 push bc      ; [sp] = $3911
 jp nc, $0000 ; pc   = $0000
 ; @0000
 ret          ; pc   = $3911 (GameEvent_Credits)

anonymous user's comments

While gifvex came up with the idea, the timer interrupt manipulating, and final instruction sequence, I worked on optimizing which RNG the run uses. I've always been a huge fan of ACEs that turn game elements into editable code (the old Super Mario Land 2 is my favorite), and I had a lot of fun learning assembly basics so I could wrap my head around the criteria going into a usable RNG frame for this.
Here's the script I ended up with: https://pastebin.com/MgnXQ7Dt
It prints all the possible usable frames it can find for each of Aaron's 3 deck choices (including many false positives, mostly due to the unpredictable nature of the relative jumps relying on Carry/Zero flags). It had a lot more restrictions, but I gradually turned them off in order to check as many possibilities as possible (and as our knowledge of what was needed improved).
The ACE execution we get starts at C000, which slides to C200, the start of duel information. C200-C300 is our board state and shuffled deck info, C300-C400 is the opponent's, and then C400 starts our raw deck contents (which is what we can edit before the duel). So, we just need to safely reach C400. Unfortunately, active Pokemon freeze the game, card 16 freezes the game, and after each shuffled deck are up to 6 0xFF opcodes (for each player's bench) that will ruin the ACE if our stack pointer got disrupted. So the main requirements for the deck shuffle are getting a Heads coin flip, both players having an Active Pokemon 1-2 slots after a hand/prize card, card 16 being jumped over or used by another instruction, and jumping over opcode 0x31 (set stack pointer), or jump over the FFs.
gifvex came up with a great way to test these frames for if they actually work before committing: 0xCAD0 is a jump command that gets ran between frames. So, you can set 0xCAD1 to C000 to jump there. Here's a code snippet to easily do it.
--Wipe your active Pokemon's 0x10
for h=0,59 do
	if (memory.readbyte(0xC200 + h) == 0x10) then
		memory.writebyte(0xC200 + h, 1)
	end
end
--Jump to C000
memory.writebyte(0xCAD1, 0)
memory.writebyte(0xCAD2, 0xC0)
It would be a bit sad if this movie obsoletes the glitchless run, as I'm incredibly proud still of its routing and execution (beating the game in only 3 deck edits should not have been possible). But I think this would have to be in Moons for that to not happen, and, well, technically, this movie has a higher intro percentage than the full run... But at least it's a good replacement. When the duel escape glitch was discovered, I was worried it'd lead to a horribly dull TAS that's just a slightly faster executed real time any%. But then gifvex came in with ACE, and I can be proud of the effort put into this run in the end.
There may be an ACE TAS for the sequel, as well!
Oh, and please don't use the Gambatte palette! "VBA Accurate" was agreed upon for TCG1. Gambatte palette is really bad, orange turns into pink...

Other comments

It's possible the RNG frame used is not the best because it includes performing a reshuffle, despite the low delay for the frame itself. All other options tested for this movie did not work or were slower but the possibility is there.
This movie calls the credits routine and it plays in full, but there are no flags set in the save file, so it may be unsatisfactory for game completion. The current branchless publication for this game is tiered in vault and consideration will need to be given if this movie would obsolete it.

ThunderAxe31: Judging.
ThunderAxe31: This is a groundbreaking submission. Not only it introduced a long sought method for skipping the tutorial, but it also opened up a way to skip straight to the credits, so I can understand the positive reaction to this submission. It's also very optimized.
The currently published movie is in Vault tier, so it's unavoidably going to be obsoleted by this movie. This means that future glitchless submissions would be unlikely to be accepted, unless they somehow manage to introduce entertaining contents, or if the community for some reason will begin to be entertained with glichless movies of this game. But I personally don't see either of these scenarios happening anytime soon, so if anyone decides to submit new glitchless movies, they should acknowledge the low chances of accepting.
Regardless, accepting this submission for Moons and obsoleting the current publication.
Spikestuff: Pubing.


TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15577
Location: 127.0.0.1
Patashu
He/Him
Joined: 10/2/2005
Posts: 4043
I was hoping this would do more than just instantly win fights! ACE is a great payoff to find. Yes vote.
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
EZGames69
He/They
Publisher, Reviewer, Expert player (4460)
Joined: 5/29/2017
Posts: 2761
[14:15] <feos> WinDOES what DOSn't 12:33:44 PM <Mothrayas> "I got an oof with my game!" Mothrayas Today at 12:22: <Colin> thank you for supporting noble causes such as my feet MemoryTAS Today at 11:55 AM: you wouldn't know beauty if it slapped you in the face with a giant fish [Today at 4:51 PM] Mothrayas: although if you like your own tweets that's the online equivalent of sniffing your own farts and probably tells a lot about you as a person MemoryTAS Today at 7:01 PM: But I exert big staff energy honestly lol Samsara Today at 1:20 PM: wouldn't ACE in a real life TAS just stand for Actually Cease Existing
Active player (261)
Joined: 12/13/2016
Posts: 352
Are we expecting this version to console verify?
TiKevin83
He/Him
Ambassador, Moderator, Site Developer, Player (155)
Joined: 3/17/2018
Posts: 358
Location: Holland, MI
There would need to be some more emulation updates and then a resync with a setup movie that clears save data to a constant state between EMU and Console, so I believe it's beyond the immediate scope of this submission
prouzi
He/Him
Joined: 10/5/2019
Posts: 2
Location: In a dark alleyway
I love ACE runs.
Hi. I exist.
Former player
Joined: 3/13/2017
Posts: 15
ruadath wrote:
Are we expecting this version to console verify?
This movie, no. The exploit is fine as entrpntr verified a resync for console today. It was made with a work-in-progress build for an RTA emulator so it could be some time before those changes make it over.
Post subject: Suggesting frame
Editor, Reviewer, Skilled player (1358)
Joined: 9/12/2016
Posts: 1646
Location: Italy
I suggest frame 7575 as screenshot:
my personal page - my YouTube channel - my GitHub - my Discord: thunderaxe31 <Masterjun> if you look at the "NES" in a weird angle, it actually clearly says "GBA"
g0goTBC
He/Him
Experienced player (752)
Joined: 6/11/2018
Posts: 110
I agree with ThunderAxe31
Banjo-Tooie runner, DTC 8, 9, 10, and 11 winner, but more importantly, "When's GR?" Current projects: Banjo-Kazooie: Grunty's Revenge - 100% (50 minutes) Mario Party 1 - All Boards (est: 4-6 hours) Mario Party 3 - All Minigames (est: 40-50 minutes, not sure) "Ooooh, I saved some more subpixels. Look at those sweet subpixels. You can't look at them, because they're subpixels, but they look so good." - The8bitbeast "It's as if I knew what was going to happen. It's as if I had the plan written in front of me and I was reading it. I mean, I do have it in front of me, but I'm not reading it." -garagedooropener
Blazephlozard
He/Him
Banned User
Joined: 2/27/2013
Posts: 175
Location: Ohio
Here's an interesting question: What do you think of a new version of the full game TAS which uses Duel Escape for the tutorial, but not for any other duels? It's technically a speed/entertainment trade-off, as having to carefully manipulate RNG to embarrass every opponent in one turn is more entertaining than pressing Down+A. I believe the tutorial time is the main thing killing its Mooniness. Although the menuing is still perhaps too fast to 'follow' as well. And with the major menuing improvement gifvex found for up/down, there will be optimization to do throughout the movie's deck edits and duel input as well, so it wouldn't just be a copy/paste job. For example, the down+L/R menuing is so fast, the interim card pictures can't even load, saving lag frames too (DCE picture for using PlusPower):
Editor, Reviewer, Skilled player (1358)
Joined: 9/12/2016
Posts: 1646
Location: Italy
Blazephlozard wrote:
What do you think of a new version of the full game TAS which uses Duel Escape for the tutorial, but not for any other duels? It's technically a speed/entertainment trade-off, as having to carefully manipulate RNG to embarrass every opponent in one turn is more entertaining than pressing Down+A.
I didn't consider the possibility of escaping the tutorial alone, but I think that in the end it could be considered as a speed/entertainment tradeoff as you said, so it would make sense. I like the idea! I'm definitely looking forward to see it done.
my personal page - my YouTube channel - my GitHub - my Discord: thunderaxe31 <Masterjun> if you look at the "NES" in a weird angle, it actually clearly says "GBA"
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15577
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. ---- [4115] GBC Pokémon: Trading Card Game "game end glitch" by gifvex in 02:57.36