Today we released a Texas Hold 'em Poker game on the Spanish social network Tuenti. Go have a look at it here:
http://www.tuenti.com/#m=Game&func=index&page_key=6_699_915
( You need a free Tuenti account AND be over 18 years old to be able to play )
Here's a quick video grab, if you don't want to register for an account:
This was quite a rush job as I only had two weeks to make this poker game with a decent computer AI. Taking in account that I never even played poker before, it started off quite nerve wrecking.
So first diving into the basics of how to actually play Texas Holdem; "Governor of Poker" was basically the game I used to learn Texas Holdem and actually see how it's supposed to be played. If you look carefully, you might notice how I "borrowed" some ideas from that game as well. Hats off to Youda games for an awesome game.
I quickly learned there was quite a bunch of rules and special situations to take in account. Both for the UI and for the AI. Two weeks started to look like an impossible mission and the only way out was to start relying heavily on Google to get me as much as possible programmers tutorials and any sort of info on poker games that would help me shortcut development. I usually rather do the puzzle myself, but there was just not enough time for this project. Here's some of the pages that helped me out tremendously:
* An article by Nick West on Cowboy Programming was really the basis of getting this game done in time. Great article but without a single line of code, which is great because this way you really learn the inner workings of the game and makes it easy to implement your own changes. Thanks Nick!
* Just when everything was running smoothly, a poker-playing friend pointed out that poker used something called side pots. If you know how those work, you'll understand why it instantly gave me the biggest headache this year. After wasting a couple of hours trying myself, I found a similar question on Stack Overflow and the answer by Sami worked just perfectly. Instead of keep track of multiple pots, his idea is to basically count backwards after the game has finished and divvy up the shared pot.
* For all the movements of the cards, etc. I needed a simple Tween library instead of programming all the movements by hand as I usually would have done. - I picked up Actuate which luckily didn't let me down. Actuate is going to be in all my projects from now on! :-)
All in all I'm quite happy with the end result, even though the AI is a bit of a CPU hog ( in fact, I had to disable all buttons and animations while the computer is "thinking" ). I'm sure determining hand-strength can be done more intelligently instead of using a brute force technique like I'm doing now, but I didn't have the time for that. Maybe one day when we're making a mobile version, I'll try and optimize it, but with a more relaxed schedule please :-)