Tool-assisted game movies
When human skills are just not enough

Submission #6635: Spikestuff's NES Tengen Tetris "30 lines" in 00:23.55

Console: Nintendo Entertainment System
Game name: Tengen Tetris
Game version: USA
ROM filename: Tetris (USA) (Unl).nes
Branch: 30 lines
Emulator: BizHawk 2.4
Movie length: 00:23.55
FrameCount: 1415
Re-record count: 3137
Author's real name: Adam Stamatakos
Author's nickname: Spikestuff
Submitter: TASVideoAgent
Submitted at: 2020-02-23 13:31:31
Text last edited at: 2020-08-01 14:20:25
Text last edited by: Spikestuff
Download: Download (2086 bytes)
Status: published
Click to view the actual publication
Submission instructions
Discuss this submission (also rating / voting)
List all submissions by this submitter
List pages on this site that refer to this submission
View submission text history
Back to the submission list
Author's comments and explanations:

(Link to video)


Not too much here to say about the game, it is the unofficially released Tengen Tetris, well known for its superiority to the official Nintendo Tetris. Tengen Tetris has 2-player versus AND cooperative modes, as well as versus or co-op with the Computer, plus more music options, a more entertaining Russian motif, and better level/garbage options. The gameplay itself is pretty identical, with only 1 preview piece, no hold queue or hard drop, etc.

After Fraplatek’s submissions of this game, attempting to obsolete PikachuMan’s 2014 movie, Spikestuff took to making a properly optimized movie. I don’t mean to be rude to Fraplatek, but, well, he got 6 singles, so, yeah. I expressed interest and Spikestuff offered me to help him with a good attempt he got stuck on. I ended up being into the idea of trying a different RNG entirely, which turned into writing an extra-next-pieces Lua script, and thoroughly documenting as many RNG options as I could.

Before continuing to run details, here’s the Lua script, mostly designed by Spikestuff and mostly coded by me. Instead of trying to disassemble the RNG to simulate what the next pieces will be, I took a brute force approach that just places 80 blocks to record what they are.

I should mention that the run uses a cheat to increase the level to 17, the maximum. There’s also a cheat to change your current piece to an I-block, and to remove your last placed block, which aren’t used. Also, 1 frame was purposely delayed to select a music track instead of the default Silence, for entertainment.

The run

For TASing, the major difference in Tengen Tetris is that it has a fixed piece order once you begin the game. That means that there isn’t really a way to have a truly perfect game. You have to play every piece dealt to you.

With the fixed piece order system, it is impossible to say that the RNG I’ve used here is the best possible. I only tried maybe 4 or 5 RNG options, actually. But, I did find over 40 that would cost 0 or 1 frame (this is a 0 frame one), and would say with near certainty that all of those RNG options I found are worse than this one. If you expanded your search to 2 or 3 frame delays, there are likely hundreds of potential options, as the starting RNG seems to be cycle-based, so different input patterns during the menus can give different results (and there’s a LOT of possible input patterns, when you include delaying the Start inputs, and doing Up/Down).

This .tasproj has branches for the RNGs I found

The branch names are the RNG values, which are RAM address 005C/005D. This appears to be seeded from 0034/0035. Here's a RAM watch

I’m not an expert on optimizing Tetris for speed by any means, but the main ways to save time in this game are obvious: Minimize the total number of pieces dropped. Minimize line clear animations. Minimize vertical piece travel. Minimize horizontal piece travel. Here’s how this run minimizes these 4 areas.

Minimize pieces dropped

In “30 lines”, you’ll need 300 chunks to clear that many lines. That would mean 75 pieces dropped. However, thanks to the starting garbage, this can be reduced. This run uses 3 garbage lines that spawned with 9 chunks. So, that’s 27 free chunks; 6.75 pieces saved!

But, due to very limited piece options near the end (ZOIOIZIZOOI), my board had 11 chunks leftover that I had placed there, including a Z piece that I literally did not need and just placed ASAP. So, 27-11 = 16 chunks, and 4 pieces saved, essentially. And indeed, this run places 71 pieces.

This is where almost all RNG options immediately fail in my eyes, because most garbage options are… garbage. This garbage layout is especially fantastic because clearing the 2nd and 3rd garbage lines only takes 1 piece:

That easy 3 garbage lines is why I prioritized trying this RNG, and luckily, it was able to fulfill the other time saves fantastically as well. There was another similar single-then-double layout I tested, but it ran into a 20-piece drought of I’s which really killed its effectiveness.

Most garbage layouts have multiple gaps that don’t line up, like this… But, if you were to find a layout that has perhaps, a 3-deep 1-block gap, that would have serious potential to be faster than this run.

Minimize line clear animations

A line clear animation is 28 frames, no matter how many lines you clear. This means 30 singles would lose 560 frames compared to 10 triples. That’s no good, and this is a main thing that the current movie does not optimize very well.

