Hearthstone

Developer Insights: Smart Deck Builder

Developer Insights: Smart Deck Builder

Greetings, everyone! I’m Tian, a Senior Data Scientist on the Hearthstone team, and I’m here to talk about the new smart deck builder feature. I’m hoping to answer some of the questions that have bubbled up in the community since this feature was recently introduced.

Let’s start off with a simple introduction to the feature before we dive into what I know you’re really here for – the science!

HS_Blog_Divider_Filigree_Bar.png

What is the Smart Deck Builder?

We know that creating a new Hearthstone deck can be a fun and rewarding experience for a lot of experienced players, but maybe you’ve taken a break from Hearthstone, or you’re new to the game, or you’re on a time crunch, or just need a little help turning your collection of cards into something you’re proud to take to the ladder. That’s where the smart deck builder comes in. Its purpose is to take care of the heavy lifting and get you into a game with a popular and effective deck, with just a couple of clicks!

To use the smart deck builder, start by creating a Standard deck with any class, using any number of cards. After clicking “Complete My Deck” or “Done”, the feature will intelligently fill out the rest of the deck for you based on what cards you’ve already chosen, using only cards from your existing collection. To give an example of how we might complete a deck, if you choose Oondasta and Play Dead and let Hearthstone take the reins, the smart deck builder will consider several factors, then build what it considers to be the best possible deck, such as the popular Katherina Winterwisp Deathrattle Hunter.

03_27_HS_DeveloperInsights_SmartDeck_BlogDecklist_800x1000_JY_v01_enUS.png

It’s really as simple as that. Start an empty deck or choose a few cards that you know you want to play, and we will take care of the rest to make you an awesome deck.

HS_Blog_Divider_Filigree_Bar.png

How it Works:

Let’s dive into the engineering at work behind the scenes. The smart deck builder system has two layers, and each layer has multiple sub-layers that work to auto-complete your deck. Now let’s explore what each of these layers does to create the deck you want. . . .

The First Deck Creation Layer: Making the Meta

03_27_HS_DeveloperInsights_SmartDeck_BlogAssets_300x400_JY_v01_H.jpg

To avoid any confusion, let’s quickly go over what we mean when we are talking about “the meta.” Meta is short for “meta-game” and describes the current trend of decks seen on the ladder, particularly in ranked modes. When attempting to build a successful deck, many players will try to keep the current meta in mind and will include cards to help them succeed against the decks they’re likely to encounter. To give an example, in a weapon-heavy meta (where many popular decks contain weapon cards), decks will likely include Acidic Swamp Ooze or Gluttonous Ooze to destroy the weapons, thereby effectively “countering” the meta.

In the first layer of deck creation (AKA, the “meta layer”), we’re trying to build the best deck possible based on what is currently popular in the meta, what you’ve already placed in the deck, and what is available in your card collection. To determine what is considered meta, we use a computational algorithm to group popular decks with the same basic type into subgroups. Each subgroup represents a type of deck seeing play in the current meta, such as “Secret Hunter,” “Dragon Priest,” “Odd Paladin,” etc. The contents of each deck inside of these subgroups may differ slightly, but they’re ultimately the same deck type. In machine learning terms, this process is called “clustering.” Our clustering algorithm parses data consisting of millions of variations of decks, with each deck counting as one data point, and with each data point representing a vector in hundreds of dimensions. Utilizing this clustering information, combined with other mathematical solutions, the algorithm then dynamically fills your deck until the deck is full, or the second “back-fill” layer is triggered.

Since players at different skill levels will invariably have different decks, play patterns, and challenges, the meta will likely vary depending on where you are in the ladder. To handle this, we have different sub-layers for this meta-deck filling process. If you are a player around rank 20, you will probably get a different meta deck from a Legend rank player. Additionally, our meta report pipeline updates at a frequent cadence so your meta deck is always up-to-date.

After we’ve tried to make an effective meta deck using what you initially included in the deck and your card collection, we move on to the second creation layer. . . .

The Second Creation Layer: Back-fill

03_27_HS_DeveloperInsights_SmartDeck_BlogAssets_300x400_JY_v01_G.jpg

If the meta layer was unable to find 30 cards for your deck using your collection, the second layer, aka the “back-fill” layer, comes into play. This layer ensures your deck is complete and is using the best available cards. Firstly, if the game decides that it can’t make an effective meta deck using your collection, it will revert to making the best deck possible with your available cards. The core idea for the back-fill algorithm is to make a balanced deck with good cards and a decent mana curve. Let’s talk about how we determine if a card is good for your deck.

Without considering unique synergies and combo potential, each card has an individual “card power” rating when used in a deck for each class. This number is not a constant and changes dynamically based on the deck’s current composition. However, determining card power generally depends on three factors:

  • Game Impact: How much a card contributes to a deck’s win rate.
    • For example, Water Elemental has a larger win probability contribution than Dread Corsair for Mage.
  • Mana Cost Bucket: A collection of cards with the same mana cost.
    • If our target is to find one card to fill a spot in the 1 or 2-mana bucket, Argent Squire may be a good choice, but almost certainly not for the 5-mana bucket.
  • Avoiding Overfilling a Mana Bucket:
    • If there are already 10 cards in any specific mana-cost bucket, we are reluctant to add any more cards in that cost range, unless these cards are significantly better than the alternatives.

During the back-fill process, we dynamically choose a card with the best card power to include in the deck. In math-speak, card power is a function that consists of terms transformed from win-rate contribution plus multiple penalty terms. Our goal for each search is to find the card among all feasible solutions that maximizes our objective function.

HS_Blog_Divider_Filigree_Bar.png

Miscellaneous Things, Rules, and Restrictions

03_27_HS_DeveloperInsights_SmartDeck_BlogAssets_3Steps_600x260_JY_v01.png

Aside from advanced mathematics and machine learning methods, we’ve also implemented many quality assurance rules within these two deck-creation layers to make sure your deck simply makes sense. For example, if you already have Prince Keleseth in the unfinished deck, we will try our best to avoid any two-cost cards.

If you don’t put any cards into the deck and ask us to recommend decks repeatedly within a short period of time, we will try to give you different decks every time you click the button. This feature will not be triggered unless the initial deck is empty, however.

As for restrictions, the smart deck builder is currently only enabled when creating Standard decks, but Wild support is something we’re exploring. Additionally, the single card recommendation feature that pops up when you attempt to create a deck containing cards that aren’t in your collection does not currently use the smart deck builder.

HS_Blog_Divider_Gems.png

Feel free to share any cool decks you’ve made with the smart deck builder and let us know if you have any questions in the comments below. We’ll see you all in the Tavern!

Next Article
Diablo III
5h

Legendary: An Ancient & Primal Guide

For those of you who may have taken a break from gathering loot recently, we thought a quick refresher was in order on Legendary, Ancient, and Primal Ancient items.