Lobsters - 02 Dec 2026

Page 1 of 3

Amber Eye is an engine which plays Slay the Spire Ironclad A20H runs. In a sample of 100 games, Amber Eye won 90, including a streak of 19. The engine was trained using AlphaZero-style techniques: a neural network starts with almost no prior knowledge of game mechanics and learns to win through playing games and observing their outcomes. Amber Eye was trained from scratch on my desktop computer for about one month, playing about 13.8 million games over that time. Its playstyle is not quite like any other player I have watched, and I believe that the ideas exhibited by its gameplay are worth further study.

Why build an engine for Slay the Spire?

- It would be very cool for an engine to discover new macro ideas (or at least rediscover ideas used by humans), improving our understanding of the game.

- I actually don't know much about deep learning, and this project presented a good opportunity to learn. Additionally, there are various interesting engineering challenges associated with implementing systems to train and run the model, as described below.

- I hope to rekindle some community interest and excitement around Spire 1, which I feel still has more to discover.

I have uploaded the full set of 100 sample games for viewing. Below are a few of the games I found interesting.

- Run 80 relies heavily on Unceasing Top strategies to get by with a deck with weak output.

- Run 12 is in a strong position throughout but plays an interesting loop with 3 Reckless Charges.

- Run 96 bricks both boss relics and gets bailed out by the Act 3 shop. It also shows the effects of playing Spire for 60 hours straight in the Masked Bandits fight.

- Run 100 does a poor job preserving its resources, exacerbating a weak position.

- Run 90 plays early game with Wild Strike+ and Fire Breathing as its damage.

The 100-game sample was played with the engine controlling a real game instance, using a modified version of CommunicationMod. The engine was given a search budget of 262k positions per move (about 30-60 minutes per game).

The engine does not have knowledge of the seed or RNG state*1. I have ensured this to the best of my ability by only sharing visible or previously revealed state from the game with the engine. Formally, the model aims to learn to play "ideal Spire", an abstract version of the game where random outcomes are drawn truly at random, instead of from a seeded RNG. This is the version that players generally agree is more interesting (optimally solving "real Spire" would involve reverse engineering the seed). Both the training and evaluation settings use the RNGFix mod; otherwise, the model would be able to learn certain aspects of correlated RNG.

My first reaction when seeing the engine's gameplay was that it constantly made mistakes. My second reaction was that it wins a lot despite this, so something interesting is happening. I am a "mediocre" player myself (~30-40% Ironclad A20H winrate) so I am not particularly qualified to analyze its macro, but I will do my best here to describe its overall approach to the game.

The engine appears to aim for hard forcing looping decks in the endgame (exhaust down and play many Pommel, Shrug, Rage, Dropkick etc.), although it does sometimes incorporate alternate win conditions (Snecko, strength scaling, Barricade). It is perfectly happy to play greedily to enable looping strategies, e.g. by picking Dark Embrace on floor 1 or buying The Abacus in the Act 1 early shop. Notably, it is comfortable using Havoc or Sever Soul as core components of its exhaust engine and is flexible about how it gets its loop payoff, opening more paths to building this type of deck.

The engine's micro ability is usually rather terrible. It bleeds HP and wastes damage or potions for no reason, often multiple times per run. For example, in run 51 of the sample, it manages to throw a very strong position entering the Heart fight, with the help of a bad draw order. (I replayed the fight and won easily.) Occasionally, however, the model is able to pull off some flashy lines.

Overall, the general ideas are quite similar to the approaches used by good players, but the details look very off in a way that I'm not able to understand. Watching the engine's gameplay, I was very surprised that it was capable of reaching such a high winrate.

The engine gives estimated winning probabilities for each position, which we can use to generate Objectively Correct(TM) rankings for all items in the game. We can directly measure the engine-estimated impact of each choice on winrate from a sample of logged games.

