Introduction

Tetris is the most well-known and best-selling GameBoy game, but has received only little attention in terms of TASing. This is probably partly due to it's deceptively simple mechanics, the short game length, and being overshadowed by the (comparatively less successful) NES and DX versions.
I started looking into Tetris merely for the sake of it and not from a TAS perspective, but I decided to create a TAS for it when I discovered a bug which can actually be used to save time compared to normal gameplay. It shows that even such a simple and short game as Tetris can contain time-saving glitches, which was reason enough for me to create a movie of it.
This bug accounts for a large part of the 416 frames which are saved compared to the currently published run (taking into account lag differences).

About the run

Goal and general strategy

The goal is to beat the "B-Type" game mode as fast as possible, getting the "best ending" (by playing at Level 9 and High 5). To beat B-Type, 25 lines need to be cleared. Each line consists of 10 blocks, which result in 250 cleared blocks total, requiring 62.5 tetriminos on an empty board. The general idea is to both minimize the number of needed tetriminos and place them as fast as possible. The number of needed tetriminos can be decreased in two ways, by using the pre-existing blocks which are generated when starting the game, and by exploiting a bug when clearing lines, which allows to duplicate blocks. The latter method turns out to be way more effective and it described in detail in the mechanics section, while the former method turns out to not be worth it, the saved time is eaten up by the additional time needed to drop the tetriminos farther down.
Also, the line clear animation costs time, so the number of individual line clears should be minimized. It is possible to beat it using only seven individual line clears (6x4 + 1). This run uses eight, but only 4 of them happen during the run, the last 4 happen after the input already ended, and thus don't count towards the total time. Manipulating the next tetriminos so that the input can end early is the second big time saver of this run.

Emulator

This run uses BizHawk and syncs on any version except 1.7 (due to frame timing differences). Note that the previous run was made in VBA-rr, which has less lag, resulting in a 30 frame difference in the initial menus (there are no lag differences during an active game).

Version

There are two versions of GB Tetris, v1.0 and v1.1, which only differ in very few aspects. The most important difference is that the initial legal screen is shown two seconds longer in v1.1. I decided to go with the v1.1 version anyway, since this is the version the previous run uses, it is the far more commonly distributed version (v1.0 was only released in Japan) and the time save is trivial. Also, only the v1.1 version contains Коробейники (Korobeiniki), the famous Tetris sound track, as the A-Type song, which significantly increases the run's entertainment value in my opinion.

Options

This run is performed on Level 9 and High 5, which not only allows for the "best ending", but also turns out to be the fastest settings. Cranking up the level and therefore the speed at which the tetriminos drop slightly decreases the time needed to place them (there is no hard drop in this game), and the High is cranked up to decrease the distance the tetriminos need to travel before being placed.

Mechanics quirks

Despite being such a simple game, this version of Tetris has quite a few quirks that can either help or be in your way.

Moving tetriminos

Each frame you have the option to issue inputs to control the tetrimino, rotating or shifting it left or right or dropping it by one block. Additionally, there is a frame timer moving the block downward (the speed of which depends on the level), which progresses each frame you are not pressing down manually. The timer is not reset when dropping the tetrimino manually, which means the fastest way to drop it is not by holding the button down, but by pressing down only every third frame (which is the cooldown of manual dropping), letting the timer tick for the other two frames.

Clearing lines

If rows become entirely filled with blocks, they get cleared and the rows above them move down. This does not apply for the two top rows, though. For some reason, the developers decided that the two top rows cannot be cleared, even if they are completely filled, the loop which checks for filled rows only begins at the third row.

Line clear bug

Due to particularly bad programming, all blocks in the topmost row get duplicated to all rows below it when multiple lines are cleared. This is no big deal in normal gameplay, since it is hard to get a block in the topmost row and continue clearing lines afterwards, so most of the time it is empty anyway. In this run, this bug is exploited extensively in order to duplicate as many blocks as possible and therefore decreasing the number of needed tetriminos.
To give an example on how this works, consider this board:
+-+
|xxxx   x x|
|xxxx xxxxx|
|xxxx xxxxx|
|xxxx xxxxx|
|xxxx xxxxx|
|xxxx xxxxx|
|   xxx    |
When an "I" tetrimino is placed to clear the lines, the topmost row moves down to the 5th row. Due to the bug, however, it is also copied into the 2nd, 3rd and 4th row:
+-+
|          |
|xxxx   x x|
|xxxx   x x|
|xxxx   x x|
|xxxx   x x|
|xxxx xxxxx|
|   xxx    |

