Poker game architecture and its implementation (2)

xiaoxiao2021-03-06  48

Define system objects

l game (Game

)

This object is responsible for communication, packaging, and parsing command messages with other end processes, constitutes a pipeline, issued to the communication platform. Control the shuffle, licensing operation, and host the action of the recycling card destruction. Judgment the player that can be passed, and to the card. The public information in the winners such as a wheel in the card.

l game view (GameView

)

Demand the interface in front of the user, the derived class object from the MFC CVIEW.

l Poker (PokerWnd)

)

This object inherits the CWND class from the MFC, saves the face value, color, and the size value of a particular algorithm.

l player (Player)

)

The associated information of the player, including the license information, ID, etc., saved in this object.

l referee (Judge

)

Can be used to centrally set the rules, responsible for all the size of the player after the card.

L-box (Pokerbox)

)

When the shuffling moves, the randomly generated card between the licensing is stored in the box; after this, each player will receive a card from it.

l Examinate buffer queue (PokerBufferListout

)

After the player clicks on submission, the legality of the card is checked by this object, if the legal will succeed. After the player is successful, the card moves to the queue.

l Turning a buffer queue (PokerBufferListin

)

In the catching poker game, you need to put the wrap to the queue of each player object, which is convenient for later statistics.

l Sales buffer queue (Extention List)

)

In some particular games, such as arch pigs, players choose some split cards to see all other players, which are doubled in the future integral calculation. This object is used to save them before these cards are called.

l Recycling queue (trash

)

After each round of the card, the referee is relatively small, sorting the slogue, then puts the remaining other cards into the recycling queue, and concentrates the destruction after the end of the end.

l message package (Package

)

The message to be transmitted is packaged, providing a rich string operation method.

Network messaging overview

The purpose of messaging is to synchronize the status and data of each end, which is specifically operated by various commands.

Contact between the distal end and the local end "

Message

Message string by characters, by a series

Command consist.

The command can have parameters.

Analysis: According to the flag bits, the received string (message may contain multiple strings), and perform related operations locally according to its parameters.

Assembly: Calling by program point you need to send messages. Assign strings, write related commands and their parameters, and put

Message (via Windows Custom Window Message) is sent to CGAMEVIEW, to be sent to the network layer.

Analyze and

The function of the assembly message is implemented in the GAME object, and the resolution and assembly of continuous multiple commands must be supported.

转载请注明原文地址:https://www.9cbs.com/read-40718.html

New Post(0)