Into the Realm of 2D Poker Software
25 August 2010 Posted By admin
Playing poker online is so much easier and so much fun. But have you ever thought of looking beyond the moves and the cards, beyond the spankling user interface of the 2d poker software and wondered about the underlying architecture that holds it together? This world of client and server interactions with data storage and retrieval from databases is also very fascinating. Let us give you a whirlwind tour of what transpires here.
Our 2d poker software package is a MMOG (Massively Multiplayer Online Gaming) platform which just means that it can support a large number of players online who can play simultaneously on different tables. The basic architecture is client-server architecture. The client being the front end, the graphical user interface (GUI) that a player sees and plays with. The client transports user requests to server and once the server has processed them and sent back the responses, the client displays the results. The server, on the other hand, is responsible for the game logic implementation and to manage all the client connections.
Let us start with the client initialization. Once the player has downloaded and installed the client and registered with the server, his/her login id and password are stored in the database for future authentication. When the user starts the 2d poker software client, it connects with the server over the internet and the server starts a session for this client. When the user logs in, the client sends the user name and password to the server. The same is authenticated by the server. Once the login process is over, the player can choose any table to sit and to play. In the lobby, the ring tables, the SNG tables and the Tournament tables are shown in different tabs so that the player can choose whichever variation he/she wants to play. When the player chooses a table to play and click “open”, he/she is shown the table with the existing players represented by avatars. If a game is already in progress, the player can watch the game as an observer. If he/she would want to join the table and if there is an open seat on the table, he/she can sit on it, pick an amount that he/she wants to play with and wait for the start of the next hand.
The 2d poker software server initialization is much more dynamic and complex. When the server is started, it checks in the database on how many tables have to be created. The table in the database holds all the important values for the table, such as type of game (real money Texas Hold’em ring table or play money Omaha hi sit and go), minimum and maximum players for the table, the value of small blind and big blind for the table and most importantly the affiliate who can see this table. The last parameter is important as the server uses this to display this table to only those players who register with this particular affiliate. One by one, the server creates the entire table storing all the values from the database and once the tables are initialized, it starts waiting for connection requests from client.
The first message from the client to server identifies the affiliate. The server uses this to prepare the list of tables that the player for this affiliate can view. This list is shared with the client which prepares the lobby pages for the different tables. When the player logs in, the client sends in the user id and password for the player. The 2d poker software server authenticates the same from the database and creates a unique player object to identify the player. If the player opens a table, the server creates an entry in a table in the database for the player and then creates a presence for the player on the table. This presence is linked with the player object. The presence is marked as an observer if the player just wants to view the game. If the player sits on the table, then presence is marked as player. This allows the player to sit on as many tables as he wants to sit on with the presences being linked together and accessed from the player object for the player.
For a table, if the minimum numbers of players are sitting on the table, the server starts the game. Let us take the example of a Texas Hold’em ring table. When the game starts, a dealer is identified and the person left to the dealer becomes the small blinds player and the player left to the small blinds player becomes the big blinds player. The server sends out a game message to all the players on the table including the observers, identifying the next move player by the seat number and the allowed moves for this player. If a 2d poker software client receives a game message and sees that it is not the next move player, it will highlight the next move player and start a timer to display the time that the player has on disposal to make the next move. If a client receives a game message and identifies the next move player, it displays the potential next moves to the player, starts a timer and waits for the player to make the move.
If the next move player makes his move in the stipulated time, the client sends the message to the server, which processes it, determines the next move player and the players moves and sends out the message to all the players on the table including the observers. If the next move player doesn’t make his move on time or if the client gets disconnected from the server, the move timer expires on the server and depending upon the context of the game, the server makes a proxy move for the player so that the game can continue on the table.
Once the blinds are complete, for each player, the server picks up 2 cards randomly from the deck of cards, assigns these pocket cards to the player and shares these cards with the player. Once the first betting round completes, the server picks up 3 cards randomly to be displayed as Flop cards, updates the state of the game and shares these cards with all the players and observers so that the client can display these cards.
The server keeps on determining the next move player and its moves till the time the 4 betting rounds (associated with pre-flop cards stage, flop cards stage, turn card stage and river card stage) are over and the game can be completed. When the hand completes, the server takes the cards of still active contenders to the pot (removing all the folded and sitting out players), determines the best hand value for these pocket cards in conjunction with the community cards, compares the best hand values of all the active contenders, determines the winner of the hand, assigns the pot to the winner and the rake to the house account and notifies all the players and observers of the winner of this hand. On receipt of the winner message, the 2d poker software client updates the table window of the winner of the hand. Then if the next game can be started, the server shuffles the cards, initializes the game variables and starts the process again of identifying the dealer and blinds player and of sending messages to the players to inform them of the potential next moves.
This is a very simplistic scenario. There can be cases when the pot has to be split or when there are more than 1 pot on the table (if one player bets and the other player goes all-in but still can’t match the bet value) or when 1 player raises and then leaves the table. For all cases, the server has to correctly determine the value of the pot and of the rake and return the uncalled bet amount to the player.
For the SitNGo tables and the tournament tables, the 2d poker software server has to ensure that the game on any table does not stop or hang till the time the tournament is over.
From time to time, the server checks the status of the tables and of the connected clients.For each client, the server uses a heartbeat mechanism to keep track of the health of the client. If the client is deemed to be disconnected, the server updates the database and removes the presences of the player from all the tables that he/she was playing on.
For each table, the server checks if the game has been proceeding normally. If the hand gets stuck for some reason, for example if all the players get disconnected on the table, the server cleans up the table and restarts the game on the table.
Needless to say, if there are around 1000 players on different tables, things get pretty hectic on the server side but that something that is inbuilt and designed for in the is first place.
This was our first attempt at giving you insights into the inner workings and the wheeling-dealings that go on under the hood of the 2d poker software while you play the beautiful game of poker. Next week, we will share with you the internals of back office and why back office is such a critical component.
~ Software Development Team







One Response to “Into the Realm of 2D Poker Software”
Wow this is a great resource.. I’m enjoying it.. good article