Archive for the ‘auction poker’ Category.

Auction Poker Update! Finally free from cards!

Alright, Auction Poker has been updated with new trophies and some graphical changes. Note to game designers: if you put point values in the trophies themselves, it makes it harder to change their requirements!

I wanted to reduce the requirements for meeting the poker chip trophies but it would’ve been really odd to earn a trophy that says 500K on it with only 250,000 points.

Also, I completed my four-part section on making the AI for Auction Poker. The first two posts are a bit of a rehash from the previous time I tried to do it but there’s a little more information.  It was originally a bit longer since I edited out big chunks that I thought were going to be confusing or boring.

With this update I am free from working with card games for a few months! Next, I’ll be working on some updates to Aliens Over Hawaii - mainly adding sound effects, music and an extra difficulty mode. I also want to dig down and figure out why the payout for the game seems to be quite lower than other games.  I suspect there’s a bug based on an examination of the Game Metrics.

In addition, I’ll be re-doing the “Making Of” video that I never finished. This clip was the introduction to that half-finished video. The second part of that video would’ve been this clip which showed roughly how the stages were made and where they were located on the island of Oahu.

In retrospect, I’m glad I didn’t finish that video. I don’t think it would’ve been as interesting as the new video I’ll be making. Instead of showing how the game is built, I’ll be showing the process of making the game. I’ll show the initial sketches, stages that didn’t make it into the game and other bloopers:

Well, that’s it for now. Time to make some music and sound effects.

Auction Poker AI - Part 4

PART IV - Bidding, tweaking and the Last card.

The big hole remaining in the AI was bidding.  The AI is constrained to the same limits as the player  - they have the same amount of chips, can only bid in increments of 5 chips and don’t know anybody else’s cards or know which cards are coming up. However, they do know how many cards are remaining in the deck.

Like the process for picking the cards, I tried to approach coding this process from the point of view of a person playing the game. For example, if I know that a card works really well with my hand (high affinity) then I’ll bid a lot higher than I normally would.  That was the very first step in the bidding process - the higher affinity, the higher the bid.

If I’m playing against more players, I’ll also tend to bid a bit more. Thus, the more players on the board the higher the bid will be. However, each AI player has their own personality - a high bid for one player might be 40 or 50 chips, while for another player it might be 20 chips.

After this bit of coding,  I played many games against the AI players and while I found that they were generally decent players they were still a bit too predictable. Human players would not be as predictable. They might try sneak in a win by:

  • bidding really low on a half-decent hand.
  • skipping bidding on the first round and waiting  until the second or third round.
  • randomly picking a card and see what they can build.

So I went ahead and coded all those types of behaviors into the AI and even a couple more.

The final part in coding fittingly dealt with selecting the final card. While the AI managed to get 5 cards most of the time, there were still occasions where an AI player stopped at 4 cards.

After some testing, it turned out that some of the AI personalities were still a bit too rigid - if they went for a Flush, they only bid on cards that gave them a Flush, even if that meant Booching.  If I was playing the game, I would give up the Flush and just settle for a Pair if I was about to Booch.

In Part 2, I mentioned that the AI is aware of what Condition a new card will make its hand:

1. Royal Flushes are possible
2. Straight Flushes are possible.
3. Flushes are possible. Straights are not possible.
4. Straights are possible. Flushes are not possible.
5. Only pairs, trips, full houses, etc, are possible.

Most of the time, the AI selects cards that keep it in the same Condition so that the new card won’t spoil a good hand. However, a spoiled hand is better than a Booched hand.  So I added code directing the AI to allow itself to select cards of a much lower Condition if there are few cards remaining in the deck.  This also is dependent on the AI’s personality - a ‘few’ cards to one might be 5, to another it might be 15.  The AI will also increase its bid to avoid a booch.  How much it increases its bid depends on its personality as well.

So in summary, that pretty much covers how the AI in Auction Poker works. What surprised me the most was how many subjective adjustments and refinements I had to put in place. Before I began coding the AI, I thought it was going to be a matter of brute force calculations to find the best cards and bid on them. The calculations turned out to be just the very first step.

Auction Poker AI - Part 3

PART III - Resolving a bottleneck.

At this point, the AI for the computer players has a pretty good foundation. They’ll bid on the good cards and ignore cards that spoil decent hands.  However, after having a few AI players play against each other I noticed a lot of booching of this type:

They always seemed to go for the Royal Flushes and the Straight Flushes and they never bid on anything else. As a player I don’t always go for those hands; sometimes I try for a Full House or 4-of-a-Kind instead. I needed to tell the AI to try some variety in picking its hands.

