Current version: 1.1.0
./package.sh
./package-all.sh
If you're running this in a headless environment (like a remote server without X11), you'll need to either:
- Use X11 forwarding with SSH:
ssh -X username@server
- Configure a virtual framebuffer:
xvfb-run java -jar build/tetris-all.jar
- Set up a proper display environment
The game requires a graphical environment to run properly.
A Java SE GUI implementation of the classic Tetris game with user authentication and score tracking using MySQL database.
- User authentication (login/register)
- Score tracking with high scores saved to MySQL database
- Leaderboard showing top 3 players
- Classic Tetris gameplay with all 7 tetromino shapes
- Controls for movement, rotation, and dropping pieces
- Pause/resume functionality
- Restart and exit options
- Java 8 or higher
- MySQL Connector/J (provided in lib directory)
- X11 display server (for GUI) or proper headless configuration
The application connects to a remote MySQL database with the following configuration:
- Host: 212.64.21.134
- Port: 3306
- Database: tetris
- Username: root
- Password: Zdl200212.
You need to create the users table in the tetris database:
CREATE DATABASE IF NOT EXISTS tetris;
USE tetris;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
password VARCHAR(50) NOT NULL,
high_score INT DEFAULT 0
);
java -cp "src/main/java:lib/*" tetris.Main
java -jar build/tetris-all.jar
java -jar build/tetris.jar
Note: You'll need to have the MySQL Connector/J JAR file in a lib
directory. You can build the JAR files using the packaging scripts.
- Left/Right Arrow Keys: Move piece horizontally
- Down Arrow Key: Soft drop (move down faster)
- Up Arrow Key: Rotate piece
- Space: Hard drop (instantly drop piece)
- P: Pause/Resume game
- R: Restart game (when game is over)
- Score tracking
- Level progression (speed increases with score)
- Line clearing with scoring:
- 1 line: 100 points
- 2 lines: 300 points
- 3 lines: 500 points
- 4 lines: 800 points
See CHANGELOG.md for detailed version history.