---
title: Volumetric tetris
description: General educational game in the broad meaning of this word. In the process of learning programming languages, it is recommended to write your own version...
sections: [Logical game,Experimental interface]
tags: [javascript,online,canvas,game,classic,puzzle,geometry,matrix,graphics,square,cube,3d,three-dimensional]
scripts: [/js/classes-point-cube.js,/js/tetris-figures.js,/js/tetris-model.js,/js/tetris-controller.js,/js/tetris-view.js]
styles: [/css/pomodoro1.css]
canonical_url: /en/2023/01/22/volumetric-tetris.html
url_translated: /ru/2023/01/21/volumetric-tetris.html
title_translated: Объёмный тетрис
date: 2023.01.22
lang: en
---
General educational game in the broad meaning of this word. In the process of learning programming languages,
it is recommended to write your own version first and then use it for demonstrating and testing another
software or hardware. The three-dimensional interface is written in JavaScript Canvas — the logic of the
game itself is two-dimensional. Additional external libraries are not used.
Description of graphics algorithm: [Spinning cube in space]({{ '/en/2023/01/11/spinning-cube-in-space.html' | relative_url }}).
{% include heading.html text="Experimental interface" hash="experimental-interface" %}
Turned off by default — you can just play Tetris. In addition to the two-dimensional version, two volumetric variants
are added — *parallel projection* and *perspective projection* — parameters for each of them can be changed.
For perspective projection: you can change the position of the observer screen and the remoteness of the
projection source. The observer looks at the center of the image, and the center of the projection is remote
at a distance, comparable to the size of the playing field. For parallel projection: you can change the
vertical position. For both projections: you can rotate the playing field along all three axes. The central
point for rotations — is the central lower far point of the field. For all variants of the image: the size
of the cube — 32, the size of the square — 30 and the indent — 2. The origin of coordinates is located at
the upper left point, the axes are directed: `X` to the right, `Y` downwards and `Z` to the distance.
Testing: start the game, collect a certain number of figures on the field, pause the game, and
then switch the variants of the three-dimensional image, rotate the field with figures, change the
transparency, move the central point and so on.
Controls: keyboard buttons with arrows — right, left, up, down and the button `pause`.
{% include volumetric-tetris-en.html -%}
{% include heading.html text="Gaming process" hash="gaming-process" %}
Game points are awarded for fully collected rows of the elements of the figures. The number of points scored
depends on the number of rows collected, 10 points for each row if there are 10 cubes in a row, and multiply
increases, if collected at the same time: 2 lines — by 3 times, 3 lines — by 5 times, 4 lines — by 10 times.
Game feature: the collected lines first blink and then disappear — meanwhile the
gaming process is not suspended for this time — the current figure continues to fall.
Level increases when collecting 10 completed rows, that is 100 points, if there are 10 cubes in a row. At each
new level, the speed of the figures increases and reaches a maximum at level 21. In snail mode, the speed increase
becomes slower 5 times, and the speed of the figures reaches a maximum at level 104. The current speed is displayed
above the playing field as a `meter` indicator.