However, the big problem at this point was that the AI bid on cards with the highest affinity and those  tended to be cards that made Straight Flushes and Royal Flushes.  So how would I tell the AI to try different hands?

The solution turned out to be pretty simple but it meant adding a lot more calculations and charts to the AI code. Remember that the affinity between cards is directly dependent on which hands they can make and the amount of chips each hand is worth:

If I don’t want the AI to try for the Royal Flush or a Straight Flush, then I’ll make those hands worth 0 points which will in turn affect the affinity calculation and which cards the AI will pick.

This is what happens to the affinity of suited cards when the Royal Flushes and Straight Flushes are taken out of the equation.

As can be seen on the updated chart on the right, the rank of the card in suited pairs becomes irrelevant with those two hands out of the way. To the AI, any two cards of the same suit are the same and it would try for plain Flushes instead of those higher hands.

From that point it was a simple matter of zeroing certain hands so the AI would bid on the others. For example, zeroing out all the Flushes and Straights meant that the AI’s would try for Full Houses, Three-of-a-Kinds and Four-of-a-Kinds.

I also started to give each AI player its own personality - some of them will go for the highest hands all the time and others will switch between trying for Full Houses and Straight Flushes every other round.

At this point, the AI is working fairly well but I still needed to add a bit more personality to iron out some kinks. In addition, while the AI pretty much knew which cards to bid on, it still wasn’t very smart on figuring out how much to bid. On to Part 4.

Auction Poker AI - Part 2

PART II - Refining the affinity method.

The first step the AI makes when given a set of cards is to find those that have maximum affinity. Given the set of cards pictured below, the AI would pick the King of Clubs and the Queen of Clubs.

After the first two cards, however, the AI needs to be careful in determining which cards to bid on and how many. The next best card is the Jack of Clubs but after that, the AI would pick the Queen of Spades which would spoil the chances for a Royal Flush.

I needed to find a way to tell the AI avoid some cards. The easiest way of doing that was by having the the AI only bid on cards that exceeded a minimum affinity with the rest of the cards.

For example, the average affinity between the King and Queen of Clubs with the Jack of Clubs is about 22. However, the average affinity between those three cards and the Queen of Spades is only about 18. So, if the affinity cutoff is higher than 18, the AI will only select the first two cards and will wait until further rounds to bid on the right card.

However, while the minimum affinity cutoff worked okay in testing, there needed to be a lot more work before it was ready for the game.

When I looked at the cards above, I made the decision not to bid on the Queen of Spades because it would SPOIL the chances for a Royal Flush. I needed to show the AI that by selecting the next card its range of possible hands would be drastically diminished.

In that respect, I added a function that had the AI determine which hands were possible given a set of cards. For example, having any card lower than 10 automatically means that a Royal Flush isn’t possible.

After some tweaking and testing, it turned out that each set of cards fell into one of these Conditions, sorted roughly in order of hand value:

1. Royal Flushes are possible
2. Straight Flushes are possible.
3. Flushes are possible. Straights are not possible.
4. Straights are possible. Flushes are not possible.
5. Only pairs, trips, full houses, etc, are possible.

For example, if these three cards were in the AI’s hand:

Condition #1 is not possible since we have low ranked cards.
Conditions #2 and #3 are not possible since the cards have different suits.
Condition #4 is possible since the maximum difference in ranks in 2 and the cards all have different ranks.
Condition #5 is possible for all hands and isn’t checked.

Looking back on the cards from the first example…

…the first three cards would fall under Condition #1. However with the addition of the fourth card, the set of cards goes all the way down to Condition #5 - Neither Royal Flushes, Straight Flushes, Straights or Flushes are possible with that extra card.

From that, it’s a simple matter of adding a couple of variables to the AI - one for the current Condition and one for the updated Condition. If the Condition changes too much then the AI refuses to bid on the Card. Dropping from Condition #1 to Condition #2 is not too bad since a Straight Flush is still a pretty decent hand. However,  bidding on a card that drops a hand from Condition #1 to Conditions #5 is not a good decision.

After some more testing with this new code, I found that the AI’s were still booching too much.  It turned out that every single one of them was always trying for the Royal Flush or a Straight Flush. I needed to put some variety in each of the AI’s personalities. On to Part 3.

Auction Poker AI - Part 1

Introduction

Auction Poker is a pretty easy game to explain. The player starts off with 200 chips and must use those chips to bid on cards and complete hands. However only 10 cards are shown at a time. In the first round there are five computer players competing and bidding against the player (and each other) for the same cards.

After completing hands, a chip bonus is earned depending on the hand completed. A Royal Flush earns 320 chips, while a Three of a Kind earns 100 chips.

