Pixel Poker – Quick Update – Dealing Animation

So the past week and a half I got a bit distracted from AI. Since I first started working on Pixel Poker, and got the basics of players and hands implemented, one of the things I’ve wanted to implement was a nice card dealing animation. I always hated that the cards would just appear in front of the players without any “explanation” and knew that if I could make a good animation for the card dealing it would make the game feel much less like a quickly put together program, and more like a real game.

Well, this past week, I finally thought of a solution to this problem that I not only felt comfortable implementing, but I was also reasonably confident would work. Implementing the solution required me to re-work a couple more of the back-end systems in my game, but it was definitely worth it. Below you can see how the animation looks so far:

DealingGif

There are still a couple more improvements I’d like to make to this system, but overall it does exactly what I wanted it to do. The biggest change I plan to make from here is to make the deck look like more than just a stack of black, and add some basic color variation. On top of that, I may modify some of the dealing speeds. Other than those two issues though, I’m very happy with the system, and with the changes I made to the back-end components which allowed me to make it work.

Pixel Poker Update 6 – UI, AI, and Back-End Improvements

It’s definitely been longer than I intended since my last update, but I’m going to be putting up my next update in the next day or so to try and make up for that mistake. The first update will be this one, talking about the AI I’ve implemented, and a number of other changes which have improved the game as a whole. The second update will be a character update and will talk entirely about the characters in the game. That update will have more information about the characters themselves, and who they are. Without further ado, here’s how the game’s looking:

PPScreen

If you looked at the last update, the game should look pretty similar to what it was before. Sadly I didn’t get to do too many visual improvements since the last version. I’ve made a few small changes to the colors in the UI in certain places, but the general look of the game is basically the same. Most of the UI changes are more obvious during specific moments within the game.

High Card

The first change I made was related to the high card deal that occurs at the beginning of the game. I was having a lot of trouble telling who had won the high card deal so I decided to make it more obvious by highlighting the character who has the high-card, and creating a text object above them that says “High Card”. This occurs for the winner, and also highlights every player involved in a tie if multiple players have the same high card. I also turned off the system that automatically starts the game after the high card has been determined, and gave the player the ability to choose when the game would start. These two changes together were a substantial improvement and made the whole high card process much clearer. Below you can see an image of what the player looks like when they have the high card, and what a tie looks like.

HighCardScreen

HighCardScreen2

Improving Alerts

The next UI improvement I made was related to the alert system I developed for the last update. Previously the alerts would disappear after a certain amount of time. This meant that if the player got distracted, or wasn’t paying close attention, they might miss what action the opponent took, and not know what was going on when they went to take their move. To prevent this issue, I made it so that the alerts stick around until the end of a round of betting, or until they are no longer valid. So if a player raises, all of the Called and Checked alerts disappear, but none of the Folded, and Out alerts disappear until the round has ended. Below you can see what the current alerts look like.

AlertRaise AlertChecked AlertFoldedAlertCalled

You can also watch this gif to see the alerts in action, and what happens when a player raises.

AlertGif

I also wanted to make re-raises clearer to the player. In a real game of Texas Hold’em, it’s not uncommon for multiple players to raise in the same round of betting, or for one player to re-raise another to try and force them out. With my previous system, only the most recent raise would be visible, so if the player looked away or got distracted, they may not know how the Pot got from where it was before to where it is now. To solve this problem, I made it so that when a re-raise occurs all of the existing raises get “demoted” and are moved physically downward out of the alert area, and grayed-out. This shows they are not the current raise, but are still relevant. This allows the player to step away from the game for a minute and come back still come back in without any confusion.

ReRaiseGif

The final small change I made to the alerts was the Winner alert that pops up at the end of a round to show who won. Previously this screen only showed who the winner was, but didn’t say how much they had won. I fixed this so that the win screen would a bit more informative, and below you can see what it looks like. Eventually I’m going to make it so that the win screen will also highlight what cards that were used in the winning hand, or say what type of hand the winner used.

WinnerAlert

I also added a Pause screen to the game for obvious reasons. Right now it doesn’t have any options, but I thought I should add it in now and get it out of the way. You can see what it looks like below.

