I'm designing a lobby which holds all game rooms
- If a room is empty, it gets deleted by the lobby
- If a room is full, a new room is created
- For now the lobby is an array of objects on a websockets server which holds the room.
- The rooms are are arrays of objects which hold the players.
The players data are stored on firebase, I don't care about the room data, they're just spawned and deleted, therefore they're not stored anywhere now. The problem I'm facing is the following:
- If I leave it like that, I'm going to face problems when scaling on multiple servers, plus it I don't think I can get away with an array holding 50k arrays which holds players data.
- I don't want to install redis, every time I have to use that I have stringify and serialize.
- Using a database like MongoDb, means installing a database, doing read and write, perhaps managing clusters, all that for data I don't care about.
- Using firebase, means doing too many unnecessary requests
My architecture is simple
- The client is the mobile app
- The game logic is done on the server using nodejs
- Data storage and authentication is done on firebase, using nodejs, from the server side
- The websockets server is uwebsockets.js
I have to solve the last part which is the rooms and lobby, If I manage to do it without installing a database it would be great, because as of now, I managed to do everything without needing a database on the server, which means easier to scale and all the server has to do is run some nodejs code.