Players have to be careful not to spend all of their 200 chips to make a simple Two Pair hand. If the player does not win at least 5 cards, there is a 100 chip penalty. After each round, the player with the lowest amount of chips is eliminated.

Making the AI for Auction Poker was a tedious, albeit fun, programming task. Originally, Auction Poker was to be a multi-player game but I felt the game would be more accessible if it didn’t require other people to play it. In writing the code for the AI, I tried to approach it from the point of a view of a human player. What cards would I choose and how much would I bid and why?

PART I - Affinity and the first two cards.

The first step in writing the AI was determining which cards the computer player would pick. I’m not concerned about bidding at this point, all we need to do is figure out which cards the AI should bid on.

If I was given this set of cards, which ones would I bid on?

With just a quick glance, I would probably bid on the King and Queen of Clubs since I know I can make a Royal Flush if the right cards come up and if not, I can settle with a plain flush or a 9-K straight.  Or maybe I bid on the pair of 10’s and the pair of 9’s and hope for a Full House.

How did I determine which cards I was going to bid on? I looked to see how well the cards worked with the other cards in creating a good hand. Each card has little value by itself. Only when combined with other cards is their value realized. For example, the King of Clubs is practically useless if all the remaining cards are low ranking Diamonds and Hearts.

To create the AI, I somehow needed to put into numbers that measure how well each pair of cards works together, which I call ‘affinity’. The Ace of Spades and the King of Spades have a high affinity since they can make high ranking hands together.  But the Ace of Spades and Seven of Hearts have low affinity since there’s not a good hand that contains both those cards.

I needed to create a chart that contained the affinity between each pair of cards. That chart would be used by the AI to help determine which cards it would bid on. At first glance, that seemed like a daunting task: (52 cards * 51 cards/2) is 1326 possible pairs. That’s a significantly sized chart. However, I realized that the specific suit of the cards doesn’t matter. It only matters whether the suit between the pair of cards matches or not. A Three of Clubs has the same affinity with a Six of Hearts or a Six of Diamonds. That drastically reduced the number of pairs.

Further below are some screenshots from the spreadsheet that calculated the affinity between cards. Each pair of cards was given a portion of the Chip Bonus based on which hand it could be part of.  The Chip Bonuses weren’t finalized yet at this point but it was easy to change them and see how they affected the affinity between cards. The sum of these bonuses is combined and made into a measure of affinity.

This chart shows how the affinity was calculated between a 3 and other unsuited cards. The final affinity is shown in the bottom row.

The final charts look like this:

It’s much easier to see what’s going on with a graphic chart. The brighter the green, the higher the affinity.

The charts highlight the big difference in behavior between suited and unsuited cards. With suited cards, there is some affinity with cards from very different ranks. The  affinity also increases as the rank of the cards gets closer together. At high ranks, the affinity is also influenced by the possibility of a Royal Flush. With unsuited cards, the only cards with high affinity are pairs. There is also some minor affinity between those of close ranks since it is possible to make a straight. But there is no affinity with everything else.

Now that I had these charts, I thought it would be a fairly simple matter for the AI to look at a set of cards and bid on those that had maximum affinity. However, things were not that simple. On to Part 2.

New Auction Poker Trophies

Spent some time this weekend drawing up the new Auction Poker Trophies. The image below shows nearly all of them. I’ll be coding them into the game during some free time this week and next week, unless some other commitments come up.  Except for the Poker Chips, the general theme of the trophies are royal and medieval items.  A little bit of trivia: all of the names of the AI players are from French Royalty.

Most of the writing is nearly done for the Auction Poker AI posts but I just have to dig down and get some numbers and make some diagrams.  I’ll wait to release the new trophies until I finish the posts but I do think it’ll be done by the end of the month.

Looking forward

So I finally listed Blackjack Square tonight. Took a bit longer than I originally intended but I think the final tweaks were worth it.

Anyways, here are the icons for the three games - Poker Square, Cribbage Square and Blackjack Square.

There is one suit missing and I’ve actually reserved that for the final Square game. It’s based on a game that’s not that popular anymore but I do like the mechanics of its gameplay and will probably be awfully easy to code. I’ll probably finish that one after updating Aliens Over Hawaii and Paint Factory, most likely near the end of the year.

Currently, the next big push will be to create about 30 new trophies for Auction Poker in addition to finish writing how the AI was developed. Hopefully I can finish all this in about a month or so but we’ll see.

Tinkering and Stuff

So I’ve taken a bit longer to release Blackjack Square but there’s a good reason. Even after lots of testing,  to check the trophies, it struck me that the outcome of the game relied too much on luck. While luck does play a part in the other two Square games, it seems to play a  much bigger part in Blackjack Square.  I did some tinkering here and there with the Switches but we’ll see what feedback there is when I release the game.

