| assets/fonts/boldpixels | ||
| src | ||
| CLAUDE.md | ||
| conf.lua | ||
| LICENSE | ||
| main.lua | ||
| outlines.md | ||
| prompt.md | ||
| README.md | ||
Simple Tetris
A complete, modern Tetris implementation built with LÖVE 11.5, featuring SRS rotation, full controller support, and customizable themes.
Running the Game
love .
Make sure you have LÖVE 11.5 installed on your system. Download from love2d.org.
Developer Notes
Key Implementation Decisions
Rotation System: Implements the Super Rotation System (SRS) with complete wall kick tables for all tetrominoes. The I-piece uses its own specialized kick table, while J, L, S, T, and Z pieces share the standard JLSTZ kicks. The O-piece doesn't require wall kicks.
Lock Delay Policy: Default 500ms lock delay activates when a piece is grounded. Any movement (left/right) or rotation resets the lock timer, allowing skilled players to maneuver pieces horizontally while grounded and place them underneath overhangs. This enables advanced techniques like infinite movement while grounded until the piece stops moving.
Hold Spawn Behavior: Pieces normally spawn at row 0 (top of the grid). However, when swapping a piece from hold back into active play, that piece spawns 2 rows lower (row 2). This is a deliberate gameplay mechanic specified in the requirements.
DAS/ARR Defaults:
- DAS (Delayed Auto Shift): 150ms - delay before horizontal movement auto-repeats
- ARR (Auto Repeat Rate): 30ms - time between repeated movements once DAS triggers
- These values provide responsive yet controllable piece movement
Gameplay Settings
| Setting | Default Value | Notes |
|---|---|---|
| Window Size | 1280×720 | Resizable in windowed mode |
| Board Size | 10×22 | 10 columns, 20 visible + 2 hidden spawn rows |
| Lock Delay | 500ms | Resets on movement/rotation |
| DAS | 150ms | Delayed auto-shift |
| ARR | 30ms | Auto repeat rate |
| Fall Speed | 1.0s/cell | Increases with level (0.05s faster per level) |
| Next Queue | 5 pieces | Configurable 1-10 in settings |
| Theme | 8bit | Four themes available |
| FPS Cap | 60 | Options: 30, 60, 90, 120, 144, 165, 200, none |
Board Auto-Scaling
The board occupies 80% of the window height and scales automatically with window resizing. Cell size is calculated as floor(boardHeight / 20) and forced to integer values to maintain crisp pixel rendering.
Controls
Keyboard
| Action | Keys |
|---|---|
| Move Left | ← (Left Arrow) |
| Move Right | → (Right Arrow) |
| Soft Drop | ↓ (Down Arrow) |
| Hard Drop | Space |
| Rotate Clockwise | ↑ (Up Arrow), X |
| Rotate Counter-clockwise | Z |
| Hold/Swap | C, Left Shift |
| Pause/Menu | Escape |
Controller (Gamepad)
| Action | Buttons |
|---|---|
| Move Left | D-Pad Left, Left Analog Stick Left |
| Move Right | D-Pad Right, Left Analog Stick Right |
| Soft Drop | D-Pad Down, Left Analog Stick Down |
| Hard Drop | A Button |
| Rotate Clockwise | Y Button, Right Shoulder |
| Rotate Counter-clockwise | B Button, Left Shoulder |
| Hold/Swap | X Button |
| Pause/Menu | Start Button |
Controllers automatically detected. Both keyboard and gamepad can be used simultaneously.
Settings Persistence
Settings are saved to love.filesystem storage:
- Linux:
~/.local/share/love/simple-tetris/settings.json - Windows:
%APPDATA%\LOVE\simple-tetris\settings.json - macOS:
~/Library/Application Support/LOVE/simple-tetris/settings.json
Settings persist between game sessions and include:
- Theme selection (8bit, 16bit, pale, monochrome)
- Fullscreen/windowed mode
- Window resolution
- FPS cap
- Border style (outside, all cells, none)
- Next queue length (1-10)
Themes
Four visual themes available:
- 8-bit: High contrast, crisp pixel-art style with vibrant colors
- 16-bit: Softer palette with subtle shading
- Pale: Desaturated pastel colors for a gentle aesthetic
- Monochrome: Grayscale blocks with strong borders for clarity
All themes feature customizable borders (outside only, all cells, or none) to maintain block distinguishability, especially important in monochrome mode.
Scoring
| Line Clear | Base Points |
|---|---|
| Single | 100 × Level |
| Double | 300 × Level |
| Triple | 500 × Level |
| Tetris (4 lines) | 800 × Level |
| Soft Drop | 1 point per cell |
| Hard Drop | 2 points per cell |
Level increases every 10 lines cleared. Fall speed increases with level (max speed reached at level 18).
Features
- ✓ SRS rotation with full wall kick support
- ✓ Hold piece mechanic with swap-spawn-lower behavior
- ✓ Ghost piece preview
- ✓ 7-bag randomization system
- ✓ Lock delay with movement/rotation reset
- ✓ DAS/ARR input handling for smooth movement
- ✓ Full gamepad support with multiple button mappings
- ✓ Four customizable themes
- ✓ Persistent settings across sessions
- ✓ Configurable FPS cap (30-200 or unlimited)
- ✓ Auto-scaling UI for different resolutions
- ✓ Pause menu with resume/restart/quit
- ✓ Options menu for all settings
Architecture
The codebase is modular and organized for clarity:
├── main.lua # Entry point, game loop, FPS limiting
├── conf.lua # LÖVE configuration
├── src/
│ ├── game.lua # State management (menu/play/pause/gameover/options)
│ ├── board.lua # Grid logic, collision, lock delay, scoring
│ ├── pieces.lua # Tetromino definitions, SRS rotation, wall kicks
│ ├── input.lua # Keyboard/gamepad handling with DAS/ARR
│ ├── ui.lua # Rendering (board, pieces, UI elements, menus)
│ ├── theme.lua # Color palettes and theme management
│ └── settings.lua # Settings persistence (JSON save/load)
Development
No external dependencies required - vanilla LÖVE 11.5 only.
To modify gameplay constants, see:
- Lock delay:
src/board.lualine 10 - DAS/ARR:
src/input.lualines 4-5 - Scoring:
src/board.luaupdateScore()function - Fall speed curve:
src/board.luaupdateScore()function
License
MIT License - see LICENSE file for details.
Credits
Built with LÖVE 11.5 game framework.
Generated with Claude Code.