I have this Project in School we have to make a Multiplayer Poker game using Socket Programming.

We were not taught enough to dive into multithreaded programming and I am no expert in studying. Programming is really my weakness but I need to finally pass this course and I am this problem away from passing. I repeated this course 2 times but I failed and this is my last chance of passing or else Ill be cut from my course.

Will you please help me?

details:

1.2 Scope
Glade/GTK
Signals and Timers
FileIO
Sockets
SQL Database

2 Program Overview
The MP will be a network-based, multiplayer card game (Pusoy Dos) program. There are basically two
major software components of the program; the Game Server and the Game Clients. Your program is
only responsible for the Game Client (the Player’s User Interface). The EEE13 faculty will provide the
Game Server.
Your program connects to the Game Server to get shuffled cards. It then displays the cards in the GUI
to allow the player to select cards to play on his/her turn. The cards are validated by the Game
Server, and if the card combination is valid and of higher rank than the previous player’s cards, the
cards are accepted and the other player will be serviced. The game ends when a player has no cards
left and is declared as a winner.

3 General Requirements
3.1 Development Environment
The program must be developed under Linux O.S. The IDE or editor can be any of your choice.

4.3 Fixing of Cards
The player should be able to arrange the cards at any time of the game. You may choose any method
to allow the user to arrange the cards (e.g. via Button Clicks or via Drag & Drop).
4.4 First Player
The player who gets the 3-of-Club card will be the first player to submit cards. However, unlike with
MP1, the Game Server is the one who decides which player got the 3-of-Club by sending the client
program the “Your Turn” message. Since the First Player cannot pass, the first player has unlimited
time to play his/her turn.
4.5 Ending a Turn
There are two ways to end a turn. One is by clicking the “Submit” button, and the other one is when a
timer runs out. If the Player clicks the Submit button, the program must send the cards to the Game
Server. The server validates the cards if it is a valid card combination, and if the card combination is
of higher rank than the recently submitted cards. If the cards are rejected by the Game Server, your
client program should allow the player to change the cards until the timer runs out.
When the timer expires, the Game Server will treat this as a “Pass” and the turn will proceed to the
next player.
A player may pass by clicking the “Submit” button without placing any cards on the “Current Turn”
table. If all 3 consecutive players passed, then the last player will be given a chance to place a new
set or combination of cards. In this case, this player cannot pass his turn and the timer is disabled.

4.6 Declaring the Winner
The first player that is able to deal all his cards (has no cards left) will be declared as the Winner.
Unlike with MP1, the winner is being declared by the server thru a “Player Wins” message. The
program must pop a window containing text congratulating the player. The program terminates after
the winner clicks a button in that window.
5 Server-Client Protocol
The Game Server will be running in the UnPlug Server to host multiple game sessions or game rooms.
The TCP/IP port number that will be used by default will be port 9034.

5.2 Protocol Data Format
The Protocol Data format will be in a form of a CSV (Comma Separated Values). The table below
enumerates the Messages and its parameters.
Message Data Format
JoinGame joingame, player_name, room#
StartGame startgame, player#
InitialCards initialcards, count, cardcode, cardcode, cardcode...
YourTurn yourturn, timeout_value
DealCards dealcards, count, cardcode, cardcode, cardcode...
DealCardsResponse dealcards_response, pass/fail
Cards cards, player#, count, cardcode, cardcode, cardcode...
DeclareWinner playerwins, player#
5.2.1 Join Game
This message is sent by the Pusoy Dos client to register a player to join a game identified by the
room#.
Parameter Description
player_name String representing the player’s name. String must only contain
alphanumeric characters, and must not contain any comma (,).
This name will be registered in the Server’s database for retrieval of High
Score list.
room# An integer to uniquely identify a game. Only 4 players can join a game
room in a single game. To ensure that no students will be able to destruct
the testing of another student, the student number is recommended to be
used as the room#.
5.2.2 StartGame
This message is sent by the Game Server to inform the clients the all 4 players have joined and the
game can now start.
Parameter Description
player# A decimal value representing the assigned player number for the client.
This player number should be displayed in the GUI.
5.2.3 Initial Cards
This message is sent by the Game Server to each client to provide the shuffled cards.
Parameter Description
count A decimal value indicating the number of cards in the message. This is
always 13 for a 4-player Pusoy Dos.
cardcode A string representation of a card. Card code convention will be
value+suit.
Ace = ‘a’, Jack = ‘j’, Queen = ‘q’, King = ‘k’
Club = ‘c’, Spade = ‘s’, Heart = ‘h’, Diamond = ‘d’
e.g. ah,2d,jc,3s represents Ace-of-Heart, Two-of-Diamond, Jack-of-Club,
and Three-of-Spade.
5.2.4 YourTurn
This message is used by the Game Server to inform a Client on its turn.
Parameter Description
timeout_value A decimal value indicating the number of seconds that the Game Server
will wait for the client program to submit valid cards. After this timeout
value, the Game Server will assume that the Player passed.
A timeout value of 0 means no timeout. This is usually set for the First
Player or when all other 3 players passed.

5.2.5 DealCards
This message is used to submit cards to the Game Server. The Game Server validates the cards
contained in this message and reply with a DealCardsResponse.
Parameter Description
count A decimal value indicating the number of cards in the message.
cardcode A string representation of a card. See section 5.2.3 InitialCards table for
details.
5.2.6 DealCardsResponse
This is a response to the DealCards message.
Parameter Description
pass/fail A string indicating if the cards submitted is accepted by the Game Server.
If the response is “fail”, the Client program must return the cards to the
Current Turn table. If the response is “pass”, the Client Program must
place the cards into the Previous Turn table.
5.2.7 Cards
This message is broadcasted by the Game Server to other 3 players after a successful DealCards. It
informs the other 3 players what cards the current player submitted.
Parameter Description
player# A decimal value indicating which player has submitted the cards.
count A decimal value indicating the number of cards in the message.
cardcode A string representation of a card. See section 5.2.3 InitialCards table for
details.
5.2.8 DeclareWinner
This message is sent by the Game Server to all players to inform the players which player wins the
game. When this message is received by the Client program, the client program must show a dialog
box to congratulate or if the player is defeated.
Parameter Description
player# A decimal value indicating which player wins the game.



I know this is a bit too much but Im really desperate for help now. I'm just knowledgeable about glade and some C functions but games like these I really don't succeed in.

Please please someone help. I really really will appreciate ANY HELP.


Thanks and more power.