CardHouse: Free Open-Source Unity Tool for Card Game Creation

Pipeworks Studios is excited to offer CardHouse, a free, open-source tool for creating card games in Unity! CardHouse leverages our studio's experience as card-savvy game developers on titles like SUPERFIGHT, Magic: Spellslingers, and Prominence Poker to offer a toolkit for adding card-based mechanics to your games.

Our very own Theodore Carter, engineering manager, penned this blog to show how CardHouse came to be and how it may help you in your own card game endeavors!

This is the story of CardHouse, a game toolkit I wrote in Unity for making card games. I’ve donated the project to Pipeworks Studios, which is now releasing CardHouse to the public domain.

I love card games - engine builders, monster battlers, hacking simulators - there’s always been a joy for me in the versatility of cards. “Pokémon” and “Magic” cards were an endless source of fascination for me during my childhood and adolescence, being both pleasing to the eye and teeming with strategic synergies. My interest in making video games started in the early 2010s just as tabletop games were having their renaissance. I watched designers push the limits of what card games could be, and it inspired me to incorporate cards into my digital side projects. But the more card-based games I made, the more I tired of rewriting the same game systems over and over. I wanted something reusable but was too inexperienced to understand how to build something I could extend to make arbitrary card games. Instead, I’d just copy and paste code as needed, dreaming of one day having a more robust system I could use to make the kinds of games I was interested in.

My interests eventually led to me joining Pipeworks Studios. It was my first time working in the games industry, my first time having my code reviewed by other engineers, and my first time even using source control! It’s so wild to remember a time when Perforce and Visual Studio weren’t the air I breathed. And so after a couple of years, I felt much more comfortable developing games in C# and Unity. I also found myself working on yet another card game in my professional life, solving the exact same problems I had as a hobbyist but this time with better architectural skills! I decided it was time to build my card-based dream framework, and so during the winter break of 2021, CardHouse was born.

My vision for CardHouse was to create a system that solved the more annoying problems I had encountered in my personal and professional programming experience making card games. Firstly, I wanted my cards to be robust - able to handle many state changes per frame with elegance and grace. I decided that CardHouse needed an abstraction layer that could handle translating, rotating, and scaling objects. This “seeker” system now handles requests for card movement and processes them smoothly, serving as the visual foundation for the rest of the project.

Secondly, I wanted to minimize code repetition by removing the need to repeatedly call methods that flip cards face up or face down, orient them in a particular fashion, or check if a player’s hand is full before moving things around. In most card games, players move cards between distinct “zones” or “groups” like a player’s hand, the board, or the discard pile. Why not let the discard pile dictate the facing, interactivity, orientation, and position of each card it holds? With this approach, developers can simply request that a card move from one group to another and leave the rest of the logic up to the CardGroup component's configuration data.

The third goal I set for CardHouse was to eliminate the need for timers, since so many bugs in card games seem to come from cascading “when this happens, do that“ effects running into each other. I wanted everything to happen in a single frame in abstract data, and then have the visuals smoothly animate the results. That turned out to be easier said than done, unfortunately. While there’s a waypoint system to help illustrate multi-step card interactions, coordinating large numbers of cards to use it in a way that makes sense visually has eluded me. Plus, testers of CardHouse immediately wanted a way to orchestrate behavior with timers so I put in a timed event chain that can be triggered when the game phase changes or certain actions are taken. I hope to someday be able to rely on waypoints exclusively, but for now, take care to minimize or disable sources of interruption like user input when timers are running.

With the basic elements of CardHouse written, I decided to give it a test drive by making a few games. I started with “Solitaire”, which highlighted the need for a specialized card shuffle seeker. Next came a memory-matching game and digital “Tarot” sandbox. These didn’t end up requiring anything that would have general utility, so the base components were largely unaltered. It was nice to see my game code and framework insulated from each other for once!

At this point, I felt ready for a real challenge - making a two-player game in the style of the CCGs of my youth. To make these I needed a host of supporting systems for phase management, currencies, card loyalty, board duplication, and conditional logic. I knew I’d want to reuse these systems for my own game ideas, so I started constructing them as optional layers - a game might use the phase system, the currency system, or both, or neither, and it should still function. These interlocking a-la-carte systems require a few months of work, but once they were in place I found that I could construct a deck builder (a la “Slay the Spire”) using the same systems without much issue. It was starting to feel like CardHouse was a fairly mature framework at that point.

It took me a little over a year to get CardHouse to a place I was comfortable with, and at that point, I was eager to make a real game with it. I had been organizing a series of internal game jams at Pipeworks and really wanted people to be able to use CardHouse to make their own things, too. Since Pipeworks Studios has worked on a range of card games over the years, including “SUPERFIGHT,” “Magic: Spellslingers,” and our own “Prominence Poker," we had the perfect audience of card-savvy game developers to put my framework to the test. And so it dawned on me that I might just want to hand the keys to CardHouse over to Pipeworks. Our CTO graciously let me continue to iterate on the codebase and get developer feedback as part of my job, and so in February of 2023, I donated the framework to my company and have been maintaining it ever since. It has been really amazing to see what my coworkers have done with CardHouse, but all of that is top secret of course.

In preparation for the public release of CardHouse, I decided to take a note from GMTK's Platformer Toolkit and create a series of interactive tutorials to show what the different components are and how they can be configured. Now, anyone who opens or imports the CardHouse package can embark on a series of lessons right in the Unity editor, gaining some hands-on understanding of its capabilities. This is no replacement for traditional documentation but should be a good starting point for new users.

And so, the time has come for CardHouse to venture out into the world. It is now open source and available for free download on the Unity Asset Store. Since this framework is being released with a CC0 Creative Commons license, you’re free to sell the games you create without any obligation to credit Pipeworks or me. You can also contribute to CardHouse’s development on GitHub if you find any glaring bugs or want to make feature requests. My goal was to release this framework to the public domain from the very beginning, and I’m happy that Pipeworks is doing the same. At Pipeworks, we firmly believe in the value of generosity and the positive impact of freely sharing our work, and I’m excited to see more projects like this come out of our studio in the future.

I hope that CardHouse serves as both inspiration and a solid starting point for your own card game development journey. May it empower you to unleash your creativity and bring your game ideas to life!

Card games are complicated! They have all these rules about what you can play and when, and coding state machines to govern all this behavior can be a headache. CardHouse gives you a starting point for adding card-based mechanics to any genre of game! This toolkit includes systems for common card operations like shuffling and dealing cards, resource management, and local multiplayer (pass-and-play style). Plus, CardHouse is written with extensibility in mind. Components focus on using UnityActions to orchestrate behavior so you can hook in your own custom game logic wherever you need!