DEV Community

Chad
Chad

Posted on

Tetris Development #3 - Simple Tetris Game in Godot

Following the tutorial video in my previous post, I have implemented the basic components of the Tetris game.

Here are what the tutorial covered:

  • Game Layers There are two layers of the game, one being the active layer, which contains only the Tetris block that the player is currently possessing, and the other is the board layer, which contains the Tetris board as well as all blocks that have been set in place. The general flow is to instantiate a random block in the active layer, let the player control it until the block can't fall any further, then send that block to the board layer and create a new block in the active layer.

Image description

  • Player Input Movement
    With player input, the currently possessed Tetris block can perform 4 actions: move left, move right, accelerate downwards, as well as rotate. There are also logic checks implemented for each of them, to prevent the block from going out of the game board or overlapping with existing blocks.

  • Next Piece Preview
    Like every Tetris game, there is a preview for the player to see what the upcoming piece is, so that they can strategise accordingly.

  • Score Calculation
    A flat amount is added to the score each time a row is cleared.

Image description

And with that, I now have a functioning Tetris game, albeit simplistic and lacking some features. The next step is to look back at the required features I set for the game in the first development post, and implement those additional features in the game.

What are left?

  • The Ability to Drop the Block Immediately
    I want to implement an action, potentially a quick double-tap on the DOWN arrow key, that allows the player to drop the block immediately. This is needed for player satisfaction so players don't have to wait for the blocks to drop.

  • More Varied Rewards and Tracking
    In the tutorial, clearing a row always grants a flat amount of reward points. I want to implement it so that clearing consecutive rows, or clearing multiple rows at once, are rewarded more, since they require more planning on the player's side. This encourages more tactical playstyles. To do this, I will need some kind of variable to track the player's "combo" at the moment.

A stretch goal for this would be to implement a reward for T-Spin, an advanced technique where the player can spin the T-block into hard-to-reach places. (Here is a video where T-spin is used, at around the 10 seconds mark.)

As you can see from the video, T-spin requires a very specific setup and thus careful planning, which is why I would want to include it in the game to reward highly-skilled players. There are two variations, the double T-spin (spin and clear 2 rows) and the triple T-spin (spin twice and clear 3 rows), and I will have to look more into how I can track these.

  • Simulating Multiplayer by Adding Obstacle Rows
    In a multiplayer Tetris game, if one player receives a lot of points in a short period of time, for example by clearing many rows, the other player will be punished by having a few "zombie" obstacle rows added to the bottom of their board. These rows have random openings in them, so the other player will have to clear those rows strategically. This is a good way to spice up the game and add some element of randomness, so I would want to simulate this effect by adding obstacle rows at random time.

  • More Next Block Indicators
    The tutorial implements one Next Block indicator, which tells the player what is the next block. I want to increase the number to three, so that the player can plan ahead even further. This should be doable by extending the existing functionality.

  • HOLD Functionality
    I want to implement a HOLD functionality to allow the player to hold one block in a HOLD slot. This block can then be used to replace the active block at anytime. This allows the player to strategize which block to use and which to hold. For example, the player may hold a I-block (the long linear block) and then proceed to prepare 4 almost full rows, then take out the I-block from the hold slot and get 4 rows cleared at once. This is also to make the game more fun and encourage strategic planning.

So these are some of the next features I intend to implement in the Tetris game. During this post's development, I have also setup source control using Git, just for good practice. With that, it is time to push these updates to GitHub and work on the above features!

Top comments (0)