Friday, 14 March 2014

Solitaire Game Mechanisms - Simulating AI in Solitaire Games

Typically when you are playing a multiplayer you are playing against the other player or players. It's the other players who are making those dynamic, real time, unpredictable (or very predictable) moves that can either screw you over or give you the game. When you play a video game the computer controls the enemies or obstacles you are trying to overcome, and we call this Artificial Intelligence, or AI for short. In a solitaire boardgame there are no present human opponents, nor is there a computer there to toss hordes of troops at you. Instead it's just you and the game components set up on your kitchen table. But there still an opponent, still a form of AI to thwart you--the game designer. In essence the game’s designer is your opponent, and they have spent many days, weeks and even months preparing to do battle with you.

The designer’s challenge is to create all the decisions the enemy--or virus--will make to oppose you, and then box it up and ship it to you. A designer is like an old time clockmaker who builds a watch, winds it, then walks away and hopes it keeps on running without him.

So what are some of the mechanisms that a designer can use when designing a game to be his advocate or avatar in the game?

Purely Card Driven games

These are games that use one or more decks to drive the action of the game without relying on dice or other similar mechanisms. Decks are shuffled so cards come out randomly, so theoretically no two games are identical.
  • Generally the player has her own deck of cards which she might gradually grow--or the cards increase in power--through the course of the game. The player might start with no cards and must buy them/gain them. As the player gains in power, then they add better and better cards to their deck. They also might start off with a full deck that gradually gets less useful: They lose good cards and/or gain bad cards.
  • Then there might be another deck of cards representing the enemy/obstacle the player must overcome. Sometimes this deck is layered with progressively more challenging cards: Level 1 at the top, then Level 2 and Level 3, etc. These cards represent the obstacles the player must overcome using their deck of cards
  • There could be a third deck representing events, where one card is drawn every turn and it represents some change in the scenario, such as all fire weapon cards now do double-damage, or no virus mutation this round.
  • There could be other decks representing terrain types, treasure, victory points, etc. These cards could be shuffled and therefore come out randomly, or they could be laid out for the player to pick and choose from, depending on they can afford.   

Each card can have some combination of iconography, colors, numbers and/or text that determines what effects that card will have on play. There will of course be rules to supplement what is on the cards. “If you draw a pirate captain card, then draw 2 more pirate cards from the deck.”

So the challenge the game designer had to meet was to create a combination of different cards that:
  • Create a different play experience every time
  • Allows the player to come up with strategies/tactics to determine which card or cards to use from their deck to overcome the obstacles created by the opposing deck or decks.
  • Create a way to ramp up the difficulty as the game progresses. This could be done in many ways:
    • Progressively harder opposing cards come up
    • More obstacle cards stay active
    • The player runs out of cards to play from their own deck
  • Initially the player should lose more times then they win in order for them to keep coming back to the game
  • Reward players for coming up with better strategies/tactics as they become more familiar with the game through repeated plays   

Friedemann Friese’s top ranking game Friday only uses cards and wooden life tokens.
Fields of Fire also uses multiple decks of cards with no dice.

Dice Driven Games

These are games where dice are the primary source for randomness in the game. The player generally rolls dice for their actions.
  • Determining the success or failure for a given task, such as an attack or withstanding the freezing temperatures on the side of a mountain.
  • Determining what tasks the player can perform this turn: If they roll a 5 and 3 on a pair of D6s, they can choose to either search a room or activate an artifact.
  • If a player performs a successful search, the a die roll could determine what they find at the bottom of that musty old chest.
  • The player may also find herself having to roll for the enemy or obstacle: There are high winds on Everest now, or the German tanks do get to fire back, don’t you know?

So now the game designer has a greater challenge than the purely card driven game IMHO. In a card game, each card has an equal chance of being drawn as any other card. The designer can control the frequency of identical cards quite easily: The Monster deck as 5 Troll cards but only 1 Giant. With dice the designer works with the odds of probability, but let's face it--some people just suck at rolling dice!

Let's take the Monster Deck example: If the player has to roll two D6 to determine the monster, then you could say if you roll a 6 then it's a Troll you’re gonna fight, but if you roll a 4 then you find yourself having to face the Giant. Here luck can really screw you around because we have all played games of Settlers of Catan when nobody could roll a 6 to save their life.

But if the game involves a character who gets to add pluses to their die roll as they progress in levels, then generally bad luck can be mitigated.

Field Commander: Alexander is a dice-driven game with no cards, though it does use cardboard counters. The designer is also not just limited to combinations of  D6s. Where There Is Discord: War in the South Atlantic is a real dice fest with twenty D4s, D6s, D8s, D10s and D12s to determine the outcome of a game.


Some games use counters or tokens as the random factor. They can be pulled randomly from a face down pile or a number of them can be pulled out of a bag. Counters are essentially cards in miniature form as they serve the same purpose in creating randomness. The main difference is that tokens are more versatile so they can be stacked on a map or placed in slots on a player board to determine enemy units, ammo, special powers, etc.

Another big difference is that tokens can easily be thrown back into a bag to be possibly drawn again next turn. It would drive a player crazy if they had to reshuffle a deck at the end of every turn--No, no, in Dominion you are shuffling at least every couple of turns!

Use a Combination of Cards, Dice and Counters

Most games will use a combination of these mechanisms in order to create randomness for the player. My game Infection: Humanity’s Last Gasp has two decks of cards, a die used to determine success or failure, and multiple tokens that are drawn randomly to create the obstacles and resources for the player.

So how does the designer know if they have created a good AI for their game? By play testing the living crap out of it. Play testing just by themselves isn't enough, they need to get into the hands of people who are unfamiliar with the game and are going to play it based solely on reading the rules. Infection was played by over a dozen play testers over the course of several months. It was through their efforts that I was able to change a so-so game into one with a none-too-shabby average rating of over 7.5 on BoardGameGeek. Tweak after tweak of the cards and rules I was able to create an AI that a beginning player could still beat, but add another level of difficulty that would make experienced players feel challenged.

Reactions of the Game based upon the Player's Decisions or other Events

AI should not be equated with just randomness in a gem. AI can also be a decision path/tree where if A happens in the game, then the rules say that B happens.

For example, if I move my combat unit into a hex that borders an enemy unit, then the rules state that the enemy unit attacks your unit on its turn. This has nothing to do with randomness. This is the decision the game designer has made in advance, thinking this would be the best general move to make in the absence of other information.

Of course this could be granulated: If
            A) You move your unit adjacent to an enemy unit, and
            B) the enemy unit has a higher attack number than your unit, and
            C) you have no other adjacent units for support,
then the enemy unit attacks you on its turn.

The decision path/tree can also react to other influences in the game, not just to what the player does. If it is a pirate/sea faring game, the rules might state if there is a class 3 storm, then all enemy ships must head to the nearest friendly or neutral port. Again this may be a decision your opponent--the designer--made 2 years before you bought the game.

So what are your thoughts solitaire game mechanisms that represent the AI of the game? Do I miss anything? Did I mess something up? Fire away!