Pixel Poker

Oh how time flies. I’ve been meaning to start posting again for a while now, but ever since Ludum dare 28 I’ve been a pretty busy guy. I could spend a whole bunch of time talking about why I’ve been busy but I’ve tried writing that post about 10 times already and found it pretty boring every single time. As a quick summary, I took a 2 week trip to Israel in February as part of the Taglit-Birthright program, I helped create a 3-session course on Game Design for the East Brunswick Public Library, and I made some pretty good progress on learning Game Maker Studio.

I’ll probably post more in the next few days about the course that I developed for the library and what I learned from it, but for now I really wanted to make a post about a project I’m working on which I’m calling Pixel Poker. For the past few months, my friends and I have been playing a lot of Texas Hold’em. At first it started as a one time thing, but before long we had played 7 weeks in a row and were showing no signs of stopping. This got me thinking about how you would make a Poker/Texas Hold’em video game. I thought about it for a while, and I began to think it would be really fun to try and build complex and interesting AI players to play against.

I decided to run with the project and use it as another great vehicle to learn Game Maker Studio with. So far I would estimate I’ve put about 7-10 hours into the game, and I’ve been working on it since the middle of April. At this point in time I am pulling cards from a randomly shuffled deck, I’m able to accurately detect what poker hands each player has, and I’m able to detect whether it’s possible for a player to get a straight or a flush based on what cards they have, and what’s been revealed. If you look at the gifs below you can see some of the aspects of the game in action. The first gif shows me shuffling the deck multiple times:

DeckShuffler

 As you can see, the deck starts off  ”in order”, and every time I hit shuffle the cards are shuffled randomly.

This next gif shows the cards being dealt for an actual game of Texas Hold’em. As you can see, below each player is a listing of the poker hands they currently have. You’ll notice that the High Card value always shows the highest value card that’s not linked to some other poker hand, not just the highest card value available to the player. On top of that, if the player were to somehow have three pairs available, or two triplets available, the system only keeps track of the best two pairs, or the best triplets. Look at the gif below to see this in action:

DealingHands

The most recent thing I implemented is the ability for players to determine whether its possible for them to get a Straight or a Flush with the current cards.

StraightFlushTest

Eventually I plan on extending this to give them the ability to see if they could get a four of a kind, or a full house, and to determine the likelihood of other players getting high value hands based on the cards the dealer has flipped.

Once I finish giving the players the ability to determine what hands other players may have, and what they may get, I will implement a betting and turn system. From there I will have to make an automated betting system that allows thew size of a players’ bet to be influenced by their hand.

Finally, I want to eventually try and make a system that allows the AI players to evaluate the actions of other players and determine if they are bluffing, or how likely they are to bluff. I’m not 100% sure how I will detect when players were bluffing and when they legitimately thought they would win, but I think it will come down to comparing their final hand with the winning hand, and the best hand that could have been played. The real challenge with this will be taking into account the fact that a player may have had a very good hand when the initial three cards were turned, and bet high because of it, but then been beaten by the fourth or fifth revealed card.

Once I have these systems in place I will try and implement character portraits and a basic animation system so that the player will be able to evaluate the actions of the AI, but that is very far down the line at this point.

For now that’s all I’ve got, but I should be posting again soon about other things I worked on the past few months, and any progress I make on this project.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>