Thank you for visiting Blazing Games

Poker Dice Pre-alpha

8:30 Now comes the first hard part, and is the heart of the game. Scoring. To score a hand, the hand has to be ranked, and within each rank there needs to be a sub-rank in the case that two people have the same rank of hands. While it is possible for a tie, as both players could theoretically throw the exact same hand, we are concerned with making sure that five aces beats five kings. I haven't done the fancy version of the dice using letters instead of numbers at this point so 6=Ace, 5 = King, 4 = Queen, 3 = Jack, 2 = Ten, and 1 = 9. This is going to be a long entry as I explain how I did this.

The first step is to sort the dice. This lets you easily check for both a straight and see the lengths of pairs. Next step is to assign a score to the results. What I did here was to turn the hand into an integer value based on the ranking of the hand followed by the secondary information. The hand rank is initially put into the score variable and is shifted left as additional data (the value of the rolls, and extra dice). To make sure that high scores are high, filler is used when there is not enough other data.

Why does this work? Well, if you have a full house 3s over 5s then your score is 4 left shifted 15 positions plus 3 left shifted 12 positions plus 5 left shifted 9 positions. If your opponent rolled a full house 5 over 3s, their score would be higher as the 5 would be left shifted 12 positions and the 3s would be left shifted 9 positions and that would result in a higher number.

If I was writing this code for a client or didn't have a super-tight deadline, I would then write some testing code to go through a series of hands from which I know what the results should be and verify that the test cases are all working. Time is not a luxury, so testing of the results will have to be done as I develop the rest of the game. At this point I published the game and realized that I forgot to change the publish settings so I inadvertently overwrote my Threes game as the publish settings were set up to use the name Threes.swf for the executable. While it is easy enough to rebuild Threes from the source code, this does demonstrate why backups are always a good idea. Still, for a pre-alpha game the game does seem quite functional. The game does let you re-roll multiple times and does have an issue with declaring the worst hand as the winner, but that's because in Three's (which it is using a bunch of code, after all) rewards the lowest hand with the win. While I am going to keep the build designation as pre-alpha, I am changing the title sequence now to reflect the fact that this now alpha stage code as the game is in a fully playable state.

11:15 Lunch or is that brunch as I haven't had any breakfast yet.

Previous page
Making Poker Dice Page 3

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2008 Blazing Games Inc. All Rights Reserved