For the charts below, we define the value of a choice as the difference in win probability in percentage points between that choice and the next best option (or skipping), or 0 if it is not the best choice. The charts are sorted by average value. The values were measured on ~43 000 self-play games played at the end of the training run. Due to being played with a lower search budget, they have a slightly lower winrate (~85%) than the runs in the sample. The lines on the chart surrounding the dots represent the 95% confidence interval.

The engine really likes option 3, as long as it is not rare colorless or max HP. The downsides are generally rated as lose max HP > take damage > lose gold > curse. If option 3 is not good, option 2 is usually pickable.

Boss swap is rated very poorly by the engine, never being picked and costing about 7-8 percentage points of winrate. Most swaps were rated as negative; only Pandora's Box, Astrolabe, Runic Pyramid, and Fusion Hammer were clearly positive.

On the two-option blessing (Lament vs +10% max HP), the engine picks Lament almost every time, but only slightly favours it in terms of value. On average, the two-option blessing is rated about 2 percentage points worse for winrate than the full blessing.

All the premium exhaust cards are highly rated, as expected given the engine's playstyle. Offering is in a tier of its own. A significant portion of the card pool is rated as garbage and never picked.

The floor 1 card ratings don't appear too out of the ordinary. The biggest surprises for me are Sever Soul and Reckless Charge as high as they are, Hemokinesis relatively far down the list, and Fire Breathing being picked a significant fraction of the time.

In the sample runs, the engine appears to be significantly more willing to pick the garbage attack commons early than indicated on this chart. In floors 1-6, Cleave was picked 4 times, Wild Strike 6 times, Thunderclap 4 times, and Sword Boomerang 2 times, which is roughly double the rate expected from the self-play games. This is the only major macro discrepancy I have noticed between the sample and the self-play games. A possible explanation is that the larger search in the sample looks farther ahead into the next hallway fights and sees the value of the attacks. Given this difference only appears with a deep search, the impact on winrate is likely marginal.

Colorless cards have a much smaller sample size. Because the engine generally doesn't like picking rare colorless from Neow, most of the rare card picks come from Sensory Stone, which probably underrates them in terms of strength (by Act 3, most runs are in a strong position and have less room to increase their win chance). Notably, Hand of Greed and The Bomb are not rated highly, which likely explains why it dislikes the Neow option.

The three books are highly rated, in agreement with how often the engine will acquire them. The HP spent to get them is not included in this chart's rating, which inflates their placement a bit. Pocketwatch far outclasses the rest of the non-boss relics. Dead Branch is picked only 80% of the time but is still near the top of the chart, while Bottled Flame is skipped 80% of the time at the bottom. Horn Cleat, Toxic Egg, Bag of Preparation, and Centennial Puzzle outperform their rarity.

To no one's surprise, Pyramid is literally off the charts in terms of value. On average, getting Pyramid is the highest-impact choice in the whole run. Unexpectedly to me, Pandora's Box and Runic Cube are the next-highest rated. Generally, the engine is quite happy to pick Runic Cube even from the Act 1 boss reward. It also doesn't care too much for energy: 31 of the games in the sample were played with no energy boss relic.

Fairy is rated far above all the other potions. This is maybe not surprising; given the engine's horrible potion management, it is better able to use the undrinkable Fairy in contrast to its tendency to waste the other drinkable potions. The Fairy is used both as a short-term resource to be spent and as Act 4 insurance. It is also a high-priority purchase in shops.

Many shop relics are highly valued, especially The Abacus, which often turns into the core of the deck's block engine. Despite a model limitation where the engine's visibility into the deck order is limited to the top two cards, Frozen Eye is still often purchased.

Shop card purchase rates roughly track their general rating. The engine is quite willing to purchase removes even in Act 1.

Colorless card purchases are more niche.

Potions are frequently bought (and thrown away on the next floor). Fairy is the top-priority purchase in the shop on average.