Losing

While it seems obvious in normal gameplay, the losing condition is actually not clearly defined for Tetris. In this version, you lose if a tetrimino gets locked in its starting position (regardless of rotation changes) two times. This can become an issue for these kinds of runs which are trying to complete lines as far up as possible, but it hasn't been in this one. Note that when moving tetriminos only the destination position is checked for collisions, not the current position, which means that even if a tetrimino spawns inside other blocks, it can still be moved.

Heart mode

There is a hidden harder game mode which can be accessed by pressing Down + Start at the title screen. It is indicated by a heart symbol next to the level display and increases the effective level by 10, but has no further implications on scores or endings you get. While it seems logical to use it in this run to save time dropping the pieces, I found it to be slower overall: At level "9 Heart", it is not possible to fill the rightmost block in the topmost row by any means due to how fast the tetriminos are dropped, which prevents exploiting the line clear bug to its fullest. Technically, it would be possible at "8 Heart" and lower, but it wouldn't result in the "best ending".

RNG

The game's random number generator is primitive, but effective. It uses the raw value of the DIV counter (a 1-byte hardware clock) for all random events. This means the RNG has exactly 16384 possible states at any given point during the game's execution (256 values with 64 intermediate states each). This comparatively low number has some implications, for example for the initial blocks placed when starting the game at High > 0. Since the process of starting a game is entirely deterministic, there are at most 16384 possible different starting configurations for any given High value (in reality there are even less, since some result in the same board being generated). These starting configurations determine both where blocks are placed and which the initial 3 tetriminos are. This means that where the blocks are placed and which tetriminos you get at the start of the game can only be manipulated very roughly, using one of the few possible board configurations.
Also, most of the time the only way to manipulate luck effectively is by delaying frames, which is why in this run some of the tetriminos are dropped way slower than they could.

Tetrimino selection

At any point in the game the three next tetriminos are determined: the one currently on the board, the one in the preview window and a hidden third one. Whenever a tetrimino is placed, the other two move up a spot and a new tetrimino is randomly chosen to go into the hidden spot.
Due to particularly bad design decisions combined with poor programming, the "random" selection of the new tetrimino is biased depending on the other two tetriminos, though. The developers apparently thought that getting the same tetrimino three times in a row is not perceived as "random", so they made an effort to prevent this, or at least make it more unlikely. If the same tetrimino as the other two is chosen, it is re-rolled, at most 2 times. If it's still the same the third time around, they keep it anyway. Unfortunately, they failed to implement this test properly (they use bitwise or to combine the three tetrimino data values), which triggers the re-roll even in cases where it shouldn't. This skews the probability for each tetrimino type depending on its internal data value:
Tetrimino Data Value Probability (perfect RNG) Probability (Game RNG)
L 0x00 10.3229% 10.5102%
J 0x04 13.6637% 13.7503%
I 0x08 13.6637% 13.8487%
O 0x0c 16.2286% 16.4093%
Z 0x10 13.6637% 13.6401%
S 0x14 16.2286% 15.7913%
T 0x18 16.2286% 16.0501%
(Note that these probabilities assume individual selections to be independent; raw data for Game RNG taken from here)

Strategy

The line clears are made from the 3rd to 6th row, which are the topmost rows that can actually be cleared. Before clearing lines, as many tetriminos as possible are placed in the topmost rows (ideally so that all but one column is entirely filled), both because they need less time to reach their destination that way and to exploit the line clear bug. The empty column can only be the 5th one, since it is the only one that can be reached when the board is filled. This leaves a 4-wide column at the left and a 5-wide column at the right to be filled. On the right side, it may happen that the required number of blocks is not divisible by 4, so it can't be filled perfectly by tetriminos. In this case the "I" tetrimino can be used vertically so that the topmost block is outside the board (it is the only tetrimino which allows that), effectively only placing 3 blocks on the board.
adelikat: Setting to delayed, pending a fix to BizHawk. Also claiming for judging while I'm at it.

adelikat: Replacing the movie file with the 1190 frame version that will sync in a post-bugfix version of BizHawk, setting the emulator version appropriately, and remove the delayed status.

