Skip to content

BFUR64/tetrue-lite

Repository files navigation

Tetrue Lite

An open-source Tetris clone for the terminal, built in Java using the Tetrue Terminal Abstraction Library

image

Demo

ezgif-71000bef1676a9a9

Features

  • Falling Blocks - Standard falling tetrominoes
  • Gravity - Drops move down per second and speeds up per line clear
  • Lock Grace - Allows adjustment before it gets placed
  • SRS Rotation - Based on the SRS Table
  • Movement - Move blocks left and right
  • Hard Drop - Instantly drop a tetromino to the bottom row
  • Scoring - Tracks points for cleared lines
  • Block Queueing (7 Bag System) - Next pieces preview and fair randomization
  • Hold block
  • Configurable Settigns

Limitations

  • No game / score tracking after the game is closed
  • Inaccurate scoring / gravity
  • Minimal main menu only, featuring New Game, About, and Exit
  • No sound

Environment

  • Designed and tested primarily on Linux, Windows, and Termux (Android)

Usage / Controls

  • UP Arrow Key - Hard drop
  • DOWN Arrow Key - Move tetromino down
  • LEFT / RIGHT Arrow Keys - Move tetromino left / right within the grid
  • Q Key - Rotate tetromino clockwise
  • E Key - Rotate tetromino counter-clockwise
  • C key - Hold block

In the main menu, press 0 or ESC to exit the application
In the game, press ESC to exit the game

Installation / Running

Clone the repository

git clone git@github.com:BFUR64/tetrue-lite.git
cd tetrue-lite

Build the shadow JAR

Windows

./gradlew build

Linux / Termux

sh gradlew build

Run the generated JAR

(Java 22 and later)

java -jar --enable-native-access=ALL-UNNAMED app/build/libs/app-all.jar

(Java 21)

java -jar app/build/libs/app-all.jar

Architecture Overview (OUTDATED SINCE v2.0.4)

Core Loop

Core Loop

Rendering Layer

View Loop

Tetrue Lite Game Design Document

Tech Stack

  • Programming Language: Java 21 (Adoptium OpenJDK 21.0.11)
  • Libraries:
    • Tetrue Terminal 2.0.1 (Lanterna-like Abstraction Library for JLine4 and Lanterna)
    • Menu Manager 0.6.0 (Personal Composite-based Menu Management)
  • Build Tools: Gradle 9.3.1

Version Releasing

MAJOR . MINOR . PATCH

  • MAJOR - Breaking Changes
  • Minor - Feature Releases / Without breaking the existing API
  • Patch - Bug fixes

Development Environment

Originally built on Termux Neovim on Android, because I found it more convenient than my laptop (Ability to work on the go).

Now, it's mostly tested and built on my laptop ever since the move to JLine 3. I still use Termux to ssh into the laptop and code every now and then if I'm on the go.

Why I Built This (v1 Tetrue Lite)

After 1.5 years of endless architecturing the 'next best' architecture for the project, I realize my honeymoon phase had to end. It doesn't ship. It only promises.

Tetrue Lite is the v7, with all the unnecessary abstractions / over-engineering gutted or removed, with the focus of delivering an MVP, e.g., an actual playable game.

It was a brutal slap in reality when I realized this.