Project Specifications - npincomplete/tetris GitHub Wiki

Tetrominos

Shapes and Colors

There are 7 tetrominos of various shapes and colors. Shapes are labeled according to the letter in the Latin alphabet to which they most closely resemble. Colors are based on historical assignments.

  • Cyan I
  • Yellow O
  • Purple T
  • Green S
  • Red Z
  • Blue J
  • Orange L

Starting Positions

  • The I and O spawn in the middle columns
  • The rest spawn in the left-middle columns
  • The tetrominoes spawn horizontally and with their flat side pointed down.
  • Tetrominos in their starting positions have their bottoms aligned to the second row

Gameplay

The playfield is initially empty when the game starts and fills up as the game progresses and lines are not cleared. Eventually, when enough lines are not cleared, the player tops out. To prevent topping out, the player may drop pieces, rotate pieces, or shift pieces, as well as use various gameplay mechanics, in an attempt to create a strategy that clears more lines.

Playfield

The playfield is 10 cells wide and at least 22 cells tall, where rows above 20 are hidden or obstructed by the field frame. These rows are known as the vanish zone.

Clearing Lines

One line is cleared when every cell in the same set of contiguous horizontal cells in the grid is filled with a part of a tetromino.

Loss Condition

As the game progresses, a player will eventually tops out, or lose the game. A top out can happen in any of the following ways:

  • Block out - a piece is spawned overlapping at least one block in the playfield
  • Lock out - a piece locks when it is entirely in the vanish zone above the ceiling

Drop Behaviors

Drop refers to downward motion of each tetromino. The downward motion is continuous. Gravity can be thought of as an automatic drop. It moves a tetromino downward into the playfield at a regular rate, which may change depending on the difficulty level. Gravity is expressed in unit G, where 1G = 1 cell per frame, and 0.1G = 1 cell per 10 frames. A frame is the amount of time that must elapse before a piece moves between blocks.

There are two primary drop behaviors:

  • Soft drop – A temporary increase in gravity, at a rate of double the current gravity
  • Hard drop – A piece lands, gravity is increased to its maximum value, 20 G

Pieces dropped with a soft drop are not dropped immediately. This means that the sole purpose of doing a soft drop is to temporarily increase gravity. Pieces dropped with a hard drop are locked immediately.

Piece Rotation

Pieces may rotate in a clockwise or counterclockwise direction.

All tetrominoes exist inside a bounding square and rotate about the center of this square unless obstructed. Tetrominoes of width 3 (J, L, S, T, Z) are placed in the top two rows of the bounding square and (for J, L, and T) with the flat side down. I is placed in the top middle row.

All tetrominoes spawn in 2 usually hidden rows at the top of the playfield. They are placed in the center of these rows, rounding to the left.

Once a tetromino lands, it does not lock until the lock delay expires. The lock delay behavior resets whenever the tetromino is moved or rotated.

SRS Example

Shifting Pieces

The game will shift the falling piece sideways, wait, and then shift it repeatedly if the player continues to hold the key. Delayed Auto Shift refers to the behavior of most falling block puzzle games when the player holds the left or right key.

Timings

  • Delayed auto shift: 10 blocks / second
  • Initial drop: 1 G
  • Lock delay: 500 ms
  • Entry delay: 0 ms

Input and Output

Gameplay Statistics

  • Lines cleared
  • Score from lines cleared
  • Level

Keyboard Control

  • Spacebar: Drop the piece, non-locking
  • Up arrow: Rotate piece
  • Down arrow: Move piece downward, non-locking
  • Left and right: move piece left and right
  • H key: hold the piece
  • P key: pause game

Game Mechanics

Hold Piece

The player can press a button to send the falling tetromino to the hold box, and any tetromino that had been in the hold box moves to the top of the screen and begins falling. If no tetromino is in the hold box, the next piece is chosen from the bag. Hold cannot be used again until after the piece locks down.

Next Piece

Each piece has an equal probability of being picked next.

Ghost Piece

The ghost piece is a representation of where a tetromino or other piece will land if allowed to drop into the playfield. It is generally colored fainter than the falling piece and the blocks in the playfield. As the player moves the falling piece, the ghost piece moves below it; when the piece falls far enough that it overlaps the ghost piece, the falling piece is always drawn in front.

Monolithic Square Pieces

A 4x4 block square made out of four tetrominoes becomes a monolithic square of the same size. A square is entirely within the playfield. If things are projecting out of a 4x4 block region, it is not a square. If it has a hole in it, it is not a square. If it contains blocks that form part of a tetromino or square that was partially removed, it is not a square.

There are two types of squares:

  • Gold monosquare - A 4x4 block square made out of four identical tetrominoes
  • Silver multisquare - Any other 4x4 block square made out of four tetrominoes.

Scoring and Levels

Scoring

Apply as many of the following rules for the scoring as possible when lines are cleared:

  • 1 point per line cleared
  • 1 bonus point if four lines cleared simultaneously (tetris)
  • 5 points when a 1×4 strip of silver square is cleared
  • 10 points when a 1×4 strip of gold square is cleared

There is no instant reward for spins or for completing a 4x4 square

For example, a tetris with all four lines of a silver square is worth 25 points (4 + 1 + 5 * 4), and a tetris with all four lines of a gold square is worth 45 points (4 + 1 + 10 * 4). The greatest possible reward for a single move is therefore 85. The total of 85 is made up of:

  • 4 from the four lines cleared
  • 1 as four were cleared simultaneously
  • 10 × 8 = 80 as eight 1×4 strips of gold are cleared

Levels

A level is synonymous for level of difficulty. The level of difficulty is determined by the score. This is the only way to level up. Difficulty is determined by the speed at which a piece drops to its next position (gravity). Gravity should change as a logarithmic function of the score. This means that as a player approaches a next level, the gravity is already changing before the next level is actually reached.

Game Modes

The game modes are:

  • Marathon – game continues indefinitely (or until only one player remains in multiplayer)
  • Ultra – a race to 150 lines
  • Sprint – a three minute countdown

Branding and Artwork

Extra Credit

  • Death game mode with immediate lock
  • Multiplayer mode in a P2P sense without a central server
  • Garbage build up against multiple players ** Directed – each player can choose the recipient of his or her garbage by using the left and right C buttons ** Hot potato – one player is outlined in red and receives all garbage. When this player completes a line the hot potato moves to a random player (which could be the same one)
  • Addition of alternative polyominos
  • Spin moves (also known as twists)
  • Minimum 4k graphics. Rivaling even Skyrim mods.

Technology Choices

  • Platform: Windows desktop
  • Programming language: C# using .NET Framework 4.5.2
  • Graphics back-end: OpenGL (using OpenTK)
  • UI toolkit: WPF + XAML
  • IDE: Your choice, as long as it can work with Visual Studio projects, compile and debug C# code
  • VCS: Git (either through the command line or integrated into your IDE, your choice)

References