Skip to content
Jerome Leclanche edited this page Aug 2, 2024 · 1 revision

There is a laundry list of things we need to do before we can develop serious AIs and play against them. This work is ongoing; if you would like to participate please examine the tasks below and tackle any you think you can manage (please ask for help!).

Fireplace tasks

This is the Hearthstone simulator. Requires knowledge of Python and the fireplace code base.

  • Many card interaction bugs in the Hearthstone client (see Hearthstone protocol section below). NOTE: Here we are talking about bugs in the way the actions are presented to the Hearthstone client, NOT actual card behavioural bugs in fireplace.
  • Deep-copying of the game state performance is very slow. We need a fast copy mechanism
  • Selector and action performance. Same as above, we need faster performance
  • Tick-based game loops. This is a potentially complex re-write which will let us queue state change deltas in the game rather than applying them immediately. This has the benefit that the AI can step forwards or backwards one step at a time, potentially learn the behaviour of individual cards if desired, but most importantly since deltas are queued rather than applied immediately, it would allow us to eliminate most of the game state deep copies.
  • Random outcomes: currently the generation of card draw and random spell and minion effects cannot have the random outcome controlled. We need a way to iterate through these, either returning the probability of each result, or a set of game states or deltas with their probabilities (since some random effects will have the same end result)
  • Deeper API: the ability to fetch in advance mana costs, attack values and so forth

Fireplace AI tasks

  • AI API: the ability to take a board state and calculate things such as most efficient mana use, most attack value, whether we or the opponent has lethal, even trades, free trades and so on
  • AI threads: the ability to run AI analysis on a background thread during the opponent’s turn
  • Naive AI baselines: example baseline AIs: maximum damage per turn, play randomly, maximum board control per turn etc.
  • AI testing: the ability to make a group of AIs play X games against each other in every combination and produce a CSV file of the win rates of each

Kettle tasks

The Kettle server is written in Python. The Kettle client is written in Go. Both require knowledge of the Hearthstone protocol, the fireplace codebase and the stove codebase to work on.

  • Allow stove to choose an AI opponent based on player’s choice

Stove tasks

Stove is written in Go and requires knowledge of Go and the Hearthstone protocol.

  • Ranked/casual matchmaking code
  • Friend challenge code
  • Fake AI accounts which let you send commands to select an AI, initiate two AIs to challenge each other or queue in matchmaking etc.
  • Spectator mode

Learning the Hearthstone protocol

Install DeepLog - https://github.com/djkaty/UnityHook/releases - and play games. There is a lot of information we have already amassed which is not written down anywhere so just ask if something doesn’t make sense! Also study the .proto files in stove (or hs-proto-go) and the stove source code.

The Hearthstone game state is based on entities and tags. Everything is an entity: the game itself, each player, each card/minion/spell/weapon, each hero and each hero power. Entities are created and modified via setting or changing tags on them. For example, the ZONE tag specifies where in the game an entity is placed, for example HAND, DECK, PLAY or GRAVEYARD among others. Study the logs from DeepLog to understand these interactions.

Hearthstone groups tag changes into “action blocks”. These have different types such as PLAY (the player has just done something), POWER (the thing the player just did is executing), TRIGGER (a spell effect or similar is triggering) and so on.

Hearthstone game interaction bug hunting

Install a diff tool like WinMerge and use the following workflow:

  • Play a bugged card in stove
  • Play the same card on the real Hearthstone server
  • Create a log diff
  • Modify fireplace to reduce the diff to zero

Note that the order of many tag changes does not matter, but some are critical and must be placed in the right action blocks.

Resources

Settng up for development with fireplace, stove and kettle: https://github.com/djkaty/fireplace/wiki/AI-development-configuration-with-fireplace-and-stove
Python and fireplace installation instructions: https://github.com/djkaty/fireplace/wiki/Detailed-Installation-Instructions

Go and stove installation instructions:
https://github.com/HearthSim/stove/wiki

Video tutorial - Fixing tag and action block bugs in fireplace: https://www.youtube.com/watch?v=su8i0p-iZgs&feature=youtu.be

Google’s exccellent Go tutorial: https://tour.golang.org/list

Neural networks introduction: https://www.youtube.com/watch?v=bxe2T-V8XRs (7 videos)

Brimstone proposal: https://docs.google.com/document/d/1h3FDi57aEj_mWyeQhfCRX4eddOGi3WbLcowfdK33FrQ/edit