• Register
Luckslinger poker 'mini-game'

So a little while ago Donald (the designer) came up with the idea that we should have poker in Luckslinger. I wasn't sure if this was a joke, or if he was serious. Either way I decided to ‘experiment' a bit, because to me trying to make poker seemed like a new challenge.

Posted by on

So a little while ago Donald (the designer) came up with the idea that we should have poker in Luckslinger. I wasn't sure if this was a joke, or if he was serious. Either way I decided to ‘experiment'
a bit, because to me trying to make poker seemed like a new challenge.

Either way, one weekend a while ago I was a bit bored and decided to give it a try, I started by reading how poker works and then programming the basics, a card deck with cards that can be shuffled and that can be laid out on the table. I was already quite happy with this, little did I know that the hardest part was about to come.

Because I had hardly played poker before I wasn't really aware of all the different kind of pairs there were, but I read some stuff on the internet and starting making my ‘pair recogniser' so that I can see which pairs are on the table and I can score them against each other and get the best pair on the table.

After I finished this up, I figured that I was already pretty far. Because I would have to test many pairs and I didn't want to manually test all of them, which would take really long, I decided to set up automated tests for poker. I was able to simulate cards on the table and then run tests against them. For example if there are two 2's there should a be a one pair of 2's on the table. But when there are two 2's and two 3's there should be a two pair of 2 and 3 on the table. Etc.

Just when I thought that finding pairs was quite tricky, I started working on a thing that scored all the pairs and would choose the best one, a part of this was not hard, but another part was..quite hard. After I eventually got this working it was quite usefull because I could use the same code for the AI to decide how good his hand was (or how bad it was).

After I got all that stuff working I was really pleased with the end result, the only thing left was the poker-AI and some bugs fixing ofcourse. After googling around a bit I found that real poker AI is insanely hard to make and because this is a ‘mini-game' of Luckslinger, I decided to keep the AI relatively simple.

Currently the poker is implemented into Luckslinger, so you can talk with a guy in the Saloon and poker against him. The way it will probably work is that you wager some money (\$50) and then if you beat him at poker, you will win \$100. Otherwise you could just exploit it and get crazy rich ^^

I might do a more in-depth (programming) post about how I programmed the poker and all the stuff around it later, but for now I'll leave it at this.

Luckslinger is currently on steam greenlight and kickstarter, it also has a playable demo there so if you want to try the game out, be sure to check the links!