Add performance improvements documentation and game-logic enhancements

- Add IMPROVEMENTS.md with detailed analysis of performance issues and bugs
- Update CLAUDE.md with negative Y overflow explanation
- Update README.md with socket events documentation
- Enhance game-logic.js with improved comments and validation
- Improve server/index.js with better documentation and edge case handling
This commit is contained in:
2026-03-24 20:46:34 +00:00
parent 1af068923b
commit aeacf9e68f
5 changed files with 335 additions and 5 deletions
+11
View File
@@ -59,6 +59,17 @@ cd server && npm run test:coverage
- `LOBBY_ROOM = 'global-lobby'` - Socket.io room for all players
- Garbage rules: 2 lines cleared -> 1 garbage row, 3 -> 2, 4 (Tetris) -> 4 rows
### Piece Spawn & Negative Y Overflow
Pieces spawn at `y = 0` (top of visible board). The coordinate system allows **negative Y values** as intentional overflow space:
- **Negative Y allowed**: `isValidPosition()` only checks `newY >= BOARD_HEIGHT`, not `newY < 0`
- **Purpose**: When garbage is received, pieces are pushed up (y decreases) into negative territory
- **Player survival**: Player is NOT eliminated when piece goes negative — only when piece LOCKS with blocks in rows 0-1
- **Recovery**: Piece drops naturally back into visible area; player can continue playing
This design gives players a buffer zone to recover from garbage attacks before elimination.
### Socket Events
| Event | Direction | Payload |