Real Redstone: Working TETRIS prototype – Command Block animation
A builder doing redstone – I have truly gone off the hook. Finally, here’s something proper for the Redstone category on this blog. Bonus points if you recognized the source of inspiration for my build: Spoiler, it’s the Berlin Block Tetris animation by Sergej Hein, boasting 5M views across 14 years here.
The Command blocks
In short, I followed the method best showcased by Grian in his Build Animation video. Each frame of the animation has this command block in the corner, which selects the corners of the frame area (the first 2 sets of co-ordinates) and tells it where to get pasted (at the main tower, the last set of co-ordinates):
/clone ~-12 ~50 ~35 ~-2 ~ ~1 2 -15 -76
All frames are hooked up to a trigger; One command block at the animation viewing platform sets a redstone block at the start of the mechanism. This 1) Starts the animation and 2) Activates a secondary command block which sets the redstone block instantly to stone, making the animation run once.
Animation Test log
Multiple failed tests led to the final result:
Test 1: Kept backups before each test for safety + for resets to clean slate + set game simulation distance to 30 chunks
All redstone needs to be within the simulation distance to work, meaning that if I want to expand this animation I will need to stack the frames I build into rows and columns to be within distance. The animation doesn’t reset itself so I have a “clean state” backup of the world on me before each test.
Test 2: Flipped X and Z coords + made X negative
Animation was totally broken and cut off. It turns out that I put the X and Z co-ordinates in the wrong place in the command blocks, so it was selecting a completely different, broken area for copying.
Test 3: Corrected position of final cloned copy + added repeater for third row
The animation now plays the right parts in the right order. However, it stops halfway through – turns out I had forgotten to add a needed repeated before the first command block on the third row of frames.
Test 4: Corrected pos + slowed down animation time
When I left the perfect viewing angle and flew closer to the animation, it turned out that the whole thing was pasting in the air behind the building, instead of on top. Fixed co-ordinates to be on the right side. I also made every repeated slower, which made the animation somewhat less laggy and watchable.
Test 5: Corrected pos + corrected copied area front + turned down graphic settings (didn't help lag?)
Fixed co-ordinates a second time by moving animation pasting by one block. This made me see another major issue – the frame area I was selecting was one block too small, cutting off the front of each frame.
Test 6: Corrected pos (+ is height ok or just lag?) + fixed clean slate tower
In the previous test I fixed the co-ordinates, but they broke again due to me changing the selected area while fixing the second issue. Also, I thought the animation was being cut off at the top, but this was just lag that disappeared when I flew closer. Lastly, the backups I was keeping throughout testing had some leftover blocks from bad frame pasting on the main tower, so I cleaned it up before the final backup.
After that, SUCCESS! I had a working prototype. It was lagging in-game (glitchy when trying to watch in real time), but a Replay Mod video of the final animation showed all frames working correctly.
Plans and Optimizing
As far as I can see, the method I used to make this animation is inefficient and basic. Thank you to thederdiscohund from the Minecraft Commands Reddit for providing useful information for the future:
- “Don’t put your commands into command blocks when you could instead put them in functions, and when you need things to repeat, have a function schedule itself and use a scoreboard counter to control how many times it repeats.” [For repeated commands in each frame]
- “One thing I did some experiments with in the past is to use structure blocks that have different structures saved, where the difference between the structures is just a number, and then use a scoreboard counter in the structure name when loading the structures, so it looks like it’s animating between the frames as the score counts up. [Link downloads a video preview]
- [Since the function file is off-world wouldn’t I need to input separate co-ords for each command to link to each separate frame of the animation?] “If you want a command to be anchored to a position, you can execute it at a marker entity, and move that entity around. Because you can use relative teleportation, you don’t need to enter the positions manually.”
Also, Mince_rafter provided these ideas: “Converting the pieces to block display entities and using teleport to move them should speed it up significantly. When the piece lands it can kill all of the display entities and set the blocks in their place. You also wouldn’t need the pieces to physically exist in the world, just commands or function files that summon them in when needed.
I made my own version of tetris based on the gameboy version, and with that I just used a bunch of premade maps and modified the data of item frames on a board to change as the pieces move. Never ended up finishing the whole thing but it ran very smoothly. Overall there are multiple ways you can approach the setup depending on what you want.”
This build will be releasing public once done! There is a WIP preview download on Patreon. The full Berlin Block Tetris animation is around 20x longer than my progress here, so there’s plenty of potential.
Lastly, unfortunately my method of copy-pasting an animation isn’t really valid way to create a working game of Tetris. Check YouTube for some command block magicians who made controllable Tetris games.