Amber Eye: a Slay the Spire engine approaching top-level play
137 points by gcmeplz 5 hours ago | 74 comments

b450 4 hours ago
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.
reply
btown 41 minutes ago
It occurs to me that an interesting training strategy in general might be: periodically have an LLM read the rules and a sample of good runs, come up with hypotheses about interesting strategies, rewrite the reward function (and potentially the search code) to explore them, and run parallel training to find examples that score highly on both the original reward function and the new one. Then feed those examples back into the original training run, so it starts to see things its own exploration would never reach. Do people do this?
reply
tarsierscripter 21 minutes ago
The opportunity costs for searing blow runs, in terms of missed cards, missed relics, and missed card removes (critical for building a card-draw efficient deck) is so high that you will lose runs because your deck is incredibly weak when you’re not playing searing blow and you won’t have the defences to mitigate all the incoming damage you need to avoid, in order to be able to keep upgrading instead of resting.
reply
csmeyer 4 hours ago
I would love to see a version of this engine steered towards “meme builds” like Searing Blow or Perfected Strike, although they are in general rather considered quite suboptimal since there’s a lack of late game scaling and substantial opportunity cost through the run
reply
nonethewiser 3 hours ago
Another interesting things is how low it rates the boss energy relics. Looks like it got by on corruption, offering etc a lot of the time.
reply
sigbottle 3 hours ago
Dude.

Sort of unrelated, but I've made comments about how Slay the Spire 1 decks could take on the nightmare that is Dread Act 3 in STS2, and I've been lambasted for this.

I'm sure it's not that hard to do a deeper statistical analysis, but I've been saying, you just see a lot of really good cards in 1 and win. 2 is much more about value piling, which was sufficient until A10. Dread forces you to have good decks, but you often don't get offered the broken synergies as much.

I play exhaust ironclad in dread maybe once in 4 wins at this point, it just does not show up as much. Which can be seen as a good or bad thing - deck diversity etc.

Which is not to say one game is easier than the other (though I think Dread > A20H right now, not for good reasons). However, the peak and frequency of OPness of STS1 decks is not to be understated.

reply
GrollingGrakbor 4 hours ago
Notably a lot of top players rate Searing Blow as one of the worst cards in the game as well :P (probably not the worst, idk). But the card is really bad even if you know the strategy.
reply
b450 3 hours ago
True. I wonder how top players would rate it as a floor 1 pick - the engine regards Searing Blow as the worst possible pick even on floor 1! Seems implausible to me, but then again I can't win 90% of the time :)
reply
_jackdk_ 2 hours ago
You sometimes see meme runs where a streamer gets offered it early and can route through an unusually high number of campfires to get it good, but if those conditions aren't met it's hard to justify.
reply
PacificSpecific 3 hours ago
That's like the one card in the game I've never been able to make work
reply
nonethewiser 3 hours ago
Except Searing Blow is not bad when you know the strategy.

Instead I think players just don’t like all of a sudden committing to a different play style. Also consider that it doesn’t really make sense to take past the first few floors so it’s usually just not an option.

reply
entropicdrifter 3 hours ago
I don't think it's a question of taste so much as the opportunity cost in a game with this much RNG. If you commit too early to a strategy and don't have the opportunity to pivot, it'd better be very strong and consistent. Searing Blow isn't all that strong until the endgame.
reply
GrollingGrakbor 3 hours ago
Uhm, okay? You won't find a single top player that agrees with you, but you're entitled to your opinion I guess. It is literally a meme card. There's a reason for that.
reply
eterm 4 hours ago
I am extremely surprised Armaments rates so low, it seems like it doesn't value card upgrades much at all which is surprising.

It rates "War Paint" really low too for example.

reply
CuriouslyC 3 hours ago
Armaments is bad pre upgrade and good post upgrade (depending on deck size and existing upgrades). If you can pick one up before the first fire and upgrade it for your first elite fight it's bonkers, but halfway through act 2 I wouldn't bother.
reply
bjackman 37 minutes ago
Holding the other aspects of its playstyle constant, its rating of Armaments and War Paint is almost certainly close to exactly correct. Otherwise gradient descent would have updated it.

You can say "well then it should change the other aspects of its playstyle" but... have you got an A20H winstreak of 19?

Basically any difference between your perception of the game and this model's should be modelled as "I can learn something from this model", not "this model is doing something wrong".

