Amber Eye: a Slay the Spire engine approaching top-level play

188 points - yesterday at 6:38 PM

Source

Comments

b450 yesterday at 7:35 PM
A lot to take in here. One interesting random observation: The model rates Searing Blow as the worst card. The key with Searing Blow is that each upgrade gives it a larger marginal improvement than the last one. So the best strategy is generally to path towards upgrades and put them all on Searing Blow, avoiding too many dangerous elite encounters while scaling it up, and ending up with a card that can kill nearly everything short of the heart in 1 or 2 hits. Without maxing it out, Searing Blow might soak up several precious upgrades and still remain a mediocre attack (it notoriously needs _4_ upgrades to be better than Carnage+). I reckon that the winning strategy around Searing Blow is a small, steeply-sloped optimum, so a neural network is very unlikely to find it by working up a gradient. Rather, it seems to have converged on a reliably forceable strategy (exhaust, which _is_ Ironclad's most reliably good archetype) which more or less linearly gets stronger the more you invest in it. As I recall, the player with the best Watcher win streak (at least for some time) basically did this by forcing the red-blue strategy and refusing to draft anything unrelated to it.
0cf8612b2e1e yesterday at 7:18 PM

  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)
Is this different from how the real game works? I thought cards games had some thumbs on the scale: instead of truly random, you might get a random sort of N items, which gets shuffled after you have seen all entries. So, randomized, but you can only every encounter so much good/bad luck.

Edit: reading a little further, there are indeed some weaknesses in the standard gameplay randomness, so this version is slightly different.

wincy yesterday at 7:13 PM
Slay the Spire and Slay the Spire 2 are such cool games because the .NET code is just sitting there. I play the early access beta branch of StS2 and have over 400 hours played and wanted it on the go, it took Codex Astra about one hour to get a rough port then 1.5 hours of me QA testing to get it totally playable on iPhone Duo
Buttons840 today at 1:39 AM
I tried to do the same years ago, but had a setup playing games in real-time. It would play through 40 games or so, and then do a round of reinforcement learning on the data (I tried SAC and PPO, and creative alterations).

My bot could block and attack with basic cards, and regularly beat the act 1 boss, but never got better than that.

I realized I needed more games and more data, but wasn't interested enough to further mod the game for more speed.

My take away was that any game could be solved with PPO if only you can generate enough data to train on.

yfontana yesterday at 7:16 PM
Super interesting read! I only played STS a little bit years ago, so the discussion of various choices went over my head. But it's quite interesting that, as far as I understand, the engine's main strength is its macro strategy, and it is strong enough at it to compensate for weaknesses in the micro. Intuitively it seems like the micro should be easier to learn (as at least some of the consequences are more direct: you lose more HP).

I also find it pleasantly surprising that this could be trained on a single GPU in a reasonable amount of time. I don't think the exact GPU is ever mentioned though. I'm guessing it's a typical gaming GPU like a 5080, rather than something like an H100?

kinnth today at 1:14 AM
what a great read. I'm a 2000h spire player, not actually got lvl20 on ironclad i did it with defect. The level of options you go to was super interesting and its very inspring to help me consider training my own AI to play "problems".

Did you learn a lot about packaging something like this for real world problems or is it always about fixing the specific issues on the game itself as the complexity even of the closed system is high.

dcl today at 1:01 AM
Absolutely awesome. Lots of important things here for those interesting in applying RL to new games/domains.
alex_boyd today at 2:13 AM
Awesome read. I've been working on a similar RL side project for Netrunner for a few months, and see you landed on many of the same recipes to handle the issues with stocastic nature of self play.

Here's a few ideas though that I think have potential here for next experiments.

1. Try out something like recipe in variance reduced policy optimization which tries to model how lucky the random outcomes were, and subtract the luck from any advantage and credit-assignment signals. In theory over large enough training sets, the luck cancels out, but you can in cut down the training speed / data volume needed massively if you can get this working. https://arxiv.org/abs/2605.19235 is the original paper I used for reference, and also found a great implementation of it that seems pretty solid for reference with uno over here: https://github.com/TanishkBansode/uno-ataraxos/blob/main/doc...

2. A cool idea that seems to reproduce on games, and easy to do for a modal based game where you start with a perfect simulator, is to do a pretraining pass on the network, with a aux head that just predicts the game state as a function of the current state + action. Basically instead of starting from a random network at the start of self play, you start with one that knows how to predict the consequences of actions. You can generate the data for that brute force from random play to generate huge volumes of data cheaply, if you already have a simulator, and it takes the exact same inputs as the final network so works great as a way to get the game dynamics into the shared trunk before you start to train it towards skillful play. https://www.kaggle.com/competitions/pokemon-tcg-ai-battle/wr... Has a great write up from a model trained to play the pokemon tcg showing how it was cheaper overall to add this starting phase in that game, since it sped up the rest of the training more than it cost to add that extra phase. I suspect that might also align things better in general so the later generalization is stronger when it can reuse structure that maps to the real game dynamics.

3. I've also had a bit of luck with approaches like go-explore. https://arxiv.org/abs/1901.10995. You basically keep around a bank of slightly rarer off policy id game states, and start runs from those states, not always from a cold start fresh game. With a bit of work, you can seed these with states the network might be less confident about, to generate more data in those regions far far cheaper than just scaling up self play entirely to get more of these rare states at low probability. Picking the right criteria for what states to put into this bank seems tricky though and takes some experimentation to find which types of starting states are the most valuable at different parts of the training progress. Picking a few states closer to a win, even if you played it manually till near the end of the game, also gets you win feedback signals way earlier in training, and can also be a great way to bootstrap faster on a fresh network / recipe. Even mixing in a small number of these near wins, mixed with a lot of cold starts can massively speed up that initial slow start with this sort of method. For something like slay the spire, you could even collect states from trajectories winning with builds the network rarely finds the payoff for, to help teach the value network what the end game value of that build is, to help bootstrap things beyond the normal horizon your search budget can assemble. From there the normal training loop can generalize it and find the optimal version, but with a way way cheaper way to bootstrap the value function thinking the build is bad until many components all pay off.

Routine8502 yesterday at 7:04 PM
Extremely cool! Is there any way we can run this ourselves?
bradleybuda yesterday at 7:09 PM
Fascinating stuff. I watched a couple of the videos and as the author points out, the engine's tactical play ("micro") is truly awful - a total neophyte would beat it on many micro decisions. Looking at the card / relic / event / Neow bonus choices, the engine really does not want to lose HP - my understanding is that most top players are far more comfortable with treating HP as a resource to be spent. Putting these two together: I suspect the engine is "correcting" for its bad micro by preserving HP to paper over mistakes. If the micro were improved even slightly, the Objectively Correct™ card / event / relic rankings might look significantly different.

But it plays way better than I do, so who am I to judge?

Gormo yesterday at 8:01 PM
This seems to be a bot that plays Slay the Spire, which continues to run in its original engine, and not an engine for the game at all.
dm130 yesterday at 11:57 PM
Very exciting! Does anyone know if something like this could be possible for Darkest Dungeon?
ludamad yesterday at 8:58 PM
Wait approaching top-level? Aren't top players like Jorbs at like 60% WR
dayone1 yesterday at 7:30 PM
would love to see STS2 analysis for this!
mpalmer yesterday at 8:43 PM
Is engine the right word for a game-playing bot? I clicked thinking I'd be getting a means of playing/creating new StS content, perhaps.
Nehir14 yesterday at 11:41 PM
[dead]
emmareinhardt yesterday at 10:04 PM
A Slay the Spire engine approaching top-level play is a strong sign the approach works - nice work.