Skip to content

scottnm/tetrust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image of tetrust logo

Animated demo of tetrust game

Tests status badge

Tetrust

Tetrust is a tetris clone built as a text user interface (TUI) using rust.

Controls

key control
A move tetromino left
D move tetromino right
S drop tetromino
Left arrow rotate tetromino left
Right arrow rotate tetromino right
P pause
ESC quit game early

Index

Why?

Why did I spend my time working on this?

  • I wanted to write more rust code
  • I wanted to write a TUI game
  • Initially, I had aspirations this might be a good playground to experiment with data-oriented design and entity-component systems. That never panned out, but it was an original motivator.
  • I found it gratifying to build something to a semi-polished "v1" state. Often, my toy projects get 40-80 hours of time from me before I hit some wall and lose motivation before getting to any kind of demo state.

Known gaps

As this is a personal project, there are a lot of gaps in functionality and polish. Notable ones include:

  • no in-game control explanations
  • no SFX
  • no installer

Nevertheless, I still consider the game in a V1 state. Humor me :)

Installation

There is currently no installer. To install and play the game, you'll need to build and run from source which isn't too gnarly. As a prerequisite you'll need a reasonably up-to-date rust installation.

  1. clone this repo
  2. cargo run --release

v1.0 Features

Despite

  • Basic tetris rules
    • Blocks fall and rotate
    • Lines can be cleared
    • Blocks fall faster as more lines are cleared
  • Classic arcade-style leaderboard
  • Separate start, game, and leaderboard screens

vNext Ideas

  • game music
  • SFX
  • AI match
  • Multiplayer match
  • Network multiplayer

A history in gifs

As I was working on the project I thought it'd be fun to record each milestone in a gif to demonstrate progress. Here they are in reverse chronological order w/ attached commits:

Automated CI/CD testing

Image of leaderboard

Image of start screen

Image of quick drop and drop preview

Image of increased fall speed

Image of scoring

Image of pause screen

Image of next block showing up in preview pane

Image of pieces rotating

Image of constrained board with game over screen

Image of left-right collision

Image of unit tests passing

Image of tetrominoes falling one at a time

Image of tetrominoes with color

Image of text-tetrominoes stacking

Image of text-tetrominoes falling

Image of text-tetrominoes rendering

Project reflections

  • V1 (Jan 18. 2021)
    • Tetris has some surprisingly interesting and complex rules that have changed and been tuned across its many iterations. The one I found most interesting (which I still don't really have a good implemenation for) was that many tetris games iterated on how pieces were allowed to rotate. In some early forms it was super simple but as the game was re-implemented and improved it became more complex. The gold standard for tetris games now usually requires some logic for "wall kicking".
    • As I was closing in on V1, it was wild to look back at the first commit in the repo. I started the project in mid 2019 and dropped it after making some sizable progress but running into a blocker with how I wanted to constrain the tetris board. It was very gratifying to come back to the project a year and a half later, unblock myself, and get to a V1. Tying up loose ends is a special sort of satisfying.

To be continued...? (probably not)