For Scrap Ooze, the engine clicks at least once about 96% of the time. Most of the time, it will click at least 3-4 times before giving up, depending on how much HP it has. Interestingly, it often skips the Golden Idol, although this choice probably does not impact winrate significantly. It never takes the upgrades in Shining Light; generally, it does not rate upgraded basics highly.

Notably, the engine virtually never upgrades all basics in Ancient Writing, which is generally considered to be one of the strongest Act 2 event options. In the context of the engine being very remove-pilled, however, this makes a bit more sense. It also rarely takes Apparitions and Bites. JAX tends to be taken with Runic Cube. In The Joust, the engine tragically has little faith in Noodles.

For the Mysterious Sphere, the engine is usually in a strong position entering Act 3, so it often doesn't consider the risk of fighting the double Orb Walkers worth it. Mark of the Bloom is never taken. It also takes the Madnesses a surprising amount. I don't see the vision, as the Madnesses seem to typically not perform well in its decks, but who am I to judge.

The engine actually chooses to trade faces sometimes, which seems terrible to me, but maybe it doesn't rate the bad faces as badly.

HP lost in this chart refers to average net HP change, including healing from Burning Blood, Reaper etc.

The engine doesn't tend to take the Dead Adventurer Lagavulin fight in especially weak positions, as the chart might suggest. Taking the fight too often may be one of the engine's blind spots. More generally, the engine seems to prefer spreading out the risk more throughout the course of the run, instead of concentrating it in Act 4.

"Never" covers games the engine loses.

The engine prefers to take the keys notably earlier than most players, although this probably has a small overall impact on winrate. In a large majority of games, it has already Recalled before entering Act 3.

The rates here denote the percentage of time the option is taken versus the total number of rest site visits. For Lift, Dig, and Toke, the percentage is over the rest sites where the relic is owned.

The engine doesn't mind resting a lot and generally only values a few key upgrades (Pommel Strike, Feel No Pain, Body Slam, Havoc, Offering etc.) When it owns a rest site relic, it usually makes use of it.

Now, on to the technical details of how I built the engine (with a bit of Spire trivia thrown in). If you are not a giga nerd who is interested in the nitty gritty of how to build such an engine, you can probably stop reading here or after the next couple of sections. Check out the runs from the sample, and I will be working on extending the engine to the other three characters.

The AlphaZero paper demonstrated top-performing engines for chess, go, and shogi, but more importantly provided a general-purpose method to train computers to play a relatively broad family of games (discrete action space, two-player, deterministic, perfect information). The recipe works roughly as follows.

Apart from very simple games, it is impossible to exhaustively enumerate each game state and derive a perfect strategy from it. Thus, since very early on, game-playing programs have combined position evaluation (estimate the value of the current state) and search to improve the evaluation (simulate playing some moves to figure out the best line and get a more accurate judgement of the position). Historically, the main research areas have been to make the value estimation more accurate and to improve the search algorithm. AlphaZero's contribution is to bundle value and search into a self-improving loop driven by the learning of a neural network.

More specifically, the AlphaZero network takes as input a game position and predicts both its estimated value and a policy, a probability distribution over the legal moves from the position, indicating what the network thinks is the best move. The policy can be incorporated into the search algorithm to concentrate on moves which the network thinks are good. The model generates its own training data in self-play, where it plays games against itself using the search; labels are obtained from observing the games' outcomes and statistics from each search.

The two main ideas are that the value and policy predictions complement each other (more accurate policy leads to improved search leads to more accurate value estimation and vice versa), and that the network augmented by the search is a bit stronger than the network itself, so the model can continually bootstrap itself by learning from the stronger search-improved targets.

Spire differs in many important ways from the setting in the AlphaZero paper, and so needs domain-specific adaptation:

- Spire is a single-player game.

- In a two-player game, in self-play the model plays against an opponent that is just as bad as it, and so is able to receive training signal about won and lost games. In a complex single-player game like Spire, the model will start out by always losing, and will then learn that all positions are lost and "give up", never receiving signal that helps it make progress.