reply
keybrd-intrrpt 3 hours ago
But then you are using upgrades on Searing Blow and not others?

Perhaps the model sees the cost is not worth the benefit?

reply
b450 3 hours ago
Could be, that's what I am speculating about! It's a highly situational card which requires you to make a series of suboptimal decisions before you start getting a payoff. But the payoff can be pretty dramatic. If you're playing for win rate, you might categorically prefer "win now" cards. I guess I'm interested in the possibility that the engine has blindspots because, for example, every time it dipped its toes into Searing Blow it stunk, because it never went whole hog.
reply
dwattttt 2 hours ago
> unlikely to find it by working up a gradient

As a mathematical aside, this is why optimisation algorithms (of real/complicated systems) often incorporate randomness, in order to avoid being stuck in local minima.

reply
CuriouslyC 3 hours ago
I've cleared A20 on all chars, and Searing Blow is a trap. It's a fun meme strat that makes for some nice YT thumbnails for creators, but if your goal is to win consistently you'll do much better by not trying to force it.
reply
airstrike 3 hours ago
Yeah, agreed. I only pick Searing Blow when I've played so many runs recently that I'm going for a little bit of an added challenge and trying to see if the stars align.

But if I'm testing myself and trying to beat the Heart on A20 once again, I'm nearly guaranteed to skip it.

reply
airstrike 3 hours ago
I'm not sure Searing Blow is the _literal worst_ card but it's a hard pass for me 99% of the time
reply
0cf8612b2e1e 4 hours ago

  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.

reply
GrollingGrakbor 4 hours ago
Spire doesn't use stratified randomness. What the website means is that the vanilla game doesn't come with a crypto RNG, so correlated randomness exists ("if X happens during a fight, the next event can't be Y").

People normally don't know about it, and the ones that read about it use a mod to patch it out, because the point of the game is obviously not to learn the pseudo RNG by heart. But of course a neural network would start to exploit this very quickly because it can't tell the difference between what's a "real" game mechanic and what isn't.

reply
_jackdk_ 2 hours ago
https://tck.mn/blog/correlated-randomness-sts2/ was a thorough dig into the since-fixed correlated RNG in Spire II.

HN Discussion of the above: https://news.ycombinator.com/item?id=48552844

reply
nonethewiser 3 hours ago
Yes, this is what it means. Sts1 used RNGs for different things but they started from the same seed.

As far as I know it was discovered after the full release. They may not have wanted to break old seeds.

And its pretty trivial to benefit from once you learn some of the rules. For example if your first combat is not a Cultist, your first mystery room is always an event.

reply
vintermann 2 hours ago
As I recall the top players even played with a mod fixing at least some randomness issues in Spire 1.
reply
xiaoyu2006 4 hours ago
I think as long as the distribution is the same, this is no different than normal sts without save-load.
reply
shoo 3 hours ago
here's two ways it could be different:

1. the game UI displays the seed of the run. so, combined with full white box knowledge of the game's code, you should be able to reconstruct the current rng state of the game & deterministically predict what the various rng-based outcomes will be, without save loading. this goes completely against the intended experience of the game.

2. with full white box knowledge of the game's code, even if you didn't know what seed you were playing, perhaps it is possible - after enough observations during a run - to infer the game's rng state, say for draw order? no idea if this is actually plausible but I believe similar attacks to infer rng state have been done successfully in the past - e.g. against early online poker implementations that seeded their rngs in a weak & predictable way.

edit: there are also issues with correlated rng, where a weakness in how individual rngs are seeded & how the rng state depends upon the seed means that different rngs used for different game functions that the devs intended to be independent are actually heavily correlated with each other. here's a great writeup of the issue for sts2 (in early access) that was fixed by the devs a few months ago: https://tck.mn/blog/correlated-randomness-sts2/

reply
hyperpape 17 minutes ago
2 is theoretically possible. Practically speaking, I believe it means simulating the behavior of all 2^64 seeds and testing them against what's actually happened, so it's not practical, but it's an obstacle to mathematical definitions of perfect play.

This is unlike correlated randomness, which as you've noted is a real problem that many players have used mods to correct.