I’ve probably been a bit slow in finishing up the testing of the game because I’m already looking forward and dabbling with some other things on my list. Auction Poker is going to get a bunch of new trophies as well and I have written new drafts explaining how the AI works. (I’ll finish it this time, really!)

In addition, I wrote some themes on the piano for Aliens Over Hawaii so hopefully I can get some sound and music into the game, as well as fixing one rather annoying bug that seems to be affecting the scores.  A little bit of sound can really add to the game:  Depth Charge wouldn’t be the same with those pretty cool sound effects.

And after that, in a few months, Paint Factory is going to get a big upgrade with a couple of new modes and themes.

I also have a ton of ideas for new games so we’ll see when I can get them out. At this pace, somewhere around 2012.

Trying new things

Well I posted a couple of my games - Cribbage Square and Poker Square on Kongregate and Newgrounds this weekend. The results have been somewhat positive. I noticed a spike of played games this weekend. Cribbage Square was being played almost as much as Paint Factory on Sunday! I don’t think that’s ever happened. Paint Factory has always been a steady performer bringing a bit of bling every day. The one drawback have been the commenters on Kongregate - they are not as friendly as the people on Whirled and they are quick to jump the gun on “Stolen!” amongst other off-color comments.  But jerks on the internet are nothing new so it’s best to brush them off.

I also found a nasty bug that wasn’t that visible on Whirled but became much more visible on the external sites so I had to go back and fix some things. I’ll definitely have to be more careful in the future about testing some of the games for outside Whirled. It’s a good thing that I did a test for a couple of games before uploading everything at once.

I originally wanted to make Poker Square and Cribbage Square into multi-player games but now I think my time would be better spent in fixing up my single-player games. I just don’t think that Poker Square or Cribbage Square are going to get a lot of multi-player action. Paint Factory Challenge, the multi-player version of Paint Factory gets played 1/10th as much as the original Paint Factory. However as soon as I placed Poker Square and Cribbage Square on the other two sites the number of games played increased by about 400-500%. Of course, that only translates to a few hundred plays each day and I don’t expect the spikes to be sustain themselves but any trickle of blings and cents is nice.  With a few more of my games uploaded all those little trickles add up to some of spending money.

In addition, there are plenty of more fun multi-player games on Whirled, many of which I enjoy. Cribbage Square multiplayer can’t really compete against them.  My niche is definitely single-player games and I’m going to stick with them. After finishing my Aliens Over Hawaii video, I’ll finish up Blackjack Square then fix up some bugs on some of the other games - Auction Poker & Paint Factory - and upload those two to Newgrounds and Kongregate.  Even Aliens Over Hawaii will find their way to the other two sites, but I’ll have to do so lightening up on the difficulty and tweak some things since they won’t be able to save or  continue a game using the Whirled cookie. I’ll probably lighten some difficulty spikes to make it a bit more casual but even then it’s still a long game to go on one playthrough - about an hour.  Anyways, we’ll see how it goes.

Making them Multiplayer

Well, I’ve started working on Blackjack Square and I still think this will be a pretty easy game to code. The game will definitely be uploaded sometime in early to mid-November.

However, the other big thing I want to work on is making my current games multi-player. My very first experience with multi-player games was Paint Factory Challenge and that turned out to be a total bust. It’s barely played at all - only about 1200 games so far. It was also an unbelievable pain in the butt to code and test since I use Flash CS3 to develop my games. Basically I had to log on to Whirled every time to test the multi-player aspects of the game.

When I originally thought up of Auction Poker, I intended it to be multi-player but I really did not want to go through the hassle of creating another multi-player game and have it end up unplayed. There are a few good multi-player games on Whirled that end up minimally played. Games such as Zyraxxus, Spades and Gomoku. I’m speculating here that part of the reason for that is that these games require another person to play. Games that have single player modes, in general, seem to get a lot more play.

However, I’ve learned a lot since I coded Paint Factory Challenge several months ago and I’m writing up a few classes and tools that will help make multi-player games a lot easier for me. I also think that many of my games can benefit from playing with other people - it’d be awesome to have 6 people playing Poker Square at a time in a challenge mode.

So basically, once Blackjack Square is done. I’ll be going around my other games and making them multi-player. The trickiest game to make multi-player will be Auction Poker and I’ll be leaving that one for last. I still haven’t quite figured out what to do with a player that’s elimnated in the first round. Will they just sit there, waiting for the next round? Or will I need to re-work the elimination of multi-player to make it optional? I suppose I’ll figure it out.