Overview
This is meant to be an in-depth look at how the AI makes decisions in Age of Rivals, a strategy card game. This AI is considered to be pretty strong by players, so hopefully this will be useful to anyone approaching the challenge of building a competitive AI opponent for a strategy game.
The Game
To anyone unfamiliar with Age of Rivals, a quick video overview can be found at https://www.youtube.com/watch?v=S2WhRlh2tqI.
Briefly, Age of Rivals is a card drafting game in which 2 players compete to build the best ancient civilization. Players draft 16 cards to form their city over the course of 3 rounds and then select their best 8 cards for a final showdown round. Each round also consists of a War phase during which cards attempt to knock each other out and a Scoring phase used to earn the points that ultimately determine the winner. City cards each have various stats and a special ability that can influence the outcome of the game.
Goal of the System
The initial goal of the AI was to provide a good learning experience for new players, at which point players would transition into playing multiplayer exclusively. But as we realized that there was a significant number of players who wanted to play single player, I kept improving the AI to play at a higher level.
During the course of any AoR game, there are basically two kinds of decisions a player must make:
Which card to draft out of a possible pool of 3 or 4 cards.
Which cards to assign any opponent damage to.
Drafting
To make the first decision (what to draft), the AI scores each card across 17 different categories. For each category, a function examines the card and the current state of the game and returns a score between 0 and 1. Then the AI weights each of these results, averages them into an overall score, and drafts the card with the best overall score. Weights for the categories range from 1 (not very important) to 20 (very important).
The 17 categories are:
Discounts
How much of a discount am I getting on this card?
Taxes (negative factor)
How much tax do I have to pay my opponent for this card?
Affordability
How affordable is this card given how much Gold I have left and how many cards I still have to buy this round (so I won’t end up with Waste).
Resources
How many new resources will I get with respect to how many resources I and my opponent already have and which round we are in.
Income
How much income will this card generate with respect to how much income I and my opponent already have and which round we are in.
Gold
How much immediate gold will this card give me this round?
Culture
How much culture will this card give me with respect to which round we are in?
Conquests
To what extent does this card allow me to win additional conquests?
Damage
To what extent will this card allow me to make a dent in my opponent’s current armor?
Armor
To what extent will this card help me deal with my opponent’s upcoming attacks?
Field Combos
How well does this card combo with my other cards currently in the field this round?