Letter of Approval
To:
Name: Tachbir Dewan
Student ID: 18CSE222
Department of CSE, BSMRSTU
Subject: Approval for “Tetris Game” Project.
I am pleased to inform you that your “Tetris game” Project developed
using C++ has been approved. Your project showcases efficiency and
meets our requirements effectively.
Thank you for your contribution and dedication to this project.
Best regards,
Md. Martuza Ahamad
Assistant Professor
Department of CSE, BSMRSTU.
1
ACKNOWLEDGEMENT
It is high privilege for me to express my deep sense of
gratitude to those entire faculty Members who helped me in
the completion of the project, specially my internal supervisor
Md. Martuza Ahamad sir who was always there at hour of
need. My special thanks to all other faculty members, Batch
mate & Seniors of University’s for helping me in the
completion of project work and its report submission.
2
TABLE OF CONTENTS
S. No. Topic Page No.
1 Acknowledgement 1
2 Abstract 3
3 Chapter-1: Introduction 3
4 Chapter-2: Objective 3
5 Chapter-3: Methodology 4
6 Chapter-4: System Design 6
7 Chapter-5: Implementation and Results 7
8 Chapter-6: Testing 1
1
9 Chapter-7: Conclusion 1
2
1 Chapter-8: References 1
0 2
TABLE OF FIGURES
Figure Caption of the Figure Page No.
No.
1 Piece of Code 7
2 Output Window 8
3 Scoring 9
4 Game Over 1
0
3
Abstract
This project focuses on the development of a Tetris game, a classic and iconic
puzzle video game. The primary goal was to create a functional and engaging
Tetris experience for players. Key elements such as block generation, player
controls, and scoring mechanisms were implemented to replicate the original
Tetris gameplay.
I. Introduction
The Tetris game, created by Russian programmer Alexey Pajitnov in 1984, is a
timeless classic in the world of video games. Its simple yet addictive gameplay,
involving the arrangement of falling geometric shapes to create complete rows, has
captivated players for generations. The game's enduring popularity and its
influence on the gaming industry make it an excellent subject for a game
development project.
The Tetris Game Project presented in this report involves the creation and analysis
of a modern interpretation of this iconic game. Our aim is to not only recreate the
original Tetris experience but also to explore various aspects of game development
and user experience.
In this report, we will detail the objectives, methods, findings, and contributions of
our Tetris Game Project. This project serves as a tribute to the enduring appeal of
Tetris and as a valuable learning experience in the realm of game development and
user interaction.
II. Objective
The main objective of the Tetris game is to prevent the falling blocks from piling
up to the top of the playing field. To do this, the player must move and rotate the
blocks as they fall, attempting to fit them together. When a row of blocks is filled,
it disappears, and the blocks above fall one rank. The player scores points for each
4
row cleared, and the game ends when the blocks reach the top of the playing field.
Here are some other objectives of the Tetris game:
1. Clear as many rows as possible in a single game.
2. Get a "tetris", which is when four rows are cleared simultaneously.
3. Reach the highest possible score.
4. Beat your own high score.
5. Beat the high score of your friends or other players.
6. Complete the game on the highest difficulty level.
III. Methodology
Programming Language: C++
IDE: Code Blocks
Libraries: Graphics.h for graphics
The methodology of the Tetris game is based on the following principles:
Randomness: The falling blocks are generated randomly, which adds an element
of challenge and unpredictability to the game.
Rotation: The blocks can be rotated 90 degrees clockwise or counterclockwise,
which gives the player more control over how they fit together.
Gravity: The blocks fall down at a constant rate, which creates a sense of urgency
and forces the player to make quick decisions.
Clearing rows: When a row of blocks is filled, it disappears and the blocks above
fall one rank. This creates opportunities for the player to create more space and
make better use of the available space.
Score: The player scores points for each row cleared, and the game ends when the
blocks reach the top of the playing field. The player's score is also affected by the
number of tetrominoes that are cleared simultaneously.
5
The Tetris game can be played in a variety of ways, and the best strategy will vary
depending on the player's skill level and the difficulty level of the game. However,
some general tips for playing Tetris include:
Think ahead: Try to plan your moves several steps in advance so that you can
make the most efficient use of the available space.
Use the rotation feature: The rotation feature can be used to create more space or
to fit the blocks together in a more strategic way.
Clear rows as quickly as possible: Clearing rows will create more space and give
you more options for your next move.
Don't be afraid to experiment: There is no one right way to play Tetris, so
experiment with different strategies and see what works best for you.
6
IV. System Design
The structure of a Tetris game typically includes several key components and elements.
Tetris is a classic puzzle video game where the goal is to manipulate falling blocks
(tetrominoes) to create complete rows and clear them from the playing field. Here's an
overview of the typical structure of a Tetris game:
Game Board or Grid:
The game is played on a rectangular grid, often with dimensions like 10 columns by 20
rows. This grid represents the playing field where tetrominoes fall and stack.
Tetrominoes:
Tetrominoes are geometric shapes made up of four squares each. There are seven
different types of tetrominoes in Tetris, and each type has a unique shape.
Random Tetromino Generation:
Tetrominoes are generated randomly and appear at the top of the game board. Players
must manipulate these falling tetrominoes to fit them into the existing stack.
Controls:
Players can control the movement of the falling tetrominoes using keyboard or gamepad
inputs. Common controls include left and right movement, rotation, and quick dropping.
Rotation:
Tetrominoes can typically be rotated in 90-degree increments to fit into gaps and create
complete rows. Proper rotation is essential for successful gameplay.
Scoring:
Points are awarded for clearing rows. Different Tetris games may have variations in
scoring rules. Clearing multiple rows at once (Tetris) usually results in higher points.
Level Progression:
As players clear more rows, they may advance to higher levels. Higher levels often lead
to faster falling tetrominoes, making the game more challenging.
Game Over:
The game ends when the stack of tetrominoes reaches the top of the grid, making it
impossible to place new pieces. The player's final score is recorded, and they can choose
to play again.
7
Graphics and UI:
Tetris games typically have graphical elements, including colorful tetrominoes and a user
interface that displays the player's score, level, and potentially other information.
V. IMPLEMENTATION AND RESULT
Implementing a Tetris game involves writing code to create the game's core logic,
graphics, and user interface. Below, I've implemented a simple Tetris game in C++.
1. Piece of Code –
Fig. 1
8
2. Output Window – When we run the project then we’ll see this user
interface.
Fig. 2
9
3. Scoring – After matching each row it will be vanish and the score will up as
well as level also.
Fig. 3
10
4. Game over – If the blocks touch the top border then the game will be over.
Fig. 4
11
VI.Testing
Testing a Tetris game project involves ensuring that all the game's features and
functionalities work as expected. Here are some steps and considerations for testing a
Tetris game:
Functional Testing:
Start by testing the basic functionalities of the game, such as starting a new game,
moving tetrominoes, rotating them, and clearing rows when they are completed.
Collision Detection:
Test whether the game correctly detects collisions between tetrominoes and the walls
of the game grid or other tetrominoes. Make sure that tetrominoes stop falling when
they reach the bottom or when they collide with other blocks.
Row Clearing:
Verify that when a row is filled with blocks, it is correctly cleared, and the rows above
it shift down. This is a crucial part of Tetris gameplay.
Scoring and Levels:
Test the scoring system to ensure that points are awarded correctly when rows are
cleared. Check if the game progresses through levels as the player scores more points.
Game Over:
Confirm that the game ends when a tetromino cannot fit at the top of the grid, and it
correctly displays a game over message or option to start a new game.
User Controls:
Test user controls (keyboard or gamepad) to ensure that the player can move and
rotate tetrominoes as intended. Make sure controls are responsive.
Graphics and UI:
Check that the graphical elements, including tetromino shapes, grid lines, and user
interface components, are displayed correctly and that there are no graphical glitches.
Boundary Testing:
Perform boundary testing by playing the game with the smallest and largest grid sizes
and levels to check for any unexpected behavior.
Randomness Testing:
Since Tetris relies on random tetromino generation, test the game over multiple
sessions to ensure the randomness is functioning correctly and that the game remains
challenging.
Exception Handling:
Test how the game handles unexpected situations, such as running out of memory or
encountering errors. Make sure it provides clear error messages or gracefully handles
these situations.
12
VII. Conclusion
In conclusion, a Tetris game project involves implementing a classic
puzzle game where players manipulate falling tetrominoes to clear rows
on a grid. The project typically includes elements like graphics, user
interface, scoring, and level progression. Testing is essential to ensure
that all game features work correctly, including collision detection, row
clearing, controls, and sound effects. The goal is to create an engaging
and bug-free gaming experience for players.
VIII. References
◆ Books on Game Development:
Books like "Game Programming Patterns by Robert Nystrom" by Joe Hocking and
"Godot Engine Game Development Projects" by Chris Bradfield can provide
insights into game development concepts and techniques.
◆ YouTube Tutorials and Video Courses:
Video tutorials on platforms like YouTube can be very helpful. Channels like
"TheCherno" and "Brackeys" often provide game development tutorials that cover
various aspects of creating games.
◆ Programming Resources:
Brush up on my programming skills with resources like online coding tutorials,
courses, and textbooks in relevant languages like C++, C#, Python, or JavaScript.
◆ Game Development Courses:
Consider enrolling in online game development courses on platforms like Udemy,
Coursera, or edX. These courses can provide structured learning paths for building
games.