Q-DeckRec: A Fast Deck Recommendation System for Collectible Card Games

Zhengxing Chen, Christopher Amato, Truong-Huy D. Nguyen, Seth Cooper, Yizhou Sun, Magy Seif El-Nasr

Abstract

Generating optimal decks in Collectible Card Games (CCGs) is a complex combinatorial optimization problem. Traditional search-based methods, such as Genetic Algorithms (GAs), are computationally expensive and often require hours of simulation to produce a single recommendation. We present Q-DeckRec, a reinforcement learning-based system that utilizes Q-learning to navigate the deck-building search space. By shifting the computational burden to an offline training phase, Q-DeckRec generates high-performing decks in under 10 seconds, matching the effectiveness of GA baselines while providing a massive leap in efficiency.

Introduction

In CCGs like Hearthstone, players must select a fixed-size subset of cards from a pool of hundreds or thousands. For a standard deck of 15 unique cards chosen from a pool of 312, there are approximately $1.4 \times 10^{25}$ possible combinations. Evaluating the quality of a deck typically requires simulating hundreds of matches against an opponent, making the search for an optimal deck computationally prohibitive. Existing solutions like Genetic Algorithms (GAs) are "non-learning" searches; they must start from scratch for every new opponent, requiring thousands of expensive simulations for each recommendation. This limitation makes them unsuitable for real-time applications or large-scale game balancing.

Methodology

Q-DeckRec addresses these challenges by modeling deck building as a Markov Decision Process (MDP) and using reinforcement learning to learn a search policy.

  1. MDP Formulation: The agent starts with a random deck and iteratively replaces cards to improve performance.
  2. Q-Learning with Neural Networks: A Multi-Layer Perceptron (MLP) approximates the Q-value (expected future reward) for specific actions, allowing the system to generalize across an astronomical state space.
  3. Reward Shaping: Rewards are based on the win rate against a specific opponent, exponentially amplified to help the agent distinguish between high-performing decks.
  4. Prioritized Experience Replay: The agent focuses its learning on transitions with high temporal-difference (TD) error to improve training efficiency.

At recommendation time, the agent follows its learned policy for a fixed number of steps. Crucially, it does not need to run any game simulations during this phase, as the "knowledge" of what makes a deck effective is already encoded in the neural network.

Experimental Results

The researchers evaluated Q-DeckRec using MetaStone, an open-source Hearthstone simulator, focusing on the "Warrior" class with a 312-card pool. The system's performance was compared against a Genetic Algorithm baseline.

Performance of Q-DeckRec across different training durations.

As shown in Figure 1, Q-DeckRec's effectiveness improves significantly with training time. After three days of training, the system achieved a win rate of 0.93. Most importantly, the search time required to generate these recommendations was only 9.63 seconds of CPU time.

Performance of the Genetic Algorithm (GA) baseline for comparison.

In contrast, Figure 2 illustrates the computational cost of the GA baseline. To achieve a comparable win rate (0.94), the GA required 15.9 hours of CPU time. This represents a massive leap in efficiency for Q-DeckRec, reducing recommendation time from hours to seconds.

Discussion

Q-DeckRec's success stems from moving the computational bottleneck from the recommendation phase to the training phase. By training on various opponent decks, the agent learns a search policy that generalizes to unseen opponents. The MLP-based architecture successfully generalized state-action values despite only seeing a tiny fraction (roughly $4 \times 10^{-47}\%$) of the total possible state space during training.

Furthermore, Q-DeckRec proved more robust than simple regression-based win-rate predictors. While predictors can be "tricked" by outlier decks with spuriously high predicted win rates, Q-DeckRec's policy-based approach focuses on finding reliable paths to improvement in the card space.

Conclusion and Future Work

Q-DeckRec demonstrates that reinforcement learning can effectively solve high-dimensional combinatorial optimization problems in gaming. While the current system uses greedy AI proxies, future work will involve training against more human-like AI or real player data. Additionally, the authors suggest exploring transfer learning to handle "meta shifts" caused by game balance patches and developing methods to optimize decks against groups of popular decks rather than single opponents.

Summary updated

BibTeX
@inproceedings{chen2018q,
  author = {Zhengxing Chen and Christopher Amato and Truong-Huy D. Nguyen and Seth Cooper and Yizhou Sun and Magy Seif El-Nasr},
  title = {{Q-DeckRec: A Fast Deck Recommendation System for Collectible Card Games}},
  booktitle = {CIG},
  year = {2018},
  doi = {10.1109/cig.2018.8490446},
}
Figure