I am looking to develop a lobby system where users can create rooms, other users can join the room, and the creator of the room will select 9 participants to form 2 teams of 5 players each. Once both teams are finalized, the creator will close the room with a random password generated by the system and sent to all 10 players involved. All these operations need to be executed in real-time using AJAX technology.
Although I have an authentication system in place, I am unsure about how to build this lobby system. How should the "games" model be structured? Initially, I thought about a table containing fields for the "creator," an "is_active" boolean flag, and a "playerlist." However, I am struggling to determine how to associate specific players with their respective teams within this model.
In addition to the model design challenges, I am currently lost on how to implement such a system using Ajax. Any guidance or suggestions on how to proceed would be greatly appreciated.