The Month of Games #3 - Heart of the Cards

It's now the third week of August, which means it's time for the third game in The Month of Games.

If you have Tabletop Simulator on Steam, you will be able to use this. And if you don't, it is possible to play with other people in person as long as you have a deck of cards and follow the ruleset.

At the end of April, I came up with the idea for a card game. To be fair, I actually came up with the name first and worked out the idea from there. That name - Heart of the Cards. Yep, two weeks in a row we have games which have quotes from other things as names.

I wasn't watching or playing anything even remotely linked to Yu-Gi-Oh! at the time, but as well as using the well known phrase as the name of my new card game, the philosophy is also there. You cannot win if you don't believe in the Heart of the Cards. OK, maybe you can, but if you don't win it's because you didn't believe hard enough.

HotC is a game for between 2-4 players. Cards are arranged on the table in the shape of a heart, with a Heart Card in the center, Wildcards equal to the number of the players placed at the top, and the remainder being Point Cards.

Point Cards have a Points Value on them. All the Points Values in a player's hand at the end of the game are added up to make their Points Total.

Wildcards can be picked up at any point throughout the game, but are only played on the final turn. They cause something to happen - either cards get discarded, traded, or have their Points Values changed.

Heart Cards determine the winner.

The cards are arranged in the shape of a heart. The Tabletop Sim mod also includes a calculator because maths.

Each player takes it in turns to pick up a Point Card or a Wildcard from the table. Once a Wildcard is picked up, that player cannot pick up another Wildcard - it is strictly one per player. Once all the cards except the Heart Card are picked up, the Wildcards are played. Once the effects of the Wildcards are dealt with, the Heart Card is flipped over and reveals the winning conditions.

It can be the player with the highest Points Total, the one with the lowest, one closest to a value, or some other condition.

There is no skill involved - it is completely random, which makes it fair on all players, but by giving each player the opportunity to pick their own hands gives the illusion of choice that they were able to determine the outcome.

At this point I didn't have any interest in making physical versions of the cards, but I devised a way to make it playable with a standard deck of playing cards:

  • The Aces and 2-10 in the Heart and Diamond Suits become Point Cards with positive Point Values matching their numbers (with Ace being 1)
  • The Aces and 2-10 in the Club and Spade Suits become Point Cards with negative Point Values matching their numbers (with Ace being -1)
  • The Queens become Heart Cards - these can be any Heart Card, but the following is recommended for simplicity
    • Hearts becomes Full Heart - highest Points Value wins
    • Diamonds becomes Beating Heart - all negative Points become positive, highest wins
    • Spades becomes Failing Heart - lowest Points Value wins
    • Clubs becomes Darkened Heart - all positive Points become negative, lowest wins
  • The Kings and Jacks become Wildcards - these can be any Wildcard and should be determined before the game

With the basics established, I wanted to do three things - make a code library so that people could make digital versions of it (and expand on it, if they wanted to), use that library to make a simple player vs computer game for desktop, and create an add-on for Tabletop Simulator for people to play it with their friends. The code library would also have unit tests to make sure everything was working as intended.

All of the Heart Cards and Wildcards displayed in Tabletop Simulator.

Coming up with the idea on a Friday night, I then spent most of that weekend working on the code library and the tests, but there was still a fair amount to do and I didn't want any more distractions from Story Game or Adventure Game throughout the week so I left it for a few weeks.

After devising the concept of The Month of Games, I settled on returning to Heart of the Cards for the third week, given that both ETS and Crappy Bird were already either in a playable state, or going to be built on top of a finished game, and HotC had nothing playable at that point.

When I had left HotC, I needed to figure out a way to setup the rules for the Wildcards in code. Initially I'd written a class with a bunch of bool properties that matched behaviour on each of the cards, but I didn't like that because I wanted something more generic. Now revisiting it, I was able to reduce it into a smaller number of properties which corresponded with one of several enums.

These smaller properties consisted of things like Discard, Multiply and Invert, and then my brain pointed out that Invert was just Multiply by a value of -1 so I was able to get rid of Invert and save writing extra code I didn't need.

