Back to blog
Aug 04, 2024
4 min read

Learning Godot: Worst Poker Clone Ever - Part 2

I sat down and worked a bit more on the project this weekend and have some of the random generation aspects working. Overall, I feel like I should probably dig into the docs a bit more and really understand how projects, scenes, and scripts all actually work together because while I have things in a working state, something feels wrong. The level has far too much control over what is going on with the cards themselves and everything related to the generation of card data should be encapsulated inside of the card itself in my opinion. The level should basically be saying “Hey, I need a card” and it instantiates the card instance, the card script sets up all of the various data, and then the level just puts it in the right spot. I might not be all that far off and just need to move some of the custom functions from the level script to the card script. Maybe I’ll dig into that a bit more next time around. Screenshot of a poker game titled ‘Worst Poker Clone Ever’. The cards on the table show the Jack of Spades, 8 of Clubs, Ace of Clubs, Jack of Spades, and 2 of Diamonds. The player’s hand at the bottom includes the 7 of Clubs, 4 of Diamonds, 5 of Spades, Queen of Hearts, and Queen of Clubs. A ‘DEALER’ button is also visible on the table. The background features a green felt surface, and there are stacks of cards with intricate back designs at the top and bottom corners.

But, that being said, the game is generating random cards for the opponent’s hand as well as the player. It also randomly generates the cards that are being burned and dealt into the playing area. I don’t have any of the logic written in Godot for calculating the winning hand, but I’ve written a very similar bit of logic in Javascript before so I should be able to port that over pretty easily and clean it up.

I don’t love the card faces that I’ve picked for this but they work for now. Fortunately all of the assets are super easy to replace so I’m not too concerned with it in the long run unless I have to actually sit down and create each card by hand… then that’ll suck. Image of the Ace of Spades playing card. The card features a large black spade symbol in the center, with a smaller spade symbol and the letter ‘A’ in the top left and bottom right corners.

Next steps?

  • Review project layout and move functionality into the proper locations
  • Animation for dealing of cards
  • Animation for burning and putting cards into play
  • Animation for revealing the opponents cards
  • Logic for calculating the best possible hand out of your cards and the playing area
  • Logic for calculating the winning hand between player and opponent
  • UI to drive the process of dealing, revealing, etc…
  • Sounds… eventually

If you want to chat about this project, hit me up on Mastodon or if you want to follow along with me, I’ve created a public repository for the Worst Poker Clone Ever where I’ll be pushing all of my code and assets to.