adelikat: Accepting for publication as an improvement to the published movie. Due to viewer feedback, this movie, like its predecessor should be published to the Alternative tier
Guga: Processing...


TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15580
Location: 127.0.0.1
This topic is for the purpose of discussing #4536: MrWint's GB Tetris in 00:19.92
Editor, Expert player (2329)
Joined: 5/15/2007
Posts: 3933
Location: Germany
very nice work. I would still have to read the submission text and maybe I missed it but I think this run doesn't have the heart next to the level display. Does the heart speed not save time?
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Wow, nice improvement
It's hard to look this good. My TAS projects
Skilled player (1741)
Joined: 9/17/2009
Posts: 4981
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Player (12)
Joined: 11/23/2012
Posts: 94
That bug elevates the Game Boy Tetris TAS from "gee, another one of these? I mean, it's fast, but what new does it bring to the table?" to "Wow, that's a cool glitch! This is new and exciting!" It reminds me of the glitch in the 999,999 run of the NES version, only a little more extreme. And the luck manipulation on the final three pieces was awesome! Voted Yes.
Editor
Joined: 11/3/2013
Posts: 506
I think this is would be the most rerecords per second of any run on the site. Of course being mostly botted, it's a bit dubious whether it qualifies.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
thatguy wrote:
most rerecords per second
Rerecords are related to removed input though and second refers to the remaining time, so correlating them like that doesn't make much sense.
Editor, Experienced player (570)
Joined: 11/8/2010
Posts: 4036
That was some well done manipulation, and a cool new glitch. Voting Yes!
Synahel
She/Her
Former player
Joined: 1/19/2011
Posts: 260
Location: France
Very cool!
Skilled player (1040)
Joined: 7/24/2013
Posts: 175
I just realized that the ending of this movie depends on a bug in BizHawk (I filed a report here). I also attached two versions of this run to the bug as examples, both of which are 1-2 frames faster than the submitted movie. This submitted movie should be replaced by one of them. Currently, only the 1191 frame version can be played in BizHawk successfully and avoids the bug by putting an extra empty input frame at the end of the movie. The 1190 frame version is technically the same, but can't be played back in BizHawk due to this bug. The currently submitted 1192 frame version wouldn't work without the bug, though, and should be replaced in any case.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Wow, that bug has gone unnoticed for a long time (possibly the entire life of the emulator). I was able to recreate it in a random movie, the last input counts twice but doesn't even show up in the input display. I guess most of the time in movies, pressing the last frame of input a 2nd time doesn't mess up the movie. Looking into fixing this bug.
It's hard to look this good. My TAS projects
Samtastic
He/Him
Player (154)
Joined: 11/30/2012
Posts: 775
Yes vote. Very entertaining! Well done!
Enjoys speedrunning, playing and TASing Oddworld games! Has TASed: Oddworld: Abe's Oddysee in 12.06.13 (with Dooty) Oddworld: Adventures II in 20.03.78 (with Dooty) Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty) Oddworld: Abe's Oddysee 100% in 1:05:01.65 Oddworld: Abe's Exoddus in 37:18 Oddworld: Abe's Exoddus in 37:15 Oddworld: Abe's Exoddus 100% in 2:!5.44.12 Oddworld: Abe's Oddysee any% in 13:01.3 Oddworld: Abe's Oddysee any% in 12:59.95 Oddworld: Abe's Oddysee 100% in 1:04:16.27 Oddworld: Abe's Oddysee 100% in 1:04:01.07 Currently working on: Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
Player (12)
Joined: 11/23/2012
Posts: 94
creaothceann wrote:
thatguy wrote:
most rerecords per second
Rerecords are related to removed input though and second refers to the remaining time, so correlating them like that doesn't make much sense.
Generally, if the ratio of rerecords to time is low, then either the game is absurdly easy to TAS, or the TAS was made poorly and has almost no optimization. I think there's a rough correspondence between rerecords per second and the difficulty or quality of optimization.
Skilled player (1040)
Joined: 7/24/2013
Posts: 175
That might hold true to some extend for manual re-records where you are working towards a specific goal, but definitely not for automated ones. It may just do endless re-records mindlessly working into the completely wrong direction, and whether it does 1000 or 1000000 re-records doesn't really make the run any more optimized, it just means you threw more CPU time at the problem. The way you approach the run and set up the computation has way more impact on the run's quality, but can't be captured in terms of a re-record number (in fact the re-record count is lower the more efficient your setup is, since less computation is needed to get to the same results). It's more of a geeky statistic at that point without any meaning, and you should probably never judge a run based on this number. I thought about not providing any number at all and treating it as not applicable, since all it does is mislead people. The problem is the re-record count is considered an integral part of a movie, it's impossible to not have one, even though the concept doesn't make sense in some circumstances.
Player (12)
Joined: 11/23/2012
Posts: 94
MrWint wrote:
That might hold true to some extend for manual re-records where you are working towards a specific goal, but definitely not for automated ones. It may just do endless re-records mindlessly working into the completely wrong direction, and whether it does 1000 or 1000000 re-records doesn't really make the run any more optimized, it just means you threw more CPU time at the problem. The way you approach the run and set up the computation has way more impact on the run's quality, but can't be captured in terms of a re-record number (in fact the re-record count is lower the more efficient your setup is, since less computation is needed to get to the same results). It's more of a geeky statistic at that point without any meaning, and you should probably never judge a run based on this number. I thought about not providing any number at all and treating it as not applicable, since all it does is mislead people. The problem is the re-record count is considered an integral part of a movie, it's impossible to not have one, even though the concept doesn't make sense in some circumstances.
That's why I said the correlation is rough. If a newbie submits a TAS, especially one of a game that's been done to death like SMB, the rerecords/second ratio says everything. But when a computer is involved in calculating the input, you're right, the number loses its meaning.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
I fixed the bug in question, BizHawk revision 8760 has the fix. Note: It may be some time before the next official release, but it is safe to assume there will be sync compatibility (for GB at least). Encoders/Publishers, if you need a copy of this build let me know.
It's hard to look this good. My TAS projects
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
On the topic of rerecords. I don't like that MrWint's movies count bot rerecords, and that the statistics page is skewed as a result. But then again, even the movie with the most manual rerecords of all time (SM64 120 stars) has a significant number of bot rerecords. The real problem is the notion of a rerecord was a cute little stat back in the day that has only gotten more meaningless. For instance, you can't compare an editor created movie (such as FCEUX's TASEdtior) to a manual one. The numbers simply don't match in terms of reflecting the amount of effort. As more advance tools develop, I see the number only become more problematic not less. So while I'm tempted to try to fix the rerecord count on this movie before publication, why bother? There's already so many movies that weren't fixed. And what does fixed even mean? At best we would be guessing on the number of non-bot rerecords. And does the bot's work not matter at all?
It's hard to look this good. My TAS projects
Experienced player (704)
Joined: 2/5/2012
Posts: 1798
Location: Brasil
don't change it,bot rerecords are relevant as well.You wouldn't have such optimized input without it.
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.
Joined: 12/29/2007
Posts: 489
Encode please?
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Zowayix wrote:
Encode please?
creaothceann wrote:
tetris_btype_1192.avi
Joined: 12/29/2007
Posts: 489
creaothceann wrote:
Zowayix wrote:
Encode please?
creaothceann wrote:
tetris_btype_1192.avi
Thanks!
Skilled player (1040)
Joined: 7/24/2013
Posts: 175
adelikat wrote:
On the topic of rerecords. I don't like that MrWint's movies count bot rerecords, and that the statistics page is skewed as a result [...] So while I'm tempted to try to fix the rerecord count on this movie before publication, why bother? There's already so many movies that weren't fixed. And what does fixed even mean? At best we would be guessing on the number of non-bot rerecords. And does the bot's work not matter at all?
I can give you the "non-bot" rerecord count, it's 0*. Just like for my previous submissions. Rerecords just don't mean anything, there's no "correct" way to count them, the concept itself is not working anymore. So feel free to change this number to whatever you like or exclude it entirely for this movie (and the other movies as well for that matter), if it helps with your statistics. * I did some manual rerecords at the very end in this case, but only to investigate the bug in BizHawk.
Pika25
He/Him
Joined: 7/18/2011
Posts: 11
forgot to put moons on intended tier?
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Pika25 wrote:
forgot to put moons on intended tier?
Indeed I did. Thanks.
It's hard to look this good. My TAS projects