- AlphaZero deliberately adds noise to decisions in self-play games, in order to be able to discover strategies its network may be underrating. This noise comes at a direct cost to play strength. For a two-player game, this is less important as the opponent's strength is reduced by the same noise. But for a single-player game, it becomes critical to find a favourable balance between exploration and play strength.

- Spire has a much longer time horizon than the games in the paper. Typical chess, go, or shogi games end in fewer than 300 or so moves (by either player). A typical game of Spire can run well over 1000 decisions, meaning the model has to be able to plan much farther ahead, making it harder to propagate learnings from the end of the game back to the start, and exacerbating the value memorization problem.

- Spire has a considerable amount of randomness, with random rolls affecting the game state about every 2-3 decisions. This adds sampling noise to the search, increases the amount of compute required to look ahead to a given depth, and reduces the signal that can be learned from the game's outcome as it is partially influenced by random chance.

- Chess, go, and shogi are all easily representable in a format that a neural network can process. A position in Spire is considerably more diverse in its game state and action space, requiring more care in its encoding.

- The models in the AlphaZero paper were trained on a cluster of 5000 TPUs for self-play and 64 TPUs for training, over the course of up to 13 days (for go). I have a single GPU available for both self-play and training, and while it is quite a bit faster than a single decade-old TPU, I don't have the time to wait hundreds of years for the model to train.

While these are significant challenges, not all the solutions need to be invented from scratch, as other projects such as KataGo and Leela Chess Zero have already improved on AlphaZero's method. Most of the techniques that follow are adapted from followup research to AlphaZero.

Reinforcement learning is monstrously compute-hungry. The model's improvement is driven by self-play, requiring a lot of compute to generate a tiny amount of value signal from the game outcomes. As the model learns, its strength increases and thus the training target also changes, requiring more fresh self-play data, and so on. Given this constraint, the guiding design principle motivating all of the following items was to make the learning as compute-efficient as possible.

In total, Amber Eye was trained from scratch in about one month, including time spent on experimentation. I think that by applying learnings from the initial run, a model of equal strength could be trained in about one week.

When searching, Amber Eye uses its own reimplementation of the game engine, built using sts_lightspeed with some minor enhancements. The implementation is quite fast, searching about 800 000 positions per second on small (CPU-bound) networks on my 8-core machine.

sts_lightspeed is mostly accurate to the real game, but contains some bugs, which were discovered and patched over time by having Amber Eye play in the simulator and the real game in parallel and flag state divergences. The patched simulator is faithful enough to not significantly impact the model's winrate, but Spire itself has a lot of weird bugs which were not worth replicating:

- Several RNG rolls (Discovery, Courier restocks) are based on unseeded RNG and thus can vary. This has no impact on the game from the perspective of "ideal Spire" and so doesn't actually affect the model's decision making.

- There are several timing-based bugs, including:

- Reaper can fail to heal when playing it ends the combat and there are enough queued animations from e.g. power effects. Fewer animations are required if Fast Mode is on.

- There is a Corruption display bug where skills are shown to have nonzero cost and can only be played with sufficient energy, but don't actually use the energy. Some, but not all, of the skills generated from Chrysalis can be affected by this bug, but which ones depends on whether Fast Mode is on.

- When obtaining Searing Blow from Match and Keep with Molten Egg, somehow you get a "Searing Blow+2" which deals 17 damage (Searing Blow+1 deals 16 and Searing Blow+2 deals 21). I believe this also happens with Searing Blows created by e.g. Foreign Influence with Master Reality in play. This is really funny, but also some nonsense that I don't want to rewrite the simulator to support.

The simulator gives a minor amount of help to the engine, mostly to reduce compute cost:

- in positions with one legal action, it is automatically taken;

- gold from rewards is automatically taken;

- actions are canonicalized (e.g. if multiple Defends are in hand, the simulator only exposes playing the first one); and

Next page | More Lobsters | Headlines

Original: https://8e9f.github.io/amber_eye/