Geek Culture
Published in

Geek Culture

Launching 619 thousand Tetris on GPU, their rendering, and a simple bot

GLSL Auto Tetris

The idea:

Download or Launch links:

Hardware requirement:

What is it:

Because this project is one of my first shaders, I can point these two mistakes:

Tetris board saved in bits:

Visually (debug frame), three pixels are highlighted in red, this is one saved Tetris board.

Why do we need action IDs:

Slow place:

Debug screenshot with only data-saving logic.

Storage Algorithm Performance:

The logic of bot that also checks free blocks, default bot does not do that, read below.

Bot/AI logic:

Default bot logic:

My bot logic works like this:

Pseudocode:

loop ( 4 rotation of current block )
{
loop ( by width of table is 10 )
{
IF ( block_can_be_moved_here )
{
IF ( current_block_height and position
less than the previous one )
THEN we remember best block_ID and best_POS
}
}
}
function block_can_be_moved_here
{
check in the loop(size of block)
that all elements of the map(tetris board)
are 0 where the elements of block are 1
}

Interface / UI rendering

Image shader line 280

To avoid pixelation when scrolling:

UI numbers:

Launching and Advanced options:

Control in all versions:

To launch Web version on the Shadertoy:

To launch Binary version:

This version has special options:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store