- user_id (host)
- game_type_id - max_players - min_players - type_of_cards - name_of_game
- Create player(s) entry in players table: return players.id
- Create the games entry in games table: return the games.id
- Create room entry in room table: use players.id, games.id
- players ids: player list
- game id: game tracking
- room id: room tracking
- user_id (each player)
- room_id
- game_id
- current_player (only user_id with can make that turn current_player_id)
- Check/Update cards played. - To see if you can update or if there's a winner.
- Update games entry. - Current and next player. - Update game_state if there's a winner.
- players ids: player list
- game id: game tracking
- room id: room tracking
All clients should be continously polling for relevant data when in a room otherwise a refresh button can be used to find games in a lobby.
Landing -> Lobby -> Room
-
host player enters root - game_type data is retrieved (GET /landing) - user id for host is set - (render /landing)
-
player enter lobby - client gets lobby view (GET /lobby) - server replies with lobby view which should render all the available to join games (render /lobby)
-
host player hosts a room - client posts to server (POST /rooms) * - server replies with the room view (render /rooms/:id) and initial data
-
players join a room - client does a get to server for room info (GET /rooms/:id) * - server replies to client with room render (render /rooms/:id)
-
start game - host posts to server to start the game (POST /rooms/:id) * - server should only replies to host with a success or fail
-
Update page based on the poll - Client to server using games id (POST api/games/:id) - If the user id being sent to games is the same as current_player then update the cards_played table - server queries cards_played table and returns to all clients (players or host) cards_played info - If the update results in the game_state to be finished then the server send the end game page (redirect /end)