RexSoft · Articles · Case Studies

Article

Triple Tetris: A Multi-Twist on the Classic Game

Tools: C++ / Visual Studio / SFML

Every C Programmer's Rite of Passage: Building "Tetris"

Creating a "Tetris" game feels like a rite of passage for C programmers, and I am no exception! 😊 Following my "non-classic" takes on other classic games like Tic Tac Toe and Snake, my version of Tetris introduces a unique twist: "Triple Tetris" This feature allows players to control three tetrominoes simultaneously, switching between them using either the mouse or the keyboard. Apart from this exciting addition, the rest of the gameplay remains true to the classic Tetris experience.


Software and Tools Used

The application is developed in Microsoft Visual Studio using C++ and the Simple and Fast Multimedia Library (SFML) v2.6.0. SFML is a powerful library for handling graphics, input, and audio, making it ideal for game development.

Although the current version is built for Windows 10 (and works on Windows 11), SFML's cross-platform capabilities mean the game can also be deployed on Linux and macOS.

Key Features

1. Three Simultaneous Tetrominoes:

Each of the three tetrominoes spawns at the top of the game field in its own colour zone—green, yellow, or blue. Players can switch control between them in two ways:

Keyboard: Press keys "1," "2," "3" to select a specific tetromino or press "Space" to cycle through them.

Mouse: Simply click on the desired tetromino with the left mouse button.

2. Classic Controls:

Once selected, each tetromino can be controlled just like in the original Tetris:

• Rotate: Press "Up" or "W."

•  Move Down: Press "Down" or "S."

•  Move Right/Left: Use "Right"/"Left" arrows or "D"/"A."

3. Level Progression and Speed:

The game advances to a higher level after clearing a certain number of lines. With each level, the speed increases, intensifying the challenge.


Object-Oriented Design

As with my other projects, I used an object-oriented approach extensively, making it easy to scale and enhance the game. For example:


This architecture also paves the way for exciting upgrades, such as:

Server Integration: Save player scores online to foster competition.

Multiplayer Modes: Allow players to compete or collaborate


My "Triple Tetris" takes the timeless gameplay of Tetris and gives it a fun, creative twist, adding layers of strategy and complexity. By leveraging C++ and SFML, the game is optimized for performance and can be deployed across multiple platforms. Whether you're a casual player or a seasoned gamer looking for a fresh take on a classic, 3X Tetris offers something unique and engaging.

Stay tuned for potential updates and enhancements that may include server integration, multiplayer features, and more!


The link to the game distributive: https://sergerex.itch.io/triple-tetris

The link to source code : https://github.com/SergeRex/TripleTetris