(Link to video)

Tetris 2 (Game Description by Moby)

Unlike the original Tetris, Tetris 2 has you clearing the field of blocks in a different way. Each play field starts with different colored dots (in this case red, blue and yellow), with one of each color flashing. The blocks are made up of the same three colors, and by matching blocks of the same color over the top or to the side of the dot will clear the dot and those blocks from the screen. If you clear a flashing dot, all the corresponding dots of the same color will be cleared. To complete the round just clear the dots, not the blocks themselves.

Tools Used

  • Bizhawk 2.5.2
  • Nametable Viewer (Identification of blocks on the playing area)
  • Lua (BOT written to manage the RNG controlling inputs)

Approach to TASing

In July 2019, I started manually TASing Tetris 2. After about 5 months and starting over multiple times, I realized that the level of optimization was nowhere near the level that I knew could be. During Thanksgiving, of the same year, I decide to BOT this game. After one week of writing, I got the first version of this BOT working and automating this painfully slow process. On Dec 2nd 2019, my life got a lot easier and way more exciting...as the BOT was finally being used. It didn't take long before I started seeing incredible cuts. Over the next few months, the BOT was rewritten for a number of reasons. Of those reasons...efficiency, accurracy, and increased functionality were necessary in order to make this TAS optimized to the fullest of my understanding. In the end, my BOT went through 4 more iterations to end up providing me everything that I needed.

RNG Manipulation

Before I present the BOTing effort, it is important to understand how RNG works in this game. RNG is controlled by any input that is received before the board is cleared out. These include Left, Right, Down, A, and B. Notice that Up is not included, as it doesn't affect anything on the screen. Now, once the last flashing block starts to explode, you no longer can make any inputs to affect RNG...except for Left. So from my analaysis, you can only affect RNG up to 44 frames after the last block connects. The second RNG that you can control, is a delay when pressing "Start" at the beginning of each round. This only affects the drop provided. For any subsequential drop, you can alter it by pressing "Start" to pause (when it shows for one frame on the screen), only to unpause to get your new piece. The delay between the two presses will control the piece you get. Another way to change the drop, with this method, is to make input presses...which will further manipulate the drop seen on unpause.

Re-record Count Explanation

As you have guessed, this TAS was BOTed and the only reason why the re-record count is so high. But this was not done on a single instance; however, the total was derived mathematically...according to the inputs applied. I want to make sure all my information is correct, so I calculated these to reflect the inputs that were applied to get the results that I was looking for. Anything past that, was ignored. So the count is extremely conservative, yet very reflective of the work done in order to produce this movie.

BOT functionality (List of notable functions that were used to help produce this movie)

  • Template Designing: Used to produce and save RNG altering inputs. Basically, I made use of TASStudio to help me design the inputs that were feasible for a given round that had already been solved. By storing the original inputs over to the Player 2 side, the difference between "Solving" and "RNG" inputs could be determined for resetting inputs for continued testing.
  • Input Reproduction: The BOT is fitted with a number of functions that apply the inputs, from these templates, in a binary application. Whether it was done manually or automated, this was the most time consuming part of the entire TAS.
  • Pattern Detection: A lengthy routine was written to check for specific layouts that would allow for fast solving. As it turned out, a number of checks were needed to determine if the pattern fell within my search criteria. For one, the layout of flashing blocks needed to be in an arrangement that allowed for the quickest solves. Another determination, on any good pattern, was to check if the blocks were locked from good solving drops. There was a high percentage of patterns that had good flashing block layouts, but were blocked from making a fast solve. Coding out a "Wall-Follower" routine, eliminated a ton of these unusable patterns and allowed the BOT to continue on finding anything that required my attention.
  • Pattern Storage: An external file was built as a storage area to provide information for the BOT to ignore occurances of unwanted patterns. Basically, once I had established a best attempt with a pattern, other patterns would often show up from time to time that would out perform my attempts, up to that point. When this would occur, I didn't want the BOT to pull up obsoleted patterns again...so it was fitted with an exclusion routine to prevent it from showing up again on future detections.
  • Starting Point: Sometimes problems occurred, deep within RNG application, that would force me to stop and restart. Instead of running the BOT through the tested inputs again, I wrote a routine to determine where it left off. Of course, this would only work if the project file was being saved (which was done after the clearing of Left/Right inputs).
  • Key Commands: Set up, storage, initiation, and exclusion commands were fixed for easy and quick access to keep the BOT running with little interaction.