Before finishing the logic in the library, I setup the console application that would be used as an example of the library in action. Provided I could link the two up the way I had planned, there would only be a handful of functions that the console application needed to call in order to setup and play a game from start to finish.

My work on HotC was largely done of evenings or weekends since Story Game took priority during the day, but I woke up one morning to see my router's light was now orange instead of blue. After an hour of attempts at restarting it, and making sure there were no issues that I'd be able to solve on my own, I had to accept that I was going to be without internet for a while. Not knowing which of my machines had the latest code for Story Game, I decided to work on HotC while the internet was down (it came back up over 24 hours later).

This day was spent commenting code, making sure tests were in place, writing the logic for when flipping the Heart Card and eventually being able to play against the computer in the console application. There were still issues - the logic for handling tie breaks was not implemented, I had to play with the No Wildcards rule since I hadn't written the logic for that, and I hadn't finished the code for the most complicated Heart Card.

Following a break to work on Crappy Bird, I came back to HotC with an idea - instead of trying to create all of the cards in an image editor, what if I created a blank template and then wrote a tool which would allow me to add text to that template? Although I had no idea if it was actually possible to load an image, add some text to it and then save it back out again.

It turns out that it is possible, and within a few hours I had a tool that allowed me to create individual cards for each card type, as well as loading in a file to create them in bulk.

The card creator.

Once the cards were created, I added images to the Heart Cards and Wildcards to fill up the blank space. I also edited the Point Cards to have a section at the bottom which shows what the card's value is when inversed (kind of pointless for someone who understands maths, but some players might now), and a slot to put a token in to indicate that the value has been modified.

I then went into Tabletop Simulator and imported all the cards, made a couple of rules sheets and uploaded it to Steam Workshop. A nice thing to add would be buttons to automatically arrange the cards for players, although it was getting late so I was intending to come back and do it another day. Then I saw that the script commands were fairly simple and ended up staying up until nearly 2am to finish it off completely.

Adding in the scripting was fairly straightforward, but there were a few false starts where it wasn't saving properly, then when it did save it had managed to delete one of the decks. The most time consuming part was setting up each formation as it changes depending on how many people are playing (I didn't do anything smart in the script - there's just three separate functions since that was way simpler than wasting hours coming up with a smart algorithm).

I took some screenshots to add to the store page and then had to redo them since there is a filesize limit and my 4K images were too big. When dropping down to 1080p in-game the text on the cards was a little blurrier, but it was still legible. I suspect at lower resolutions it will end up being unplayable but there's not a great deal I can do to fix that.

Next I moved on to creating a PC game using the cards that I now had thanks to the tool. I brought in the current version of the HotC library and got to work. Progression on finishing the library and the game was slow because once I had finished a method and was fairly sure it wouldn't change, I wrote tests to make sure it worked. Many podcasts were listened to trying to finish those off.

I had also planned on doing a version playable on the web, but working on 4 different projects at the same time - with one of those getting scrapped nearly every week - meant HotC took a backseat and ended up being the last game I finished.

By the end of July, HotC was now the only project that wasn't done. The code library was done, but there were 15 methods that needed tests that I couldn't be bothered to finish writing, and then I discovered that I had setup some test cases a month earlier which weren't even populated which meant I'd have to trawl through the entire project and I really couldn't be bothered doing that.

I was also really struggling with motivation to finish the Windows version. It was possible to play and finish games without Wildcards, but implementing a "choose a card" or "choose a player" screen was something my brain really didn't want to deal with, especially given how few people were actually likely to play it. So I did what I do best and abandonded it.

As is tradition, some links at the end of the post. Here's the Tabletop Simulator mod, a link to a page outlining the rules, and a link to the card assets in case anyone decides they want to print the cards and play in person.

Next week brings the Month of Games to a close, and it comes with a twist.

Popular posts from this blog

Getting Started with the FireRed Decompilation

Tonight Matthew, I'm Going to Make...

Phoning It In