In this, somewhat lengthy post, I’m going to explore the world of something that has made solo gaming what it is today. In fact, without it, I doubt there would be such a thing as a solo game; so let’s take a look…
The theory and development of computer systems able to perform tasks normally requiring human intelligence, such as visual perception, speech recognition, decision-making and translation between languages.Google dictionary
Isn’t this normally found in robots, computers, and such like? What’s it got to do with tabletop games?
Well, let’s adapt the definition slightly…
“The theory and development of systems able to perform tasks normally requiring human intelligence.”
Or, in simpler terms…
“A mechanism that makes its own decisions.”
There, that’s better!
Artificial Intelligence (AI) is something we take for granted in a lot, and I mean a LOT, of games. Pretty much every co-op game, where players combine their forces to take on ‘the game’, contains some form of AI, as do those multi-player games that offer a solo option, and of course, so to do the pure solitaire games – its been around for many years now, and you probably haven’t even realised it!
Now, I’m not talking the amazing AI systems we see in the high-tech world, no, the form I’m talking about is a simple, very limited intelligence, in fact, you may argue that AI is the wrong term for it, and I would probably have to agree.
But, for the want of something better to call it, I’m sticking with AI.
Before we go on, I’d like to highlight that everything here is all my own opinion, my thoughts, my terms, and ideas, and may not agree with your own interpretations on the subject. So, feel free to put your perspectives in the comments at the end.
There are many differing game mechanisms that replicate AI; the Infection deck in Pandemic, the token pyramid in Teotihuacan: City of Gods, and the slightly more complicated ‘Automa’ of Scythe, are all such examples, and I like to break them down into two categories – active and passive.
Active AI involves the player making a choice or decision on the AI’s behalf, whilst passive does not.
Let’s have a look at a few examples.
Pandemic’s infection deck has one main function, to infect cities. But, when combined with the Epidemic cards it also recycles, and it’s this recycling that forms the heart of the AI, as well as the game.
A normal infection action sees a player draw a number of cards, one at time, from the top of the infection deck. For each card drawn they place a disease cube on the indicated city. If there are already three cubes on that city, then it causes an outbreak, spreading the disease to adjoining cities.
When a player draws an epidemic card from the player deck, they simply follow the instructions on the card:
- Increase – Move the infection rate marker forward one space.
- Infect – Draw the bottom card from the infection deck and put 3 cubes on that city. Discard that card.
- Intensify – Shuffle the cards in the infection discard pile and put them on top of the infection deck.
As you can see, at no point during this exercise does a player have to make a decision, they simply follow the rules; this is what I term passive AI.
We’ll be revisiting Pandemic a little later, as it’s a great way to show exactly how an AI works.
Scythe features something called ‘The Automa’, a solo mode specifically designed for the game by Automa Factory, and has its own deck of cards and a separate rulebook, all of which are included within the core game.
There’s a few different setup procedures to go through, as listed in the book, but the Automa cards are where the magic happens.
At the start of an Automa’s turn the player draws a card. They then work through the top line (move actions) of the card, from left to right, until they come across a valid move for the Automa to make, or it makes no move at all.
They then move on to the second row, which sees the Automa gaining stuff, and then on to the third, which may give the player a recruit bonus.
There’s a little more to it than I’ve explained above, but it’s enough to for our purpose.
Whilst on paper it may sound similar to the Pandemic example, in that you’re simply following instructions, in practice, though, it is somewhat different.
The player has to do some thinking on the AI’s behalf; they take an active part in the process. This isn’t so obvious in what I’ve told you so far; so let me expand on the Automa’s movement process.
Here’s the top line of an Automa card.
So, the player works from left to right until a valid move can be made.
The first proposed move is an attack action, but only if the Automa has at least 5 power.
To work out if this is a valid move, assuming the Automa does have at least 5 power, the player first selects the Automa combat unit closest to its home base. If there is a tiebreak then the player uses normal reading order to decide which to select.
Then, the player works out which territories are valid for an attack, which involves going through the neighbourhoods of all the Automa’s units to see which contain enemy combat units. They then select the area with the fewest enemy combat units to attack, and again tiebreaker rules apply.
If there are no valid attack moves, then the next proposed move is validated, and so on.
As you can see, this involves a fair bit of player interaction on the Automa’s behalf, and it certainly takes some getting used to in this case, as working out neighbourhoods and what is or isn’t a valid move involves a degree of rulebook consultation until it becomes second nature.
Hopefully, the above examples have given a clear idea what I mean by active and passive AIs. There are some games, Arkham Horror (The LCG and the 3rd Edition) for example, which do contain active aspects, but as they aren’t the main focus of the AI, I tend to categories them as passive. (The active aspect of Arkham Horror is the movement of the monsters – the player may have to work out which investigator the monster will move towards and attack.)
A closer look
Both Passive and active AIs have their place. Passive appears to be the more common of the two, and is often found in co-op games, whereas active AI crops up in a lot of dungeon crawler type games, and is also well suited to solo play.
This is a much more user friendly AI, as the players just have to follow a simple set of instructions, which are usually the main game rules, hence, you don’t usually consider that you’re actually using a form of AI, as it’s hidden away in the game’s mechanisms.
Passive AI usually contains a random element within the gameplay; otherwise it would be too predictable and easy to beat. However, this random element is usually designed to be very tight. In other words, it is controlled in its make-up so as to give a certain average outcome; otherwise the game becomes too ‘swingy’.
The Living Card Games from Fantasy Flight are prime examples of this. You follow the rules of the game, but actually the game is creating the environment, with some random elements, for the players to play in.
For instance, let’s look at Arkham Horror: The Card Game. The storyline is set through the intro and a static environment provided by the location cards, but it’s the Act, Agenda, and the encounter decks that really drive the game.
The Act deck provides the player with a goal, whilst the agenda acts as a timer, which on completion pushes the storyline closer to an unwanted conclusion. The act advances when the player does something specific, whilst the agenda advances when the game mechanisms say it does, and this is the intelligence of the game, or maybe one would be more correct in saying the intelligence of the designer!
Built into this intelligence is the encounter deck. This throws various random encounters at the players; monsters to fight, barriers to cross, and acts of treachery that are sure to foul things up.
The balance of these things gives the players enough variety to enable repeat play, but still keeps things under control so as to give the feeling one is in a progressive story, one that can be beaten with good play rather than relying on luck.
As passive AI does rely on following a pre-fixed set of instructions, it can become predictable, and usually the simpler the instructions it works to, the easier it is to predict.
The AI in the Arkham horror example above, isn’t particularly easy to figure out, as there are quite a few variables to consider, but with repeated play you will get to know the storyline – where to go and what to do – but the AI throws up random encounters, some scenarios have a hidden choice of locations during setup, and, of course, there’s the pulling of tokens from the chaos bag. Against this the players will probably use differing decks each time, and so the number of variables increases.
If we then return to Pandemic we see a much simpler form of AI in action, one that is somewhat predictable.
At the start of a game, after you’ve infected the initial nine cities during setup, you have no idea what city the infection deck will throw up next. What you do have, though, is a rough idea when an Epidemic card will be drawn from the player deck.
For example: in a three-player game at standard difficulty (5 Epidemic cards), you should expect the first epidemic card within the top 10 player cards (the player deck is divided as equally as possible into 5 piles, and an Epidemic card shuffled into each of these piles before re-stacking the deck). If it’s the first card you draw, then you know you are safe until the 10th card has been drawn, at which point you then have the same odds for the next Epidemic – 1 in 10.
The number of Epidemic cards placed within the player deck, as determined by the level of difficulty the players choose, controls the recycling of the infection deck – the more, and more often, it recycles the harder the game.
But when the infection deck recycles – the discard pile is shuffled and placed back on top of the infection deck – you then have an idea about what will be drawn over the coming rounds, and can plan accordingly.
It is this predictability, knowing what the top x number of cards are in the infection deck, that makes the game strategic – you can make plans to prioritise and combat the areas that need urgent attention.
The more predictable the AI, then the easier it is to beat, and with Pandemic there should be no reason why, with a little experience, you can’t have a win rate of at least 70%.
Forbidden Island, also by Pandemic’s designer Matt Leacock, features almost the exact same internal AI, and once again it is predictable, and with play becomes relatively easy to beat.
From the Pandemic example we can see that the random elements are controlled – the Epidemic cards are evenly(ish) spaced out within the player deck, and the infection deck, once it has been recycled, holds an amount of predictability.
It is the Epidemic cards that are the driving force of the AI – they decide when the infection deck is recycled – and if these were just randomly shuffled into the whole player deck, then the AI would fail.
Active AI’s are often found in games that have an unpredictable player state.
What do I mean by this? Well, it isn’t particularly easy to explain, but here goes…
Passive games usually feature a static environment – the position of the players is limited by the constraints of the game, and the AI works by knowing and using these constraints. The locations on the board of Pandemic, Black Orchestra, Arkham Horror, or Teotihuacan: City of Gods, for example, but also games that feature no locations at all, in the sense that one can be occupied by a character. These have a very tightly controlled manner of gameplay, such as Marvel Champions, Harry Potter, or Steamrollers.
In these games it doesn’t matter where the player is because all the variables are built into the AI.
For example: Whether you’re in Los Angeles, London, or Tokyo, it matters not to the AI of Pandemic, it will still run through the same processes of infecting cities. Likewise, in Arkham, it doesn’t matter what location the players are on, the agenda will still gain doom as each turn comes around, and the players will still draw from the Mythos deck every turn – The AI doesn’t need to know exactly where the players are or what they are doing.
Now, let’s revisit Scythe. At the start of a game the AI acts in a fairly sedate and predictable manner. As the rules state, ‘ The Automa wants to move away from its home base and concentrate its units around the Factory’, but the player will still need to work out which Automa unit needs to be moved, and where it will go, as laid down within the rules.
At this point in the game the chances are that both the player and the Automa’s units are some distance from one another, but as the game advances this isn’t always going to be the case. At this point the AI needs to adapt to the situation on the board, and it’s here where the active AI comes into its own – by using the player as its eyes!
The Automa card will state a number of feasible moves, with the order they are in dictating its priority. The player works through these in order to see if they can be made with the current situation of the board. So, if the AI wants to make an attacking move with a mech, but the player, after going through the conditions for this move, finds that there are no adjacent enemy combat units, then the player moves on to the next proposed move – the player is acting as feedback to the AI.
The reason the AI works so well in Scythe is because of the focus it has been given – It will move towards the factory, and once there it will start to expand around it as it gains extra units. It will inevitably cause some strife for the player, as there is the Automa’s Star Tracker to take into consideration. This is dependant upon the difficulty you choose, as there are 4 different trackers. These control when the Automa can cross rivers or use lakes, as well as when it gains stars – basically it’s a timer, and it’s the part of the AI that you’re trying to beat.
So, active AIs are great for adapting to a variable game situation, but they can often be quite complicated – just take a look at the number of forum questions dealing with Monster focus and movement on the Gloomhaven BGG page – and this makes for a steep learning curve that can sometimes prove rather off-putting, especially to new players.
I’ve been going through the games I own, looking at the various ways they employ AI, and I’ve tried to come up with commonalities that they all seem to share.
All the AIs appear to have three things in common, which I have decided to name the controller, the timer, and the interface.
It’s probably easier to explain if I start with a few game examples, and then try to define the terms. So, let’s start with Pandemic, as we’ve already covered most of it.
The controller in Pandemic is simply the Epidemic cards. When one of these is drawn it causes three things to happen; it moves the infection rate marker; infects a city with three disease cubes; recycles the infection discard pile back onto the infection deck.
The Epidemic cards control the infection deck and its all-important recycling. Too often, and the game becomes nigh on impossible, too seldom, and the game becomes very easy. By breaking the player deck into even piles and inserting an Epidemic card into each, the controller is being set to operate once roughly in every fifth of the game. The controller in this case sets the difficulty of the game.
The interface, which in this case is the Infection deck, does all the work. Every turn it infects a number of cities, but the magic of it all happens when the controller tells it to recycle. This makes the infection of a city already containing disease cubes highly likely, and raises the tension of the game.
Pandemic has three timers – the number of cards in the player deck, the Outbreak track, and the number of disease cubes that make up each disease. If the disease cubes or the player deck runs out, then you lose the game, so too if the outbreak marker reaches the end of the track – the timer defines when you lose the game.
Next, we’ll look at another game we’ve already covered – Scythe.
The timer is fairly obvious here; it is the Automa tracker card. When it reaches the end of its track, then the game ends (it is possible for the Automa to end the game prior to this, if it manages to place its 6th star by other means). In this case the timer doesn’t automatically say that you’ve lost, it just ends the game and scoring begins, but it is what you’re trying to beat.
The interface is also pretty obvious; it’s the Automa cards. Again, this is where all the meat of the action is contained, it depicts what the Automa will do each turn. It also advances the timer by telling you when to move the tracker along.
So, that leaves the controller; any guesses?
In this case it is simply the action of taking a turn – the controller is the turn cycle. When it comes to the Automa’s turn, then the interface operates.
That may lead you to ask the question, ‘Why isn’t the turn action regarded as the controller in Pandemic then?’
Good question, good job I’d thought about that myself!
If you take out the Epidemic cards and then play the game, what happens? Well, there is no game. You’d just keep drawing cards of the top of the Infection deck, but there would never be any outbreaks and you’d cure the diseases in pretty short order – the Infection deck needs the controller, the Epidemic cards, to work. In Scythe, the Automa relies solely on the turn action to work, making this the controller.
Scythe’s AI is actually a very slick operation, containing very few component parts. All of the complexity is contained within the symbology of the Automa cards. Once you understand how to read and use these symbols, then the AI flows and produces a challenging, and actually quite fast paced, game.
The last example is, yes you guessed it, Arkham Horror: The Card Game, as once again, it has was used earlier.
Arkham is a much more complicated AI to pick apart, as there are a lot of variables going on within the gameplay. There are the Act and Agenda decks, the Mythos deck and tokens, there are various additional inputs depending upon the scenario you’re playing, and there are also the various locations, which occasionally play their part in the overall AI operation.
So, to start with we need to strip the game down to bare bones, take away anything that is scenario dependant, and see how we go from there.
I already mentioned that the Agenda deck acts as the timer, but is there another hiding away?
I did consider the Act deck, as completing an act advances the game, and eventually can win the game for the players. But the act advances when the players do something specific, such as place a number of clue tokens on it, and is not operated by the AI, so I ruled it out.
Could investigator health/sanity be considered a timer, after all, when it runs out the investigator is defeated, and when all investigators are defeated they lose the game? In some games this may well be the case, but not here. I would consider this to be a specific loss condition rather than a timer in this game.
So it would appear that the Agenda deck is the only timer here, what about the controller.
Again, this isn’t so straightforward here. After thinking through how the game moves along, and how both the player and the AI make progression, I came to the conclusion that there may be more than one controller.
I considered that, like Scythe, the turn sequence could be one. Through the turn sequence doom gets added to the Agenda deck, the players draw a Mythos card, and monsters move and attack.
I also decided that the Agenda deck, as well as being a timer, could also be a controller, as it changes the state of the game, usually advancing it in an unwanted direction.
But then I got thinking about what I said about Pandemic, and that the turn action couldn’t be a controller because the game wouldn’t function if you were to reduce it to just that mechanism.
By using that thinking here, I found that it is the turn sequence in Arkham that controls the interface, and the Agenda deck is just a timer. It is the turn sequence that pretty much operates everything within the game. It adds doom to the Agenda deck, which at some point will cause it to advance, it moves the monsters, and it forces the players to draw encounter cards. Take away the Agenda deck and the game still functions, but without the timer, you have nothing to bring it to a close… in a negative way that is!
That just leaves the interface.
If we take it that it is the interface that does all the work, then we can start to rule a few things out. The Act and Agenda decks are pretty static, in that the only thing they do is advance the storyline. The same can be said of the locations, so that pretty much only leaves the encounter deck, and we know what causes cards to be drawn from here don’t we… the controller!
What about the monsters, though, aren’t these also controlled by the controller, and so should be considered part of the interface?
Another good question, but where do the monsters come from? Yep, unless added by the specific scenario, at another point of time within the game, all monsters come from the encounter deck. So, they are spawned by the controller causing an encounter card to be drawn, and they then remain under its control for their activation.
I’ve put a few more, very brief examples at the end of the post, and if you want to have a go at figuring out what’s what, here’s the games: Gloomhaven (during a standard scenario), Viticulture, Suburbia (Dale the Bot), and Harry Potter: Hogwarts Battle. (I wanted to include more, but at some point I had to say, enough is enough!)
Next, let’s try and define the individual parts.
As we have seen, the controller is the mechanism that activates the interface, or causes the interface to change the way it works.
The controller may simply be the action of taking a turn, or it may be included within another mechanism of the game: a deck of cards for instance.
The controller works repeatedly, though this may not be every turn, and can often be used to adjust the game’s difficulty.
If the controller is removed from the game, then the interface will either stop, or will continue in such a manner that the game fails to react to the player’s actions.
The timer is a device often used to give the players a goal.
It can count up/down to indicate the time when something will happen within the game, and then reset or continue to count until the next thing happens, or it can simply count to indicate when the game will end.
Again, the timer can be used to change the difficulty of the game; usually, the shorter the count, the more difficult the game becomes.
The Timer may be linked to the controller, or even the same thing, and may change how the controller works as the game progresses.
If the timer is removed from the game, then it will affect how the game advances, making the game easier and with less chance, if any, of the AI winning the game.
This is the game mechanism(s), where the AI does all the work.
It is activated by the controller, though not necessarily every turn – the controller may be used to change the way the interface acts as well as telling it when to.
If the interface is removed from the game then it becomes unplayable.
That’s all very well, but what good is all this to me?
Ah! And that’s the question!
To most gamers all of this isn’t really going to be of much use. But, those like me, who like dissecting how a game works, then it may make interesting reading.
There is, however, more to it than that.
Breaking a co-op or solo game’s AI down into the three components – Timer, Interface, and Controller – can prove quite useful. It gives us an idea of how the game really works, and if we know that, then we’re a step closer to being able to beat it, or at least see which part of the game we should focus on.
Anyone who has played Pandemic has probably cottoned on to working out roughly when to expect an Epidemic card, and knows that the way to beat the game is to work the odds of this happening with what has been recycled in the Infection deck. But not all games are so obvious, and looking for the three mechanisms can prove useful.
There is one better use for all the above information though, and it’s the real reason I decided to explore AI in the first place, and that’s for designing your own AI.
Take a look at the BGG forums, they abound with posts and files regarding user AIs. It’s surprising the number of people who want to play their favourite games solo, and the lengths they’ll go to in order to do so.
So, how do we put this into practice?
Let’s look at Teotihuacan: City of Gods as an example. Teo is a Euro game, which was actually designed with a solo mode, but it will serve our purposes quite well here.
The base game is a player vs. player competitive Euro, to which, let us imagine, we want to add a solo mode.
We know we need three mechanisms to make an AI work. Firstly, we’ll need a controller, and as this is a turn based competitive game, then the obvious thing here is that the turn sequence will control the AI.
Secondly, we need a timer. Looking at the game we see it already uses one, the Eclipse. When an Eclipse happens scoring takes place, and on the third Eclipse the game comes to an end. So we have a timer that will set a target for the player to aim for – to be winning the game when the third Eclipse scoring has been carried out.
So all we need to add is an interface, which will tell the player what move the AI is going to make. As the game has a static board layout, we know that the AI won’t have to react to the where the player is, so it will be a Passive AI.
From here we would then go on to create the interface using what we have just learnt: that it will operate on a turn cycle; it needs to be competitive within the time frame of the Eclipse, and it will be a passive AI.
Obviously, there’s still a fair bit of work to do in creating the interface, but it helps to know these constraints.
In other games you may find that the interface is already there, but it needs a timer and/or a controller to work as an AI – being able to recognise these individual mechanisms helps to give a focus to what is needed.
There is one area of gaming, though, that has proved particularly difficult when it comes to creating an effective AI, and that’s wargaming.
By wargaming, I mean the conventional, miniatures and terrain, measure to move, kind of wargaming, not the board game type. There are a lot of variables to consider when designing an AI for this type of game, and I do wonder if it is at all possible to create something that is effective without becoming a burden on the player.
So, armed with the knowledge above, this is where I’m going to go next, but don’t worry, that’ll be another post, this one has already gone on long enough.
Hopefully you’ve enjoyed reading this, and maybe you’ve a different perspective on things, so, please feel free to add any comments below; I’d love to here your ideas.
- Active AI – The player has to decide upon the focus of the monsters – not as easy as it sounds!
- Timer – Usually, the timer is the player’s ability cards. These are forever decreasing, and once all characters have lost their cards, they are defeated. In some scenarios, though, there is a round counter, and so these scenarios have two timers.
- Interface – In this case it’s interfaces! Each monster type has their own interface, their deck of cards – take it away and the monster does nothing!
- Controller – Tricky one, this. You could say that it is initiative/turn order that is the controller, as this tells us when to activate the interface, and I really couldn’t argue with that. But, I could take it a step further, and say that actually, the interface is its own controller, as the initiative comes from the monster deck itself.
- Passive AI
- Timer – The timer is the number of rounds, which in this case is seven.
- Interface – Just like Scythe, it is the Automa deck.
- Controller – Starting a season where workers are placed. This causes an Automa card to be drawn and its workers placed. You could say that, once again, it is the turn action that is the controller.
Suburbia (Dale The Bot)
- Active AI – The player has to decide on the best possible spot for Dale’s purchased tile to go, based on reputation and income added together.
- Timer – The timer is the face down stacks of tiles, in which is hidden the 1 more round tile. You know that it is hidden within the last 13 tiles (12 plus the 1 more round tile) of the ‘C’ stack
- Interface – This is a bit different to all the other games mentioned here, because the interface isn’t a component of the game as such. It is actually contained within the rules, and is simply a set of instructions to follow when it is Dale’s turn. Basically, he buys the most expensive tile, and then the player decides the best place to put it – simple, but effective!
- Controller – The turn action.
Harry Potter: Hogwarts Battle
This only takes into account the basic game, before any extra rules and components are added by advancing through the games.
- Passive AI
- Timer – The Location cards. Once the Villains control all the locations, then it’s game over. This timer isn’t continually progressive, you can peg it back. You can also adjust the game’s difficulty by adding tokens to the locations at the start of the game.
- Interface – The Dark Arts card deck is the obvious answer, but I think that in this case there are two separate interfaces, the other being the Villains. Take either of these away and the game doesn’t work, and both are controlled by the controller.
- Controller – This isn’t as obvious as I first though. Firstly, I thought it was the turn action, which tells us to draw a Dark Arts card and then activate the villain’s abilities. But then there are the location cards, which tell us how many Dark Arts cards to draw. I then decided that the turn action was the prime controller, as this initiates the two actions, and the location cards are a secondary controller, as they tell you how many cards to draw. But then I got to thinking what the effect of drawing more Dark Arts cards actual does; It pushes the game along towards a negative outcome for the players… hang on, that sounds like something a timer would do! In the end I stuck with the turn action being the only controller. The number of cards drawn, as depicted by the Location cards, was just another part of its timer function.