Pause Menu

Implementing AI

By far the biggest things I added to the game for this update were the AI improvements. In previous versions of the game the AI was very simple and would basically just call in all scenarios. Obviously this didn’t make for a very interesting game. I finally set about solving this by implementing the AI I had been planning. With this update I implemented what I’m referring to as the first draft of the AI that’s used on the initial deal, before the flop is dealt, and I created an accurate system for Out detection. To gain a better understanding of exactly what I did with this update there are a couple poker concepts/strategies you should know about.

Chen Formula

The first concept I implemented is referred to as the Chen Formula. The Chen Formula is a simple formula that a poker player can use to determine whether the hand they’ve been dealt is really worth playing and betting on. Below you can see the Chen formula rules. Take the highest card in your hand and use these rules to determine your hand’s score:

  • Ace = 10 points
  • King = 8 points
  • Queen = 7 points
  • Jack = 6 points
  • 10 through 2 = half of face value (i.e. 10 = 5, 9 = 4.5)
  • Pairs, multiply score by 2 (i.e. KK = 16), minimum score for a pair is 5 (so pairs of 2 through 4 get a 5 score)
  • Suited cards, add two points to highest card score
  • Connectors add 1 point (i.e. KQ)
  • One gap, subtract 1 point (i.e. T8)
  • Two gap, subtract 2 points (i.e. AJ)
  • Three gap, subtract 4 points (i.e. J7)
  • Four or more gap, subtract 5 points (i.e. A4)

The examples used here come from SimplyHoldem.com

Once you have the score for your hand you can then determine whether a hand is worth playing by looking at your position in play(how early or late in the betting are you), and the actions of the previous betters. The later you are in the play, the lower a Chen value you can risk going in with. With this update I not only gave players the ability to check what their position in play is, I also gave them the ability to calculate their Chen value. Then, I took the standard betting principles/rules with the Chen formula and modified them based on the style or skill-level I wanted to model a given character after. So a fairly good player is going to consider their position and their Chen value when deciding whether to play. Less skilled players place more value on things like having a pair, even if it’s not a great one, having a high card, even if it’s not connected to or the same suit as your other card, and even use a flawed form of Chen evaluation. The really poor players also don’t consider their position since that’s something most players don’t do when they first start out.

By combining the basic principles of the Chen formula and thinking back to how I and my friends played when we weren’t as good, I was able build AI that could represent the different players in different ways. While I’m still tweaking how each player reacts, and what Chen values they will go in on, I have at least a good starting place for each of their pre-flop AIs. Below you can see a gif of a few different deals and how the players don’t always behave the same way. Right now Bernard and Yuri have particularly conservative play patterns so sadly they didn’t come in on any of these games, but you can still see pretty varied behavior among the other three non-player characters Roxy, Turbo, and Tom.

PreFlopBetting

Outs

The other major AI system I implemented is the ability for a player to determine how many Outs they have. In Hold’em, an Out is a single card which could be dealt that would make your hand the winning hand. Here’s an example: If you have an Ace of Diamonds, and a 9 of Clubs, and the flop is a 5 of Hearts, 7 of Diamonds, and King of Diamonds, then you could have the winning hand by getting any of the remaining Aces. That means you have three outs, since there are four total Aces in the deck and you have one of them.  Your hand could become better by getting a 9 as well, but those wouldn’t be Outs because you have to assume one of the other players has the King-pair and that would beat your 9. You also have 10 more potential Outs from the 10 remaining Diamonds in the deck which could give you a Flush. The problem with these Outs is that you’d need two Diamonds to make the flush, so no individual diamond could give you the winning hand at this point. Some people would consider those Half-Outs, but it’s a matter of opinion whether they should be considered.

This was a particularly challenging thing implement because of the difference in the way computers process information and how humans do. Thankfully, after some hard work I was able to make an accurate system to count how many Outs a player has. While I haven’t taken this system to the next step and started using it when determining actions and potential moves, I am well on my way to having the AI for post-flop play implemented.

Back-End and Debug Systems

