████████╗███████╗████████╗██████╗ ██╗███████╗
╚══██╔══╝██╔════╝╚══██╔══╝██╔══██╗██║██╔════╝
██║ █████╗ ██║ ██████╔╝██║███████╗
██║ ██╔══╝ ██║ ██╔══██╗██║╚════██║
██║ ███████╗ ██║ ██║ ██║██║███████║
╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝
A real-time multiplayer Tetris game built with Node.js and Socket.IO, supporting unlimited players.
2025-03-29_14-33-25.mp4
- Real-time Multiplayer: Supports unlimited players simultaneously.
- Competitive Mode: Last player standing wins.
- Live Scoreboard: See all players' stats in real-time.
- Docker Support: Easy deployment with Docker.
-
Install dependencies
npm install
-
Start the server
npm start
-
Play the game Open your browser and go to
http://localhost:3500.
# With Docker Compose
docker-compose up -d
# Or with Docker
docker build -t tetris-game .
docker run -p 3500:3500 tetris-game.
├── server/ # Backend modules
│ ├── config.js # Configuration management
│ ├── gameState.js # Game state management
│ ├── gameLogic.js # Game logic
│ └── socketHandlers.js # Socket event handlers
├── public/ # Frontend assets
│ ├── index.html # Main page
│ ├── css/style.css # Main stylesheet
│ ├── js/ # Frontend modules (ES6)
│ │ ├── config.js # Frontend configuration
│ │ ├── main.js # Main entry point
│ │ ├── socket.js # Socket communication
│ │ ├── render.js # Game rendering
│ │ ├── keyboard.js # Keyboard controls
│ │ └── ui.js # UI updates
│ └── socket.io/ # Socket.IO client library
├── docs/ # Documentation
│ ├── CODE_STYLE_GUIDE.md # Code style guide
│ ├── DOCKER_GUIDE.md # Docker deployment guide
│ ├── GAME_SPEED_CONFIG.md # Game speed configuration
│ └── INDEX.md # Documentation index
├── index.js # Main entry point
├── package.json # Dependencies configuration
├── Dockerfile # Docker configuration
└── docker-compose.yml # Docker Compose configuration
- Join Room: Enter your name to join the game room.
- Wait for Players: A minimum of 1 player is required to start (single player mode) or multiple players for competitive mode.
- Start Game: Any player can click the "Start Game" button.
- Controls:
- ⬅️
Aor←: Move Left - ➡️
Dor→: Move Right - ⬇️
Sor↓: Soft Drop - 🔄
Wor↑: Rotate - ⚡
Space: Hard Drop - 💾
CorShift: Hold
- ⬅️
- Elimination:
- You are eliminated when blocks stack to the top.
- Eliminated players are shown on the scoreboard.
- The game continues until one player remains.
- Game Over: Final rankings are displayed, and the game resets automatically after 3 seconds.
You can configure the following variables in a .env file:
REACT_APP_SERVER_PORT=8800 # WebSocket server port
REACT_APP_CLIENT_PORT=3500 # Client server port
REACT_APP_SERVER_HOST=localhost # Server hostname- 📖 Documentation Index - Navigation for all documents.
- 🚀 Quick Start Guide - Guide to get started quickly.
- 💻 Code Style Guide - Development standards and best practices.
- 🐳 Docker Deployment - Guide for containerized deployment.
- ⚔️ Attack System - Details on the Combo and Garbage Line mechanics.
- 🎮 Game Speed Config - Guide for adjusting game speed.
- 📅 Work Summary - Record of daily progress.
- Javascript
- HTML, CSS
- Socket.IO
- Node.js, Express.js
This project is licensed under the ISC License.
Happy Tetris😊