reply
wincy 4 hours ago
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
reply
nonethewiser 3 hours ago
Sts1 was written in Java
reply
adamrezich 3 hours ago
With a very convoluted porting process to get it to run on the Switch—as someone here explained to me before—which explains why it gets so laggy when it has to render too many cards on the screen, which should just be cached textures on quads…
reply
tuvix 4 hours ago
Balatro also had the Lua completely available to inspect and i’m sure it’s why the modding community is so rich
reply
daredoes 4 hours ago
so I'm not the only one playing on mobile for STS2....
reply
corky_buchek 2 hours ago
Assets as well?
reply
yfontana 4 hours ago
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?

reply
Gormo 3 hours ago
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.
reply
bondarchuk 3 hours ago
It's an engine in the same sense as a chess engine, so yeah, a bot.
reply
ludamad 2 hours ago
Wait approaching top-level? Aren't top players like Jorbs at like 60% WR
reply
aoeusnth1 2 hours ago
The top streaks are 20+ (Baalorlord, Navegreed) and that implies a much higher than 60% wr to achieve in non-galactic timescales.
reply
bjackman 32 minutes ago
I think 60% winrate and 20+ streak are still compatible because these folks often play quite differently on a 10+ streak than otherwise.

If you tune into a random Baalorlord stream you're likely to see him go "oh cool this is a synergy I haven't explored so I'm gonna take that card" (It's extreme at the moment while StS2 is in beta but it happened on StS1 too) whereas people streaking are doing their utmost to minimise chances of a loss.

reply
mmddyyyy1 24 minutes ago
[dead]
reply
bradleybuda 4 hours ago
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?

reply
evmar 4 hours ago
I've seen the advice in mobas that bad players focus too much on trying to improve their micro when actually better macro would make up for bad micro, especially at lower ranks. Which is to say, maybe this also figured out that between optimizing for micro or macro it chose macro?
reply
CuriouslyC 3 hours ago
This is a bigger deal for spire IMO. Perfect micro with mediocre macro will lose 100% of the time on higher ascendancies, but as you can see strong macro with mediocre micro does quite well.

The irony is that this makes quite clear that the "game" in StS is primarly the macro and the micro is a bit of an illusionary hamster wheel that could be elimiated without ruining the game. The game Guilderun proves this hypothesis to some degree.

