#terminal-game #tetris #tetris-game #game #tui #bevy #terminal

bin+lib fallingblocks

A Tetris game implemented with ratatui and bevy_ecs

5 releases

Uses new Rust 2024

new 0.1.4 Mar 28, 2025
0.1.3 Mar 28, 2025
0.1.2 Mar 26, 2025
0.1.1 Mar 26, 2025
0.1.0 Mar 26, 2025

#100 in Games

Download history 86/week @ 2025-03-21

86 downloads per month

MIT/Apache

115KB
2.5K SLoC

Rust Tetris Game with ratatui and bevy_ecs

A terminal-based Tetris game implemented in Rust using ratatui for the terminal UI and bevy_ecs for game logic.

Features

  • Classic Tetris gameplay
  • Terminal-based UI with colors
  • Entity Component System (ECS) architecture
  • Scoring system with levels
  • Smooth animations and controls

Controls

  • ←/→: Move tetromino left/right
  • : Soft drop (move down faster)
  • ↑/Space: Rotate tetromino
  • D: Hard drop (drop all the way down)
  • Q: Quit the game
  • Enter: Restart after game over

How to Run

Make sure you have Rust installed, then navigate to the game directory and run:

cd tetris
cargo run

Dependencies

This game uses the following dependencies:

  • ratatui: Terminal UI library
  • bevy_ecs: Entity Component System from the Bevy game engine
  • fastrand: Fast random number generation
  • crossterm: Terminal manipulation
  • tracing: Logging

Code Structure

  • main.rs: Entry point, sets up the terminal and game loop
  • app.rs: Main application structure and state management
  • components.rs: ECS components for game entities
  • systems.rs: ECS systems that handle game logic
  • ui.rs: Terminal UI rendering code
  • game.rs: Game constants and configuration

License

MIT

Dependencies

~32–62MB
~1M SLoC