Technologies: http://www.html5gamedevs.com/topic/15261-developing-a-4-player-card-game/
- nodejs core
- socket.io communication
- pixi.js UI
Architecture: https://medium.com/@MichalMecinski/architecture-of-a-node-js-multiplayer-game-a9365356cb9
- Server Controller: new connections, auth, create and destroy game, persistent data
- Game Controller: one for every game room. It is responsible to change the state of the Game
- Player Controller: handles incoming messages for each player and send periodically state of the Game
- Client Controller: sends action from the client to server and vice-versa
- Game View: render canvas and pass inputs from browser to Client Controller
User Requirements:
- Player connects to Server
- Server collects 4 players
- A game is started
- One random player starts the game
- Every player receives the cards
- The player who started has to discard 2 cards following the game rules
- The player on the left starts the Game
- Every player plays one card
- Following the rules of the game, 1 player wins the hand
- The player who has won starts the next hand
- The game continues until all the cards have been played
- Calculations are made and one team wins
Tasks:
-
Run web Server in local
-
Server accepts multiple tcp connection and ask user the names
-
The server print the partecipants on screen and wait until 4 players are connected
-
Creation of a simple game:
- definition of the state machine
- cards are assigned randomly to players
- info are sent to the users
- users fills array with these info
-
Creation of simple UI A simple UI could be an array of letters which correspond to cards. The user can write in a box the card he wants to play and then it disappears from the array
-
Creation of isMyTurn Function waiting in case for server message (internal state machine)
-
Creation of isValidCard function (both client and server side)
-
Creation of whoWinsHand function
-
Creation of whoWinsGame function
-
Creation of proper UI