When a player joins a game room, the server checks if the room exists and if it can accommodate more players. If conditions are met, the player is added to the room and assigned a character, and the game state is updated to reflect their participation.