Refactor to single global lobby

Changes:
- Removed room-based architecture, now using single global lobby
- Players only need to enter their name to join
- Game starts when all players in lobby are ready (min 2, max 8)
- Simplified UI - no room name field, shows "Global Lobby" header
- Updated all server events to use io.emit instead of io.to(roomName)

Files modified:
- server/index.js: Replaced rooms Map with single lobby object
- public/index.html: Removed room name input, updated button text
- public/js/network.js: Renamed joinRoom/leaveRoom to joinLobby/leaveLobby
- public/js/ui.js: Simplified join flow, removed room name validation
- public/js/app.js: Updated game header to show "GLOBAL LOBBY"
- PLAN.md: Marked all phases as complete
This commit is contained in:
2026-03-20 07:09:51 -07:00
parent 5da6033704
commit e7917a338e
6 changed files with 172 additions and 274 deletions
+3 -12
View File
@@ -3,7 +3,6 @@
class NetworkManager {
constructor() {
this.socket = null;
this.currentRoom = null;
this.currentPlayerId = null;
this.players = {};
this.gameState = {};
@@ -26,7 +25,6 @@ class NetworkManager {
this.socket.on('disconnect', () => {
console.log('Disconnected from server');
this.currentRoom = null;
});
this.socket.on('player-joined', ({ player, players }) => {
@@ -66,20 +64,13 @@ class NetworkManager {
});
}
joinRoom(roomName, playerName) {
joinLobby(playerName) {
if (!this.socket) return;
this.currentRoom = roomName;
this.socket.emit('join-room', { roomName, playerName });
this.socket.emit('join-lobby', { playerName });
}
leaveRoom() {
leaveLobby() {
if (!this.socket) return;
if (this.currentRoom) {
this.socket.leave(this.currentRoom);
}
this.currentRoom = null;
}
ready() {