Add player names to snake display

Show human-readable player names instead of player IDs in both desktop
and web clients. Player names are now stored in the Snake model and
synchronized across all clients.

Changes:
- Added player_name field to Snake model
- Updated create_snake() to accept player_name parameter
- Desktop client shows "YOU:" or "PlayerName:"
- Web client shows "You (Name)" or "Name"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vladyslav Doloman
2025-10-04 17:21:53 +03:00
parent b28d78575f
commit 97d6df1896
6 changed files with 16 additions and 8 deletions

View File

@@ -322,8 +322,8 @@ class GameClient {
const nameSpan = document.createElement('span');
nameSpan.className = 'player-name';
nameSpan.textContent = snake.player_id === this.playerId ?
`You (${snake.player_id.substring(0, 8)})` :
snake.player_id.substring(0, 8);
`You (${snake.player_name})` :
snake.player_name;
const scoreSpan = document.createElement('span');
scoreSpan.className = 'player-score';