Along with all the user and gameplay-centric updates I did, I also went through some of my old code and improved a number of things. I even eliminated a small memory leak I noticed. Doing this not only made the game function more smoothly, it also allowed me to create a debug mode where I can change the cards player have at will. Previously, because of the way the cards were handled, I couldn’t easily change the cards mid-game and testing certain scenarios was a huge pain. With the improvements I made to this version I was then able to make a very simple menu which I can use to change a card at any time and see the results almost immediately. At one point I was trying to track down an issue related to the way Straights are detected, and without this new menu and debug system in place it would have been a gigantic pain to find and resolve.

Art Progress

The final thing I want to mention in this update is the art progress. Sadly the art has not progressed much. While I’d like to think I’m an okay artist, character art is not really my specialty. With this in mind I decided it was better to simply contract out the character art and move forward with the parts of the game I am good at. I reached out to a friend who is an artist and we came to an initial agreement about me contracting her for art duties. While I’m still in the process of sending her information regarding what I’ll need for each character, what sort of style I want, etc, I should have the first sample image before the next update after the initial Character one. From there I can take the next step and either actually contract her, or start looking for another artist. I still plan on doing the environment and UI art if I can, but I will have to see where the game takes me and whether it is feasible as I get closer to finishing certain parts. Likely whoever I end up hiring to do the character art will do basic layouts for the environments and give input on the UI, but I’m still not sure whether I will ask them to do the full art for that as well.

Stay tuned for my other update this week, which will give all the details on the poker players available in the game.

My New Job and Other News…

It’s been a while since I posted on here, but thankfully it’s for good reason. The primary reason I’ve been quiet is because I was hard at work on an article for GameDevTuts dealing with Board Game Design. The article covers how to make a board game from conception, to design, to development, to playtesting, and even touches on publishing your game. I submitted the article to my editors today, and while I know I will have to speak with them and make changes before the final draft is approved, I’d be surprised if it didn’t come out some time this month, so check back soon for more news on that front.

Library

On top of the article though, I also started a new job. As of October 20th I became the Technology Training Coordinator at the East Brunswick library in East Brunswick, NJ. Essentially I am the person who is in charge of all the technology oriented training programs that my library runs. This includes classes we run for library patrons, instructional sessions for library staff, and classes we run for general township employees. My primary duties include scheduling classes on our events calendar, working with patrons when they have issues registering for courses, and, most importantly, making new classes for us to introduce at the library.

Right now our stable of classes is relatively tame and doesn’t include many topics beyond MS Office 2010 and QuickBooks. To remedy this issue I am currently working with my boss to develop a whole suite of new classes for the library. Right now I’m working on a class dealing with Web Design through WordPress, then I’m going to be doing a class on Photoshop or Photoshop express and Digital Photo editing, and then I’m going to eventually do a class on Game Design, and I’ll probably use Construct 2 for that one since it’s so accessible.

It’s a pretty exciting opportunity, and having this job allows me to drastically cut back my hours at the call center, which is always nice. While I don’t know if I’m going to be in this position forever, especially since it’s not full-time right now, I definitely think it’s better than what I’ve been doing, and it should be a great opportunity for me to explore new technologies and meet new people. I’m really excited to see where it takes me, and for the first time in almost 1.5 years, I’m really happy to get up and go to work most days.

Anyway, that’s all I’ve got for now. Check back again soon as I’m going to try and do a post about Path of Exile, a Diablo-esque RPG that just came out of Beta and which I’ve been enjoying a lot so far.

PoE-logo

Changes to my site…

If you’ve been here before you may notice that the site has gone through some pretty major changes since the last time. There are a number of reasons for the changes, but the biggest one by far is that with my previous site design I felt like it wasn’t easy enough for viewers to see my work, and for me to express my opinions about my work. As a growing game designer I think it’s important I am able to reflect on my work and talk about how I accomplished different things, and before now it felt more like each post was a product page for what I was releasing. This feeling often made me reluctant to post incomplete or in-progress work and made my site feel empty because of the lack of content. I think this format will be better overall and will allow for a much better presentation of the work I’m doing. Over the next few weeks I’ll be posting a lot of work I never got to post before and I’ll be slowly making a number of changes to the site, so bear with me while I make all these updates, and keep watching for all the cool stuff I’ll be showing off.