Multiple Instances

As I learned more and more about RNG, I discovered ways to delegate the work so that I could find patterns faster. After having purchased a new machine to handle even more processing, I ended up running 16 instances...which were identifed by certain inputs. Below is a list of terminology that I used to denote what inputs applied for use:

Templated Inputs

  • Left/Right Inputs: these were the least siginificant input. This would be the equivalent of bit 0 of the binary application of these templated inputs.
  • A/B Inputs: A and B rotate the pieces. If I apply one, I have to have the other to balance out the solve so that it would continue on uninterrupted. This would be the equivalent of bit 1 of the binary applications of these templated inputs.
  • Down Inputs: The input that is used to speed up the fall of a piece. This is the least destructive input, yet provides even more help in combination with the previous mentioned inputs. This is the equivalent of bit 2 of the binary application of these templated inputs.

Instance Identifying Inputs

To help differentiate each instance running, inputs were added at the bottom of each solve...which would be separated by a number of frame from the "Templated Inputs". This made it possible to have patterns show up, that wouldn't show up in other instances. For example, Instance A would not have any extra inputs at the end; however, Instance B would have either a "A" or "B" to start off with at the last frame of input. For the 16th instance, there would 15 alternating A/B inputs at the end.

Cycling Inputs

After the last input of a round can be made, only "Left" can made further changes. Since this was not a normal situation, it was used to boost the RNG even further...providing a substantial range of combinations to apply. This would be the equivalent of Bit 3...for a total of 4 bits of binary application.

Round 34

I had a concept to only use one drop for sovling each round. Well, that hope ended around 34...where I left a long delay to gain access to a drop that would do so. Starting with Round 35, things started looking better again for a long time. Eventually, this situation would vanish from ever being seen again. Well after 34, I found the second fastest pattern and drops that would keep my run maintaining high optimization. By this time, months has already gone by and it was very painful to think of redoing again for about 100 frames lost.

Special Thanks

  • DrD2k9 for the talks on how to speed this up. Basically, he helped me to understand my CPU...which was a 4 core processor, at the time. When I bought it in 2011...I didn't fully understand what I had bought. Now that I do, he opened up my understand with a term called "Affinity". After designating a core for each instance (2 threads for bizhawk), I noticed the speed increased slightly by about 10 to 15 frames each.
  • Worsel for talking me into buying a new machine, that we called the "Beast". This new machine helped me to run 16 instances and speed through finding these patterns much faster. It was purchased in March of 2020 and used all the way through to October 23, 2021. For those of you who are wanting to know...it was bought from NZXT and contains a water cooled Ryzen 3950X, which has a base clock speed of 3.5 GHz. Instead of overclocking it, I did some tweaks to pull it up to about 4 Ghz, which ended up giving me about 170 to 180 fps.
  • feos for options on how to speed this up as well...even though his idea didn't pan out, it was worth a try.
  • Nach...yes Nach! Sometimes those posts in our forums actually influence others to buy needed equipment. So yes Nach, I did break down to buy a good UPS, which kept my BOT running during multiple power outages. There is no telling how much time this saved. Maybe around 15 days of being down without knowing.

feos: Judging...
feos: I can't really say much about this run other than that it's well really executed, and score counting is painful to watch. Accepting to Standard.
I recommend linking the scoreless encode in the publication description.
Zinfidel: Processing...
feos: Fixed rerecord count in the movie to only contain manual rerecords. Was 63966740 originally.

TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 14873
Location: 127.0.0.1
This topic is for the purpose of discussing #7237: nymx's NES Tetris 2 in 37:35.82
Experienced player (852)
Joined: 11/15/2010
Posts: 267
Nice to see the RNG get crushed, and the movement is crazy. Unfortunate that some much of the time is spent counting the score between stages. Definitely a yes from me
nymx
He/Him
Editor, Judge, Skilled player (1638)
Joined: 11/14/2014
Posts: 810
Location: South Pole, True Land Down Under
link_7777 wrote:
Unfortunate that some much of the time is spent counting the score between stages.
Hmmm...you just reminded me of something that I failed to mention in the submission. Bonus values above 32000 can not be accelerated by holding "A". Only when it drop below, will it speed through the bonus. I never could understand the reason the game did this, so it contributed to an enormous amount of time. I predicted that this TAS would finish less than 20 minutes, until that problem showed up.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Editor, Skilled player (1938)
Joined: 6/15/2005
Posts: 3246
Here's a very quick encode I made (720p60) with all bonus scenes from Round 3~79 cut. This reduces the encode to less than 15 minutes! Also I included an input display in the bottom right corner. Link to video
nymx
He/Him
Editor, Judge, Skilled player (1638)
Joined: 11/14/2014
Posts: 810
Location: South Pole, True Land Down Under
FractalFusion wrote:
Here's a very quick encode I made (720p60) with all bonus scenes from Round 3~79 cut.
Thanks. This makes it more fun to watch. I only wish there was some way to truly eliminate the bonus time from the full submission.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Judge, Skilled player (1288)
Joined: 9/12/2016
Posts: 1645
Location: Italy
nymx wrote:
Bonus values above 32000 can not be accelerated by holding "A". Only when it drop below, will it speed through the bonus. I never could understand the reason the game did this, so it contributed to an enormous amount of time. I predicted that this TAS would finish less than 20 minutes, until that problem showed up.
Have you already tried figuring out what's happening in debug?
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"
nymx
He/Him
Editor, Judge, Skilled player (1638)
Joined: 11/14/2014
Posts: 810
Location: South Pole, True Land Down Under
ThunderAxe31 wrote:
nymx wrote:
Bonus values above 32000 can not be accelerated by holding "A". Only when it drop below, will it speed through the bonus. I never could understand the reason the game did this, so it contributed to an enormous amount of time. I predicted that this TAS would finish less than 20 minutes, until that problem showed up.
Have you already tried figuring out what's happening in debug?
No, that was so long ago. I started looking at debugging other games...maybe a year ago? But never with this one.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
nymx
He/Him
Editor, Judge, Skilled player (1638)
Joined: 11/14/2014
Posts: 810
Location: South Pole, True Land Down Under
One more thing...I find it curious that it happens right above the value 32768...which if you are at 33,000 it will count down to 32700 before speeding up. So, it appears that a 16 bit signed value is being played with...which means that it could be seeing "0" and not applying the acceleration. I guess the makers never thought that someone would clear a screen that fast.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11268
Location: RU
If there's no manual TASing in this movie, we will have to nuke the rerecord count. We do that for botted rerecords so it doesn't mess with statistics on manual ones on the site.
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.
nymx
He/Him
Editor, Judge, Skilled player (1638)
Joined: 11/14/2014
Posts: 810
Location: South Pole, True Land Down Under
feos wrote:
If there's no manual TASing in this movie, we will have to nuke the rerecord count. We do that for botted rerecords so it doesn't mess with statistics on manual ones on the site.
The only manual inputs come from two different efforts. 1. The first round was manipulated manually with a different method before it was visible. 2. The "Solving" inputs were made manually, upon finding a desirable pattern. So the only BOTing occurred to get different patterns to show upon the next round, by injecting D/ Right-Left/ A-B inputs alongside of the "Solving" inputs.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11268
Location: RU
Do you know what the manual-only rerecord count is, even approximately?
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.
nymx
He/Him
Editor, Judge, Skilled player (1638)
Joined: 11/14/2014
Posts: 810
Location: South Pole, True Land Down Under
feos wrote:
Do you know what the manual-only rerecord count is, even approximately?
I had to think about this and I finally figured out an exact number! I have a ton of backup files and I found the last BK2 before I started running the BOT. It has 109678 re-records in it. So, if you add 6472, which is the amount of work done to create the "Template" inputs, you would get: 116150 re-records. This includes 3 "run-throughs" (after discovering more each effort on optimizing this game) and all the RNG input creations for the templates needed for the BOT. Thankfully, I kept good notes and retained all of my project backup files.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 14873
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. ---- [4547] NES Tetris 2 by nymx in 37:35.82