I am making a multiplayer card game and am using NodeJS as my server with SocketIO.
My question is how should I be managing multiple game rooms (say an n number of game rooms) ?
Currently I have it setup as the server holds a JavaScript object which will hold all the game objects.
let games: {
“room367”: Game(),
“room193”: Game(),
....
“roomN”: Game()
};
So each time a new game is created, this happens
if (games[“room193”].exists()) {
joinRoom();
}
Should I even have an object to hold all the game objects ? Is there a better way to go about doing this ?