Thunderjack! Playing Against The Dealer

Hey there, and welcome back for another update on the HTML5 Phaser version of Thunderjack!.

The project is starting to get interesting, because most of the UI is done, and I have begun working on the game mechanics and logic.

Updates include:

  1. Hit and Stand functions are complete.
  2. The dealer now plays (dealer AI) if there are any eligible players remaining.
  3. At the end of the round, winners are determined by comparing hands.
  4. A new round can now be played.

Let’s go over each of these in a little more detail.

1. Hit and Stand functions are complete

When taking a hit, the bust functionality is now complete. If a player’s score exceeds 21, the player will bust, and the Bust indicator will appear. The game then moves to the next available player.

Likewise, the player can stand. If they do so, the game then moves to the next available player.

A few notes on available players.

Thunderjack! Will allow you to place bets on one to three players. Since splitting is supported in this game, it is possible for you to split the hands to play a total of six hands in a round.

I assigned a “player ID” to each of the six players. This ID is a string that is used when referencing any of the player data, such as:

  • cards in hand
  • score
  • status (bust, blackjack, Thunderjack, etc.)
  • bet amount

The player ID is also used to reference the graphical UI for each player. Things like:

  • card graphics;
  • textfield for the score;
  • textfield for the bet value;
  • chips that represent the bet value; and
  • result label (won, bust, blackjack, etc.)

The player IDs are setup in code like this:

PlayerHandIds.LOWER_RIGHT = "lowerRight";
PlayerHandIds.LOWER_MIDDLE = "lowerMiddle";
PlayerHandIds.LOWER_LEFT = "lowerLeft";
PlayerHandIds.UPPER_RIGHT = "upperRight";
PlayerHandIds.UPPER_MIDDLE = "upperMiddle";
PlayerHandIds.UPPER_LEFT = "upperLeft";

When starting a round, you can play on any of the three “lower” hands. The “upper” hands are used for splitting, which will be implemented later.

There are also some additional IDs:

PlayerHandIds.DEALER = "dealer";
PlayerHandIds.DECK = "deck";
PlayerHandIds.DISCARD_DECK = "discardDeck";

The ID, PlayerHandIds.DEALER, is very similar to the six players, except that it does not use betting information, and it cannot split or double-down.

The ID, PlayerHandIds.DECK, is used when moving cards back into the deck (for reshuffling)

The ID, PlayerHandIds.DISCARD_DECK, is used at the end of each round when all players place all the cards in the hand into the discarded deck.

2. The dealer now plays (dealer AI) if there are any eligible players remaining

The logic for the dealer is simple. If if has less than seventeen points, it will take a Hit. Otherwise, it will stay. Also, the dealer does not double-down or surrender.

The dealer will play its hand only if there are any eligible players remaining to play against it.

An eligible player is a player who:

  • did not bust
  • did not get a blackjack, Thunderjack, or blitz
  • did not surrender

If there are no eligible players, the round ends, and the dealer does not play.

3. At the end of the round, eligible players now play against the dealer

When all players and the dealer have completed their turns, the hands of eligible players are compared against the dealer’s to determine winners.

4. A new round can now be played

After the round has ended, you can play a new round with the same bets, or you can set new bets on your hands. When you start a new game, all cards in the players’ and dealer’s hands are moved to the discard deck, then players are dealt new hands from the deck.

Have a look at this video to see the current progress:

Following Updates

As you can see, the game is coming along nicely. You may have noticed a few other details I didn’t mention, such as showing how much player’s won, or the credits in the upper-left corner of the screen are now being deducted when starting a game. Or, maybe you noticed that the credits didn’t increase when players win!

Ha! No, I’m not trying to put the shit on anybody; I just haven’t gotten to that part yet.

But let me go ahead and state some of the updates to come in the game:

  • Credits increase when players win.
  • Finish showing all the result indicators. Bust and Win show, but the others, like Blackjack or Push, show. Which brings me to the next to-do items.
  • Complete logic for Blackjack for player. If a player gets a Blackjack, that player’s turn immediately ends, he/she receives an immediate payout, and it becomes the next eligible player’s turn. A player who gets a blackjack becomes ineligible to play against the dealer.
  • Complete logic Blackjack for dealer. If the dealer gets a Blackjack, the game immediately ends and and player hands are compared against the dealer. Any player who has a blackjack results in a push. Players who get a Thunderjack! Will actually beat the dealer (this will be implement a bit later on). Otherwise, all other players don’t win the round.
  • If a player’s hand results in a push, they get their original bet back.
  • As cards are added to or removed from the deck, visually update it’s deck accordingly.
  • As cards are added to or removed from the discard pile, visually update it’s deck accordingly.
  • If too many cards have been used from the deck, before dealing the next wave of cards to the player and dealer, all discarded cards will be returned to the deck, the deck will be shuffled.

If you like where this is going, please leave me a comment saying what you like. Of course, if you don’t like it, that’s cool, too. (:

If you want be to build a Blackjack-style type of game for you (or a breakout style game like this or that), then please contact me here, contact me directly at cartrell@gameplaycoder.com, or look me up on LinkedIn.

That’s all I have for you for now. Thanks, and stay tuned for the next update.

– C. out.

2 Replies to “Thunderjack! Playing Against The Dealer”

  1. It’s amazing how much effort just went into the cards alone and the order which the function. Other than that, the game looks beautiful in motion.

    1. Yeah, I’m still going to polish up the card movements a bit later on. When they are all discarded at the start of the next round, that movement will go much faster than what it currently is. I really like how this is turning out!
      Thanks, Shin.
      – C. out.

Comments are closed.