I know it’s only been a few days since I initially posted about Pixel Poker, but I think the next few iterations I go through will require some big changes, so I thought it was important to show what I have so far before the game starts to look very different.
Over the past few days I’ve made some very important progress. The first thing that I did was implement win detection so that the game can determine which player is currently winning or wins when a round is completed. If you watch the gif below you’ll see this in action:
If you have any experience with poker than you should be able to follow most of these hands, but I quickly want to explain how the win detection works. The easiest way to determine a winner is obviously to assign a value to all of the hands. My initial idea was simply to add up the cards in the hand, and then multiply the resulting value or increase it by some constant based on what type of hand it was. This worked in some cases, but it created a number of situations where the system could easily assign the wrong player as a winner when two players had similarly ranked hands. For example, if two players both have two pairs, then the winner is the person with the highest pair, not the person with the highest average value between their pairs. This means that if Player 1 has a pair of Aces, and a pair of Threes, and Player 2 has a pair of Kings, and a pair of Queens, then Player 1 should win. Even though both of Player 2′s pairs outrank the 3s that Player 1 has, his Aces win out over everything. If I had used my original system then the value of Player 1′s hand would have been Ace+3, or 14+3 = 17, and the value of Player 2′s hand would have been King+Queen or 13+12 = 25. No matter how I modified these values, Player 2 would always come up as the winner, even though that’s not how the game works.
Depending on what hand type a player has, there are a number of ways that a tie can be evaluated, but in the end a tie will never be evaluated by more than three comparisons. Below you can see how hand comparisons work in poker for each hand type:
- High-Card – Player has no poker hands of any kind, just one card that is high value.
- Highest card wins
- Pair – Player has one pair in their hand.
- Highest pair wins
- Then high-card wins
- Two-Pair – Player has two pairs in their hand.
- Highest pair wins
- Then next highest pair wins
- Then high-card wins
- Three-of-a-kind – Player has three cards with the same value in their hand.
- Highest three-of-a-kind wins
- Then high-card wins.
- Straight – Player has five cards in an unbroken sequence of values. Cards don’t need to be the same suit.
- Straight with the highest card wins
- Flush – Player has five cards all of the same suit. Cards do not have to be connected based on value.
- Flush with the highest card wins
- Full House – Player has a three-of-a-kind and a pair simultaneously.
- The highest three-of-a-kind wins
- Then the highest pair wins
- Four-of-a-kind – Player has four cards with the same value in their hand.
- The best four-of-a-kind wins.
- Then high-card wins.
- Straight Flush – Player has a straight where every card is of the same suit.
- The straight flush with the highest card wins.
As you can see, there are only a few cases where a secondary or even a tertiary comparison needs to be made, but when it does happen it is an important distinction to determine the winner. Because of this, I created three hand values for the player. The first is always the combination of the value of the hand type, and the value of the highest card or sub-hand-type that makes it up. So if a player has a pair of 5s, their hand value is PairValue+5 or 200+5=205, since I valued pairs as 200. The second value is whatever the next aspect of their hand would be, without any modifier. So if a player had Two-Pair with Aces and Threes, their secondary hand value would be 3. Finally, the third value is whatever the third comparison would be. With the comparisons I show above, a Two-Pair is the only one that would ever get that far, so the third value for that would simply be their remaining high-card. In a situation where a poker hand only has one or two comparisons, I simply leave the remaining values as 0.
The other things I added since the last post were the ability for a player to Fold, and the ability for a player to be removed from the game entirely. In the first gif below you can see what happens when a player has folded:
As you can see, when a player folds they are only removed from the game until the round ends. On top of that, if the currently winning player folds, the system automatically readjusts to find the next best player.
In this next gif you can see what happens when a player runs out of money and is removed from the game entirely. Removing a player from the game entirely required me to introduce Money into the game. Since I haven’t added a betting system yet, I also haven’t made the money a player has visible, since it will always be either greater than 0, or equal to 0:
As you can see, once the player is removed from the game, the game continues on and they are never dealt any more cards.
The next thing I want to do with the game is introduce a betting system and start keeping track of money. While I don’t technically have to start turning it into an actual game yet, and I could continue working in this abstract state for a little while longer, I think this is a good time since I will need to start considering how rounds/turns will progress, how AI players will make bets, and how the game will actually play out. Because of this, my next step will probably be to rough-out the UI and the look of the game as a whole. I already have a few ideas about how the game will look when you’re playing, but I haven’t yet decided what would be most interesting, or give the player the best ability to see/understand their AI opponents. There are also a few more things I want the AI players to be able to keep track of that I haven’t implemented yet, so I’ll probably do that soon as well.
My next post about the game will probably deal with the possible interfaces and UIs that I’m looking at and may just be sketches, but I’ll see how much I get done in the coming days. I also plan on doing some research on Texas Hold’em strategies soon to give me inspiration for how the AIs might work, and I’ll probably download and play some similar games like Poker Night at the Inventory by TellTale games, or even some games which are designed to help you become a better poker player. This should give me a good understanding of what I like about similar games in the genre, and help show me what works and what doesn’t. In any case, I’ll be back again soon with another update, so I hope to see you then.