The last two years have been a programming whirlwind for me at my real-life job, Skotos. And that’s a segue into the fact that I just released my fifth iPhone eurogame conversion in 17 months. This time around, it’s Reiner Knizia’s Modern Art: The Card Game, the cardplay variant of his older Modern Art auction game.
I’ve written a bit about the development of each of my five iDevice games. You can find past article about Reiner Knizia’s Money, about Reiner Knizia’s High Society, about Reiner Knizia’s Kingdoms, and about Michael Schacht’s Gold!
One topic that I keep returning to in these articles is that of artificial intelligences, or AI — the algorithms that make strategic decisions for the computer players in my card games. When I finished Money I said that I learned that abstract seat-of-your-pants decisions worked as well as calculations did. Then when I discussed High Society I talked about all the exacting calculations I built into my AIs. When I completed Gold! I acknowledged that AIs were different for each game … and that’s the impressions that’s likely to stay with me.
Modern Art: The Card Game made me appreciate the huge multitude of decisions that players make even when playing what seems like a pretty simple game. So that’s what I’m going to talk about today: how Modern Art: The Card Game works; how my AI for it works; and what that all reveals about the game’s design.
All About Modern Art: The Card Game
For those of you who haven’t played Modern Art: The Card Game (or its functionally identical twin, Masters Gallery) here’s a quick synopsis of how it works:
You’re dealt an initial hand of cards and will receive a small set of additional cards a few times later in the game. These cards include paintings by five different artists. Some of the cards additionally have a special power that lets you play a second card (in a variety of ways), increase the value of an artist, or draw a card.
When you play a card, you’re effectively selling your painting. This increases the short-term popularity of the artist. At the end of the round, the three most popular artists will pay out: you get an ever-increasing amount of money for each of their cards you played. Sadly, any cards played for the other two artists were wasted.
There’s also a bit of reward for playing multiple artists each round. When a round ends you get to score up to one extra card from each of your played artists. This is an important way to score points, because if you don’t do so, you’re going to waste cards by not playing them before the end of the game.
The values of artists accrue from round to round, so there’s more return for selling them in later rounds … but you also need to play them in early rounds to keep their popularity up (so that they do earn & accrue those early points!). This creates the central dilemma of the game.
AI & Strategy
I knew from the start that the AI for Modern Art: The Card Game was going to be challenging because the logic of the game had always felt very “fuzzy” to me. There’s a constant fight between deciding what cards to play and deciding what to save for scoring and it’s pure intuition whether you go one way or another.
What I didn’t expect was how “tunable” the strategy would turn out to be. In most of my games I’ve created pretty black & white AIs. They either go for valuable cards or for plentiful cards; they either go for conservative decisions or progressive ones (all depending on the precise rules of the game). However in Modern Art: The Card I found myself instead making very minute numerical-based changes from one AI to another. It was a pretty big surprise to move from the abstract-and-fuzzy-feeling strategy I used as a human player to the numerical-and-concrete-strategy used by my AI players.
I’m going to make this discussion a little more concrete by showing you how one of my AI is structured. I’ve removed the name to protect your gaming enjoyment, but this is one of the six AIs currently found in the game:
[thisAI addStrategy:@”longestSuit” ofType:@”playCard”];
[thisAI addStrategy:@”longestSuit” ofType:@”playCardAfterThree”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:1] ofType:@”playSafetyMargin”];
[thisAI addStrategy:@”scoreShort” ofType:@”scoreType”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:2] ofType:@”scoreOnValue”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:2] ofType:@”scoreOnRound”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:5] ofType:@”scorePowerOnValue”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:2] ofType:@”scorePowerOnRound”];
[NSArray arrayWithObjects:@”drawOne”, @”playSecond”, @”playHidden”, @”allPlay”, @”awardToken”, nil]
[thisAI addStrategyNumber:[NSNumber numberWithInt:0] ofType:@”drawOne”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:0] ofType:@”awardToken”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:2] ofType:@”playSecond”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:2] ofType:@”playHidden”];
[thisAI addStrategyNumber:[NSNumber numberWithInt:1] ofType:@”allPlay”];
Most of my AIs are made up of 1-3 distinct rules for how they work. The AIs for Modern Art: The Card Game each looked at 14 unique rules, which suggests how much more complex the game was than some of those that had come before.
The strategies for “playCard”, “playCardAfterThree”, and “scoreType” were the sort of black & white rules that most of my other AIs are built around. They suggest general rules for how the AI plays cards (“playCard”), how it play cards when it already has three suits out (“playCardAfterThree”), as that’s the maximum that can score in a round, and how it scores cards at the end of each round of play (“scoreType”).
In the case of thisAI, he always initially plays from the suit that he has the most cards of, and after he’s diversified his investments (as it were) he’ll return to supporting his longest suit. Contrariwise, when he scores he gets rid of suits that he’s mostly void in (or at least, that’s what he does in early rounds). Other AIs might play valuable cards, play popular cards, or follow other players.
The huge mass of numbers that follows was what made Modern Art: The Card Game pretty unique, because it let me tune the general play of each AI pretty minutely, resulting (I think) in each AI having rules that made them play in their own distinct way. Here’s a few notes on all the general decision points I defined:
- playSafetyMargin. The AIs all like to diversify, so that they can score more cards at the end. However, each wants some protection: how far “up” above the scoring threshold an artist should be before the player starts diversifying. This fairly progressive AI said that an AI only needed to be 1 up above the scoring threshold before the AI could move on. A conservative AI would have a value of 2 or 3.
- scoreOnValue. The AIs all had specific rules for when they thought it was a generally good idea to score cards. However, they were willing to score earlier than their algorithm suggested if cards were of sufficient value. thisAI went against its best instincts when a card was worth 2 or more (which is a pretty low value).
- scoreOnRound. The AIs also threw out their specific rules and started always scoring when they hit a certain round, by which time they knew it was less important to increase the popularity of their artists. thisAI started doing that on round 2 (which is the third round of four, as computers start counting with 0).
- scorePowerOnValue. I mentioned that some cards had special powers, which I’m going to focus on more momentarily. The AIs didn’t like to score these cards, preferring to play them for their special powers. This was the first of two variables that told them to score their power cards if they had to. In this case, when a artist became worth 5, the AI started scoring its power cards if it didn’t have any non-power cards.
- scorePowerOnRound. Similarly, AIs would score their power cards once they hit a certain round. In this case, thisAI did so on round 2 (which means that he would start scoring power cards if need be at the same time he always started scoring, per the scoreOnRound value already mentioned).
There are a total of five special power cards in Modern Art: The Card Game, which offer five different powers. They generally allow for the play of an extra card, face-up or face-down, but there’s also one power that awards a token which increases the value of an artist and another that allows a card draw. I was very surprised by how much work they added to the overall development of the game. I had to write special code to create a proper user interface (UI) for each of them. I also had to design visual indicators to show when special cards were affecting the game. (Compare the following screenshot to the regular play screenshot, above.) Finally, I had to figure out how the AI decided which cards to play among its special and non-special possibilities.
That last decision boggled me for a bit until I split it into two parts, based upon the analysis of my gameplay and that of guinea pigs at Endgame in Oakland who were kind enough to play Masters Gallery with me, then talk about why they decided to play their cards.
First, I heard people talking about playing certain types of cards at certain times. Some talked about playing double-play and hidden-play cards late in the game. Others argued whether artist-award cards should be played early or late. Deciding which round to play each of the special cards in resulted in my final set of strategies, one for each card type: drawOne,awardToken, playSecond, playHidden, and allPlay. As you can see, thisAI believes in increasing the value of their own artists immediately, but does indeed wait on the cards that allow double plays.
Second, I needed to decide what to do if an AI had multiple special power cards that they wanted to play. Here, my AIs just ran down a simple priority list. thisAI always played draw cards first, given the opportunity, and considered the award cards less important than anything else if there were multiple possibilities (which would mostly be true only in later rounds).
And that’s an in-depth look at one of my most-detailed AIs to date. I’m pretty happy with how things turned out, because I can continue to tune these AIs with simple tweaks as I make additional releases … where most of my games require new chunks of AI code to improve my AIs’ play.
If I were really ambitious, I’d set up my code so that my AIs could play against each other a few millions times with subtly different values each time, until I evolved the AI most likely to beat all the others … but for that I’m going to wait a bit as there’s lots more on my plate at the current time!
What It Says About Strategy & Design
I’ve always liked Modern Art: The Card Game. That’s one of the reasons I chose to adapt it rather than the auction variant (the other being that I feel cardplay games work better against computer opponents than pure auctions … and the original Modern Art‘s open-auction variant is about as pure as you can get). My work on the AI, however, made me understand why it feels like such a good game to me: it’s because there’s a real multitude of choices, and the decisions among those choices are neither definitive nor obvious (as opposed again to the original Modern Art where 50% of final selling price is often a “definitive” cost for a painting, at least if you’re in competition with the seller).
I feel like Reiner Knizia really succeeded in Modern Art: The Card Game‘s design in two big ways:
Card Overloading. This is the big thing that, in my opinion, the whole game revolves around. You can use cards in two ways: to drive the popularity of an artist or to score points. There are lots of games that use heavy-handed overloading, like Glory to Rome and Oltre Mare, each of which is full of different icons to give cards different purposes at different points in the game. Race for the Galaxy and San Juan offer a more subtle overloading, as you can use each cards for its powers or as a generic card, where it acts as a resource. Overloading card usage creates an overarcing decision point for a game that affects every cardplay, and I think that’s part of what gives Modern Art: The Card Game good depth.
Special Powers. When I’d played Modern Art: The Card Game nonmindfully in the past, I’d never thought much about the special powers. I played cards with powers when it seemed obvious to do so. It really took the development of the computer game’s AIs for me to realize how many different decision points these five simple powers created. They not only make the game work due to the uncertainty they introduce (which I already kind of knew) but they also make it work by giving players yet another orthogonal set of decisions and by giving them ways to differentiate their strategies from each other (which I did not intuitively realize beforehand).
Generally, great games are built on tough decisions. I think Knizia did a great job of hiding how many decisions he actually packed into Modern Art: The Card Game by incorporating them almost invisibly into the simple play of just a few different cards.
I’m often more impressed with a game when I’m done developing it for the iPhone, and that was certainly the case here … and I’d already liked Modern Art: The Card Game a lot.
Around the Corner
If you’re interested in any of my games for the iPad and iPhone, they are Reiner Knizia’s Money, Reiner Knizia’s High Society, Reiner Knizia’s Kingdoms, Michael Schacht’s Gold!, and Reiner Knizia’s Modern Art: The Card Game.
In recent weeks, I’ve gotten back into the swing of my reviews at RPGnet. I invite you to go take a look at my thoughts on Cargo Noir (Days of Wonder), Zombie in My Pocket (Cambridge Game Factory), The Castle of the Devil (daVinci), Alvin & Dexter for Ticket to Ride (Days of Wonder), and London (Treefrog) — which are the set of reviews I’ve written since finishing work on my RPG history book.
This article copyright © 2011, Skotos Tech Inc.
Author’s Note: I’ve since released one more card game, Michael Schacht’s Web of Power Card Game, but Modern Art: The Card Game remains my most complex AI. I think it may stay there. And as I’ve been moving these articles over to Mechanics & Meeples, I’ve come to realize that I never wrote an article about Web of Power. I’ll have to do so … —SA, 6/25/12