reply
vintermann 2 hours ago
I suppose all autobattlers "prove" this, but it really depends a lot on the rest of the game. You still need to play to avoid truly disastrous micro in Slay the Spire (for instance havoc'ing into a blasphemy to take a somewhat artificial example).
reply
nonethewiser 2 hours ago
I play(ed) quite a bit. I have no idea what my win rate was. Certainly not near top play but probably your normal dedicated player.

Seeing this makes me think I could pretty drastically change my macro strategy.

reply
NAHWheatCracker 3 hours ago
Well, this is Slay the Spire. I guess "macro" is choosing cards and handle events. "Micro" must mean playing cards in combat. Either way its making discrete decisions with no time pressure.

It's very different from an RTS, where time can either be spent on micro or macro.

I watched for a bit and I saw the bot pass the turn twice with energy and an attack to play. I can't prove it, but there must be draw orders where the player takes unnecessary damage in the fight I watched.

I guess the bot isn't trained enough or the training methodology causes it to get stuck on something. I don't think this is a good example of a neural net learning a useful lesson, it's just a quirk.

reply
plorkyeran 57 minutes ago
The spots where I’ve seen it pass without playing an attack with no reason not to play it have always been cases where it deterministically wins without taking any more damage. It makes weird plays no human would make a lot, but objectively incorrect plays are quite rare.
reply
justin_dash 7 minutes ago
Run 90, 10:00. Has 45 block and ends turn with a 0 cost body slam in hand. Even though this elite fight goes on for three more turns, and it manages to take zero damage. So maybe it knew somehow?

https://www.youtube.com/watch?v=V1uVBcM0eJY&list=PLBt3ZH12eK...

reply
nonethewiser 2 hours ago
Probably just easier to change macro strategy. A lot shallower decision space.
reply
JTbane 3 hours ago
>the engine really does not want to lose HP

This is funny because if you roll a Regal Pillow or Miniature Tent early on you can play a LOT more aggressively and skip block cards, as you recover more HP through the run.

reply
JBits 34 minutes ago
I watched a few videos too, and I don't agree that its micro is bad.

I saw it play strike before bash on the first floor, losing 1 HP, and the author described it misplaying the heart fight. However, its micro in the rest of the run seemed really good, and I saw it do some clever stuff with fire breathing.

reply
nonethewiser 3 hours ago
>Looking at the card / relic / event / Neow bonus choices, the engine really does not want to lose HP

The top picked neow bonuses include losing hp and max hp though. Im not sure why you are saying this.

I take your word on macro vs micro. That is very interesting and surprising. Im surprised it can make it very far like this.

edit: I watched a small amount of play and the micro did not seem poor or mediocre. Small sample size admittedly. But I wonder if it's poor micro play is being overstated.

reply
lavasalesman 4 hours ago
I feel like this is a pretty significant issue with the approach, surely the bad micro is influencing the strategies it can use?
reply
nonethewiser 2 hours ago
This seems likely but I’m shocked it won 90% of games
reply
onlyrealcuzzo 4 hours ago
It's just willing to play the game without an ounce of fun.

You could probably do equally well if you optimized for boringness.

You'd probably question your sanity then.

reply
Xirdus 2 hours ago
"Given the opportunity, players will optimize the fun out of a game." - Soren Johnson, Civ 4 lead designer, 2011
reply
onlyrealcuzzo 39 minutes ago
I agree, if you change "players" with "people who play games to win and not have fun".

This is true in a competitive sense.

It is not true in a general sense.

Most people play games to optimize for fun...

reply
savanaly 4 hours ago
So is it making up for bad micro by avoiding glaring errors that humans make like missing lethal or forgetting you have a potion? Or superior deck building?
reply
Corence 4 hours ago
Article suggests it is deckbuilding. It specifically calls out awful potion management as another type of micro failure.
reply
sleepybrett 4 hours ago
some of these strategies might be directly related to the ironclad class. It has many cards with mechanics that hurt the player to produce effects, perhaps it doesn't want to sacrifice health in other places so it has a comfortable cushion for card play?
reply
Routine8502 4 hours ago
My takeaway is that if its dogshit micro is fixed, it could get a 100% win rate (barring provably unwinnable seeds).
reply
GrollingGrakbor 3 hours ago
This is a bit like saying "if you were good at chess tactics, your games would be perfect". I mean I know what you mean, but there isn't really such a thing as "a micro" or "a macro". They lie on a spectrum and you can't really separate them.

For example, a top player can run into 5 elites (hard enemies) in a row on Ironclad, who is the character that heals after every fight. If I do that, I die horribly, so I don't. But that's because I make small mistakes in fights that lead to HP loss (micro) and pick cards suboptimally (deckbuilding). So I decide to not run into 5 elites (macro), which is actually good macro, but strictly worse than what a top player can do. So as you get better at micro and deckbuilding, you have to change your macro drastically. And the other way around too of course, all three influence the other two.

reply
Routine8502 4 hours ago
Extremely cool! Is there any way we can run this ourselves?
reply
emmareinhardt 45 minutes ago
A Slay the Spire engine approaching top-level play is a strong sign the approach works - nice work.
reply
dayone1 4 hours ago
would love to see STS2 analysis for this!
reply
cygn 2 hours ago
I built a similar bot "Spire Mentor" for STS2, which has over 83% winrate on A10: https://github.com/tfriedel/spire-mentor

Also works in co-op, i.e. you can add it as a team-mate. There's also a mod available on steam workshop, but mods are currently in a review queue so you'll have to wait a few days to find it there unfortunately.

reply
mdaniel 3 hours ago
I would guess there's a whole other search dimension since the engine would presumably need to incorporate game theory when playing alongside itself in multiplayer. I was thinking back to the Huggingface write-up where they observed self-sacrificing behaviors
reply
cygn 2 hours ago
My mod Spire-Mentor has support for co-op, but it's basically just the single player bot in multiplayer with some hard-coded extra rules, like wait for an ally that may still play something like vulnerable first. Training it specifically for co-op would obviously be even better, but that's a future project.
reply
hatthew 3 hours ago
AI has already demonstrated the ability to make team plays in games, so I don't think it would be too much of a challenge. Made even easier because it can still be initially trained on singleplayer before multiplayer finetuning.
reply
aketchum 3 hours ago
just do it in single player? multi player in sts2 is niche and not the main game mode
reply
mpalmer 3 hours ago
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.
reply
plorkyeran 56 minutes ago
“Chess engine“ is a pretty standard term.
reply