(Link to video)
All your base are belong to pi.
Download package (C++ input parser and script file): http://tasvideos-moviefiles.googlecode.com/files/piscript.zip
Information that is even more technical than what is covered here: Forum/Posts/342003

Goals

  • Pi
  • Pi
  • Pi

About the TAS

Well, this TAS is a bit different. Instead of ponies, you get pi.

What in the name of pi is going on

To hijack program control, you need two things:
  • A way to divert the program counter (PC) into RAM.
  • A way to write the right program.
Conventional thinking (such as in p4wn3r's 1:09.63 TAS) has shown that the address D36D-D36E is a well-used gateway to send the PC into RAM. Just put any 16-bit number there (little-endian) and the PC will jump to whatever it says when you close the menu. Furthermore, using memory-manipulation glitches such as switching Pokemon beyond the 6th position, and switching and tossing glitched items, you can pretty much write whatever you want from D16A onward. And how do you switch Pokemon beyond the 6th position, if such a thing is even imaginable? Just do a reset at the right time while saving and it will overwrite the Pokemon counter so the game thinks you have 255 Pokemon.
I inject the following sequence into D366 (don't ask): 22 00 76 00 F0 F5 D4 50 D3
Provided that the bytes from D350 to D365 are all 00 (which they are), these 9 bytes will magically hijack the GB and give you complete control of everything you ever wanted, only limited by the GB's hardware. Other sequences including shorter ones exist but I chose this sequence to be as fast as possible. To help out, the rival is given a completely illogical name.
Once the sequence is planted, I close the menu. The game reads D350 off the gateway address and thinks that it is a valid ROM address and so jumps there. The sequence and all future programs are craftily hacked together in a way that is hard to describe casually, so I'll just say this: given enough room (which I have more than enough of), you can write a very simple RAM-writing program. Congrats, you can now write whatever you want.
The payload (final program), which is only 152 bytes long, is a simple VRAM manipulator. It starts out by writing into the tile bank at positions F3-F7 the 8x8 tiles for pi, pi upside down, decimal point, zero, and one, where the last 3 are in Pokemon font (they were somehow erased after leaving the menu; none of the other digits were harmed). The program then enters an input-interactive state where you can feed it key input which can change the tile map. For this TAS, visible tilemap is practially divided into two spaces: topspace (top 12 rows) and bottomspace (bottom 6 rows). The two columns on both sides are unusable. For technical reasons, the bottomspace effectively extends below the bottom of the screen by two rows.
It works somewhat like this (0x means hexadecimal):
  • Feeding it a number from 0x00 to 0xED writes to a cache (at D600) representing the bottomspace (8 rows by 16 columns). Each number writes the tile for either pi or pi upside down in the cache at a given position. The cache exists in order to sync the bottomspace input. To perform a do-nothing-visible action, feed it the number 0xED. It writes off the bottom of the screen.
  • Feeding it the number 0xEE dumps the cache into bottomspace and clears it with the all-black tile.
  • Feeding it the number 0xEF ends the program. It fakes a GB crash and sends itself into an infinite loop.
  • Feeding it a number from 0xF0 to 0xFF writes directly to topspace (12 rows by 16 columns). Each number writes its own value (tile values F5-FF which are decimal point and digits) to the first available position in topspace. It writes serially (left to right, then top to bottom).
There is no guarantee that VRAM writing occurs in a safe (to a real GB) manner; it does not check for status of FF40-FF41 (for reference, pages 51-53 of http://marc.rawer.de/Gameboy/Docs/GBCPUman.pdf ).
Anyway, scripting VRAM to do what I want is a bit too hard to do entirely with manual hex-editing, so I wrote a simple C++ parser that converts ANSI (ASCII) into input. This allows me to use a text editor instead, and organize the script using characters that the parser ignores.

About the script used

I did my best to sync the "actions" of the tiles with the background music. First, note that dumping cache to bottomspace and writing directly to topspace cannot occur on the same frame, so they must be at least one frame apart.
Second, placing the frame on which the tile appears and the frame on which the peak of a sound effect first occurs on the same frame is not guaranteed to be perceived as sync. The human brain does not work that way. From my own testing, it seems best for the frame on which the tile appears to occur 5 or 6 frames back. Results may vary by person, state of mind, and method of encoding of course.
The normal beat window is 15 frames (this is the width between the first two notes of the Pokemon music when you start in the bedroom). This means that, when syncing to a 15-frame beat, each frame is limited to dumping 14 tiles into VRAM. Some notes occur with a window of 7-8 frames; I can pull this off early on, but I decided that later on it was too much of a hassle to maintain so I ignored those notes.
I threw in a few references to pi, games, or mathematical stuff that can easily be represented by dot matrix display. Otherwise, there's not much else to talk about. For more information about technical details, see this post: Forum/Posts/342003.
Well anyway, enjoy the TAS and help yourself to some pi. It's a neat soundclip from the Hard n' Phirm song "Pi"; however, you shouldn't look for the rest of the song or its music video unless you are willing to lose a few brain cells. You can also listen to "Mathematical Pi" if you wish.
Happy Pi Day!

Nach: Accepting as improvement to existing run.

Player (142)
Joined: 7/16/2009
Posts: 686
Warp wrote:
Or are we going to accept only those that "improve" (by an extremely subjective measurement stick) on the previous one, and have it replace it?
Yes. Entertainment has always been the biggest factor in movie judging (up until recently, but it's still a big one). Entertainment is subjective, yes, but that has never been a problem. The improvement here is one of entertainment value. This movie is considered to be more entertaining than the previous one (for various reasons, it being faster just one of those) and as entertainment is all a "Executes Arbitrary Code" run can aim for, this movie is better (i.e. an improvement).
Mitjitsu
He/Him
Banned User, Experienced player (532)
Joined: 4/24/2006
Posts: 2997
Great technical achievement, but the payoff wasn't worthwhile. Unlike the pony version.
Editor, Skilled player (1938)
Joined: 6/15/2005
Posts: 3246
Hm. I never expected my submission to generate half the attention it actually received. It seems that this run is judged to obsolete [url= http://tasvideos.org/2187M.html]bortreb's run[/url]. That's unfortunate, since bortreb put in way more effort (even constructing the TAS entirely from botted input). Just by looking at the submission text, it is clear that he knows GB specs inside out, something that I cannot lay claim to. Without bortreb's run, this submission would not exist. We should all thank him for such an innovative run. In comparison, my TAS is not innovative. If bortreb chose to do a Pi Day TAS, he would most certainly have done it better than me. That being said, I wonder what bortreb would think if he saw this run.
Patashu
He/Him
Joined: 10/2/2005
Posts: 4014
This run now has 145,000 views on nicovideo, and I am sure it is still rising :D Btw, does anyone know if nicovideo views can be added more than once by one person?
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
Banned User, Former player
Joined: 3/10/2004
Posts: 7698
Location: Finland
Samsara wrote:
Not everyone is an MLP fan, and hell, a fair amount of people outright despise the idiotic fandom it spawned.
That's really lousy reasoning for arguing why this submission is somehow an "improvement." It's not the content per se. It's how visually impressive it is. Printing some numbers and characters on screen is not very impressive. Showing full-screen graphics and playing music is. And I am talking from the perspective of the average viewer here. This has nothing to do with MLP in itself. If this had, for example, displayed a picture of Rick Astley and played the "never gonna give you up" song, I would have voted yes in a heartbeat. I would have honestly considered that an improvement over the first submission (because now there would have been a joke that a good majority of people would recognize and appreciate, and it would have been an impressive feat even without understanding the technical details.) I still think that replacing a "total hack" (in the visual sense) with something that simply prints some numbers on screen is a shame.
The right decision was definitely made to have this obsolete the last run.
I couldn't disagree more.
Joined: 5/6/2012
Posts: 3
Is there a precedent for a playaround TAS obsoleting another playaround TAS?
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
your name here wrote:
Is there a precedent for a playaround TAS obsoleting another playaround TAS?
At least 6.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Joined: 4/3/2005
Posts: 575
Location: Spain
Movie makers judge the entertainment of the movies in rollercoaster terms. The original movie has 10 minutes of build-up and a very short ride with one single slope. This movie has a much shorter build-up and a longer, smooth ride with many, many small slopes that follow a musical pattern. To me it's obvious that this one is miles better in the entertainment level. It doesn't have the breakthrough achievement of being able to construct these kind of rollercoasters in the first place, but this one is a better rollercoaster than the previous one. Even if it's more simple, simple sometimes is better.
No.
AnS
Emulator Coder, Experienced player (723)
Joined: 2/23/2006
Posts: 682
I have to agree this movie lacks the feeling of a miracle, for a stranger it looks like something that could be done using an advanced debug mode accessed via cheats, while the old one clearly goes beyond the imaginary borders of the game. I still voted Yes for the entertainment, but I think playarounds shouln't share the fate of speedrun records (obsoletion obsession). If only there was a separate tier for Playarounds, both movies could be hosted in it.
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
AnS wrote:
I have to agree this movie lacks the feeling of a miracle, for a stranger it looks like something that could be done using an advanced debug mode accessed via cheats, while the old one clearly goes beyond the imaginary borders of the game.
I know what you mean. I echoed something similar in the first post in the thread. If someone were to make a truly amazing run (read: Payload which is not only impressive like pony's, but feels like "I intentionally *TAS*'d this", instead of a prank) which goes along the lines of what I described earlier, I think we could come up with an alternate branch to publish that under.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
He means losing content is a bad thing. I add that making up reasons to lose it is even worse. The only true reason for an obsoletion of a not speed-based run in my eyes is people preferring one over another and asking for an obsoletion. Funny thing, this is what exactly happened in this thread. More than 10 people were preferring this submission over the previous one. So obsoletion is a perfect decision here. My personal opinion is that the previous one looked more hackish and this one makes more sense. Also, having SO much references to the number in question is insane and awesome. For being much more recognizable by a human, I think it's also a great Star example overall. EDIT: http://www.youtube.com/watch?v=eTOKXCEwo_8#t=2428s
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Player (44)
Joined: 7/11/2010
Posts: 1022
You could probably please everyone at once by making the movie do something unexpected and clearly outside the borders of the game at the end, rather than the fake crash, and having it look the same up to that point (it wouldn't be the same in terms of input, but it could be very similar; I imagine there are easily enough spare frames to start writing a program into memory while everything else is going on). I was a bit disappointed that nothing dramatic happened after the screen filled. (Also, the length of time it takes to gain total control over the game is a clear speed-based category that these runs can compete in. It's not purely about entertainment; if it were, there'd be no real reason to do it via hacking into a game at all.)
Joined: 4/6/2012
Posts: 44
Location: Lawn, PA
Bullet point list about this movie: * Executes arbitrary code. * Pi. * Doesn't beat the game. Doesn't need to beat the game - THE POWER OF PI COMPELS YOU. * Also pi. * Text box pis dance to the music. * And pi. * Is both adorable and totally awesome. * Did I mention pi yet? Because pi. SPOILER: THIS TAS CONTAINS PI By the way, Yes vote.
1/60 of a second is important; every frame matters.
Joined: 9/22/2011
Posts: 42
So apparently this was judged to obsolete the previous run. I disagree for all the reasons stated, but we can find a compromise - I guess this is probably already planned, but just link to the other movie in the description for this one. (I know it will already be listed under the description, for what it obsoleted, but a direct link and short blurb would make it clear to the viewer that it does different, bit similar things.)
Designer of Copy Kitty, a game about giant robots and explosions
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
FractalFusion wrote:
Hm. I never expected my submission to generate half the attention it actually received. It seems that this run is judged to obsolete [url= http://tasvideos.org/2187M.html]bortreb's run[/url]. That's unfortunate, since bortreb put in way more effort (even constructing the TAS entirely from botted input). Just by looking at the submission text, it is clear that he knows GB specs inside out, something that I cannot lay claim to. Without bortreb's run, this submission would not exist. We should all thank him for such an innovative run. In comparison, my TAS is not innovative. If bortreb chose to do a Pi Day TAS, he would most certainly have done it better than me. That being said, I wonder what bortreb would think if he saw this run.
I've been hoping that someone would take my run and improve it ever since I released it. Your PI run is awesome! My favorite part is how you write each level of bootstrapping code "backwards" and actually overwrite the jump address of the last bootstrapping layer. That's some elegant self-modifying code and a beautiful approach. One of the best parts of making things is having other people take them and use them to build their own stuff. To those that think the visual output is not as impressive -- he could have written the exact same payload as the last video, so I don't see why that should be an issue. The cool part is the massive improvement in actual bootstrapping time. It's a very subjective thing to judge these types of runs, because I think there's two metrics: technical excellence of the bootstrapping, and entertainment of the payload. Anyway, this run just absolutely made my day! Thanks, FractalFusion!
Spikestuff
They/Them
Editor, Publisher, Expert player (2283)
Joined: 10/12/2011
Posts: 6335
Location: The land down under.
I think the only way to beat pi is to do the Matrix (A SHIT ton of black and green and random shit going down the screen) or Doctor Who (Changing time) with the addition of the actual theme. Or some other Game/Tv-show/Movie/ponies that could do coding and have a theme song.... NUMB3RS! or you know just do the csi theme.... *cough*
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 14854
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. ---- [2341] GBC Pokémon: Yellow Version "arbitrary code execution" by FractalFusion in 03:14.15
Banned User, Former player
Joined: 3/10/2004
Posts: 7698
Location: Finland
bortreb wrote:
To those that think the visual output is not as impressive -- he could have written the exact same payload as the last video, so I don't see why that should be an issue. The cool part is the massive improvement in actual bootstrapping time.
I think that your very post wonderfully demonstrates why it's an issue: Only those who have a deep and intimate knowledge of the technical details of the hacking process can fully appreciate it. Those who do not know what's going on will only see some numbers appearing and a "pi" character being printed here and there. There's little to see for those who don't know the technical details, iow. 99% of the viewership. The payload didn't have to be the same as with the first submission. However, I do think it should have been at least as visually (and auditorily) clear that "hey, we are running our own code, not just glitching the game." (I still think that a "rickroll hack" would have been a million times better than this. Both those who know the technical details, and the average viewer, can fully appreciate what's going on.) Protesting the obsoletion of the first submission with what I consider a vastly inferior one is quite moot at this point, but whatever.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
To please the minority, the only way out is to develop the rules so that different types of playarounds can be published for the same game alongside. If you guys have ideas, post them, pure protesting leads nowhere.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Banned User, Former player
Joined: 3/10/2004
Posts: 7698
Location: Finland
feos wrote:
To please the minority, the only way out is to develop the rules so that different types of playarounds can be published for the same game alongside. If you guys have ideas, post them, pure protesting leads nowhere.
I was not advocating publishing both runs. I was simply saying that given the choice I would prefer the first one over this one. However, this is a majority vote thing, so there's little that I can do. (I really hope someone makes a third version which gets to the arbitrary code sooner, like this one, but where there's an awesome payoff. I'm still hoping for a "rickroll hack" or something along those lines.)
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
The rates are surprisingly better than for the previous one and also look like a Star.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Experienced player (576)
Joined: 2/23/2008
Posts: 266
Location: CA, USA
Now that was insane.
Player (12)
Joined: 6/17/2006
Posts: 501
How did I miss that submission? Great job! Now we need another arbitrary code submission for Tau Day! :D
Player (87)
Joined: 1/15/2006
Posts: 333
Location: Bangkok, Thailand
I have yet to see a published run accomplish all of its stated goals so completely.
print reduce(lambda x,p:p/2*x/p+2*10**1000,range(6643,1,-2))
Joined: 7/30/2014
Posts: 145
Location: マーベリックハンターベース
..........私は 言葉は減少している。
ロックマンX7は? 私はそのクソゲームを憎む