Optimizing Hearthstone agents using an evolutionary algorithm

Pablo García-Sánchez, Alberto Paolo Tonda, Antonio José Fernández Leiva, Carlos CottaKnowledge-Based Systems 2020

Abstract

Digital Collectible Card Games (CCGs) present significant challenges for artificial intelligence due to hidden information, stochasticity, and complex state spaces. This paper details the development of a competitive coevolutionary algorithm designed to optimize a Hearthstone agent. By evolving the weights of a 21-parameter scoring function through self-play, the researchers developed a "greedy" agent that prioritizes immediate board advantage. The resulting agent, EVA, secured second place in the 2018 CIG Hearthstone AI Competition with a 74.2% win rate, outperforming more complex Monte Carlo Tree Search implementations.

Introduction: The Challenge of Digital CCGs

Hearthstone is a prominent example of a Digital Collectible Card Game (CCG) that poses a formidable challenge for AI research. Unlike perfect-information games like Chess or Go, Hearthstone involves hidden information (the opponent's hand and deck), significant randomness (card draws and "RNG" effects), and a vast, evolving ruleset.

A primary obstacle in developing AI for such games is the "bootstrap problem." Without a pre-existing, high-quality opponent to train against, it is difficult to measure an agent's progress or prevent it from overfitting to weak strategies. This research addresses this by employing a self-learning framework that optimizes decision-making parameters without external baselines.

Methods: Competitive Coevolution

The authors developed a "greedy" agent that evaluates the game state after every possible legal action. This evaluation is performed by a scoring function governed by 21 real-valued weights. These weights represent the relative importance of various game state features, such as hero health, minion stats, and resources.

Hearthstone card mechanics illustrating the various attributes (Mana, Attack, Health, Durability) that the agent's scoring function must evaluate.

To optimize these weights, the researchers used an Evolution Strategy (ES) centered on competitive coevolution. In this model, a population of agents with randomized weights is created and plays against each other and their offspring. Fitness is determined by win rates within this internal ecosystem. The most successful agents survive and reproduce, creating an "arms race" that drives the population toward increasingly sophisticated strategies.

Experimental Setup

The study utilized the SabberStone open-source simulator. To ensure competitive relevance, the agents were tested using three distinct deck archetypes from the CIG2018 competition:

  • Aggro Pirate Warrior: A fast-paced deck focused on early-game pressure.
  • MidRange Jade Shaman: A balanced deck that scales in power as the game progresses.
  • RenoKazakus Mage: A complex control deck requiring careful resource management.

Key Insights from the Evolutionary Process

The evolutionary "arms race" revealed several fundamental principles of high-level Hearthstone play:

  • Mana Efficiency: The algorithm learned to heavily penalize unspent mana. Successful agents evolved to prefer sequences of actions that exhausted their mana pool, maximizing their "tempo" on the board.
  • Prioritizing Removal: The weight for "minion killed" significantly outweighed "minion health reduced." This reflects the tactical reality that an injured minion remains a threat, whereas a removed minion provides zero value to the opponent.
  • Rarity Irrelevance: Interestingly, the weight for card rarity (e.g., Legendary vs. Common) evolved toward zero. While rare cards are often powerful, their rarity is not a useful metric for determining the optimal time to play them during a match.
  • Specialization: Clustering analysis showed that different agents evolved to specialize in specific decks, with some becoming "Aggro specialists" and others mastering "Control" strategies.

Results and Competition Performance

The final optimized agent, EVA (EVolutionary Agent), was entered into the 2018 Computational Intelligence in Games (CIG) Hearthstone AI Competition. EVA achieved a 74.2% win rate, placing 2nd out of 33 participants in the "Premade Deck Playing" track.

Significantly, EVA's greedy approach outperformed several agents using Monte Carlo Tree Search (MCTS). While MCTS is often considered state-of-the-art, its performance in Hearthstone is frequently hampered by the game's high branching factor and the need for well-tuned heuristics. EVA's success suggests that a rigorously optimized heuristic, even with a limited lookahead, can be more effective than a deep search using sub-optimal evaluation functions.

Conclusion and Future Directions

While highly effective, EVA is limited by its "greedy" nature, looking only one step ahead. This prevents the agent from planning multi-turn combinations or anticipating future opponent responses. Future work aims to integrate MCTS with the evolved scoring function to combine deep search capabilities with optimized heuristics. Additionally, the researchers propose coevolving both the agent's decision-making weights and the deck compositions themselves to tackle the "User-created deck" challenge.

Summary updated

BibTeX
@article{garciasanchez2020optimizing,
  author = {Pablo García-Sánchez and Alberto Paolo Tonda and Antonio José Fernández Leiva and Carlos Cotta},
  title = {{Optimizing Hearthstone agents using an evolutionary algorithm}},
  journal = {Knowledge-Based Systems},
  year = {2020},
  doi = {10.1016/j.knosys.2019.105032},
}
Figure