Instruction file imported from kent-leow/tetris (
.github/instructions/architecture.instructions.md). Copyright stays with the author.
Project Architecture and Structure
Application Architecture
tetris/
├── src/
│ ├── app/ # Next.js app router pages
│ ├── components/ # React components
│ │ └── game/ # Game-specific components
│ └── lib/ # Core logic and utilities
│ └── game/ # Game engine and types
├── docs/ # Documentation
└── public/ # Static assets
Game Architecture
-
Core Game Engine
- Tetromino management
- Board state management
- Collision detection
- Score calculation
-
Game Components
- Board rendering
- Game controls
- Score display
- Next piece preview
-
Game States
- Playing
- Paused
- Game Over
- High Score Entry
-
Multiplayer Features
- Two-player mode
- Score comparison
- Win/lose conditions
Data Flow
- User Input -> Game Engine -> State Update -> Render
- Game Loop -> Physics Update -> State Update -> Render
- Score Events -> State Update -> Storage -> Leaderboard
Storage Architecture
-
Local Storage
- High scores
- Game settings
- Player preferences
-
Azure Storage (Future)
- Global leaderboard
- Player profiles
- Game statistics