The bare minimum that you’d need for 30 lines is 8 line clears; either 7 Tetrises and a Double, or 6 Tetrises and 2 Triples. This run ended up with 9 line clears; 6 Tetrises and one of each of the others. The time a piece takes to drop varies of course based on horizontal and vertical travel needed, but tends to take 15-25 frames each. So, if reducing the line clears to 8 would take more than 1 extra piece drop, it isn’t worth it. In this run’s case, I had to build so close to the top that my placement options were too limited, and I had to place an extra chunk on the 2-deep garbage column, which I had to clear off with a Single.

And of course, having a piece order that would allow you to even have an option for only 8 line clears is rare. I’m assuming it exists, but I would bet that it would require more than 72 piece drops, so I’m not sure if it’d be faster...

Minimize vertical piece travel

Put simply, play close to the top. Of course, survival is the main concern, so there’s limited options for purposely optimizing this beyond “objective: survive”. There was a point where I could have done a back-to-back Tetris combo with two consecutive I’s, but I placed the second one instead and waited it out; that’s the extent that one can do.

I do not know how well different RNG options can be tested for “play close to the toppability” aside from playing through them by hand, but the one here has some insanely close calls; three times, I only had a 4 chunk leeway before the I-piece finally came. But to come that close without dying is exactly what this run asks for.

The length of the I-piece droughts in this run; a 16-piece drought at the start and a 15-piece drought in the middle; were just perfect for being able to reach the top without having to bail out with a weak L/J triple. 20+ long droughts are fairly common in RNG options, and, considering that you only have 8 rows to work with (9 if you clear a garbage line), and you have to leave one column open, having 80 straight chunks you can’t make Tetrises with is not a plan for success.

Minimize horizontal piece travel

This one’s probably the least important, as the board has to get filled up regardless, but still something I tried to keep in mind. Being a 10-wide playfield, 3-wide pieces can’t be in the center of the playfield; they have to be one slot to the left or right of it. Generally, the pieces spawn right of center, except for O-block, which is exactly in the center. So, it could save L presses to try to put O-blocks on the left, for example. And also, something like an I-block takes more presses to reach the rightmost position it can be in, than an L or J jutting rightward.

Survivability is far more important than this, but you can see in the run that I do tend to put O-blocks on the left generally. I feel like horizontal travel is the most likely place someone could possibly shave frames off this RNG option. I did try a few mass rebuilds of the board, but they were either slower or died from bad gaps.

EDIT: This point of optimization has become more interesting thanks to figuring out the ability to clip leftward using rotations. Basically, when you rotate a piece, if its new position would collide with another piece, it tries shifting the piece leftward, and if that position has no collisions, it allows it. All of the rotations (except I-piece) are pushed as far up and left as they can be. This rotation chart from the Tetris Wiki can help understand how to get them.

For example, in this case, the rotation would be wedged inside another piece, but it can be shifted leftward without issue:

I do not believe there's a way to ever get clipped rightward. As an example, this I-piece cannot rotate to reach the right gaps; it's blocked by the O-block, both where it wants to go, and one column to the left. (This was an attempt to re-build the board that didn't work out because of this...)

Possible time saves

Using more garbage lines could further lower the number of pieces placed. The garbage in this RNG has a fourth row that could be cleared somewhat easily, but digging to it early would greatly increase vertical movement and increase number of line clears, so I don’t believe it’s a time saver for this RNG.

An elusive 8 line clears run would have a free 28 frames saved, but at what expense?

The end-of-input could be optimized by having a board setup that allows more than just the last piece to be placed after input end, like leaving an unrotated T-shaped gap in the middle of the board to get a last double.

And as I’m not a Tetris Grandmaster, I can’t visualize every possible board setup, so there could be a faster way to implement this RNG...


Well, I’ve never thought myself up to the challenge of Tetris TASing, but here I am. I feel a bit weird to submit this despite trying so few options, but, I did find every 0/1-frame delay RNG I could, targeted this one for its great garbage, and it happened to be usable and deliver insanely on staying close to the top. I thought it would take longer to find such a result…

I cannot say with 100% certainty this is an optimized time, but it’s certainly much closer than the 2014 movie was. I am extremely happy with how the run turned out, and if someone can find a timesave, be my guest, cause I can’t! I don’t even know how to T-spin!

Thank you to Spikestuff for the base, inspiration and assistance with the run. Also, he’s provided extended input for Game Over + Name Entry. Here’s a bk2 that includes those. Wait he’s probably going to claim this for encoding anyway or wait is that against the rules if you’re an author

I have four TASes currently awaiting judgement right now! With a total length of like 15 minutes! Wow I’ve been both busy and also it’s not really that impressive at all

Spikestuff’s comments

I did something. This was the something.

feos: Replacing with a 28 frame improvement.

Maru: Judging.

Maru: This is a good improvement over the published run. You have done well with the research put into the game. Feedback was solid enough. Accepting to Moons tier.

feos: Pub.

Similar submissions (by title and categories where applicable):