HOME

Machine Learning for Star Realms

Loading your local game…

Stats on your games against machine learning model opponents.

About this page

I love the deckbuilding game Star Realms. To learn more about strategy, I used machine learning techniques to train computer models that play better than I can. If you're not familiar with Star Realms, learn to play it first before reading this page, or else this info won't make much sense.

On this page you can try playing against some of the computer models I trained and see statistics about their strategy.

Playing against the computer models

The models above do not cheat, but they do constantly make use of all available information according to the digital game rules, including the cards in both discard piles, the cards in their deck (but not their order), and the (combined unordered) cards in your deck+hand. Hopefully you'll find it interesting or learn better strategies and ideas for your own games too! Note that the variance of Star Realms is very high, so a handful of games won't reveal your true playing strength. For example, hypothetically, if you're good enough to win exactly 60% of games against a specific ML model opponent, then you'll need to play at least 92 games to be confident (95% confident) that you're actually better. Fortunately, it's possible to finish a game quickly in just a few minutes (though you'll want to think longer to play your best).

Training details

I trained the models using a 2-million-parameter neural net architecture inspired by the original AlphaGo paper and later AlphaZero research. I built the training infrastructure with Codex, except for the game simulation logic, which I mostly wrote by hand. They are entirely trained on self-play, with zero human training or influence except for the ability to check for obvious game-winning moves within a single turn. The best model I trained, Level 5 (1283 ELO) is trained on 26 million self-play games and it beats me (1180 ELO) in around 64% of games (70% of the time when it goes first and 58% of the time when it goes second). For comparison, the "Hard AI" included in the official Star Realms digital game is 1000 ELO on this relative scale.

← Home

Your stats

Completed games saved in this browser. Draws and unfinished games do not count as wins or losses. Charts run from earliest to latest decided game; error bars show 95% Wilson confidence intervals.

Results by opponent level
OpponentWinsLossesDrawsWin rateCumulative win %

Learning strategy from the computer

I analyzed game data from my best-performing model (Lv.5 in the opponent list above), to attempt to understand the strategies it had learned. Below are a series of interactive charts that answer questions like:

The charts show data from 10,000 self-play games, along with 95% confidence intervals for each datapoint. Negative action values mean that the model prefers taking no action (eg. not acquiring any card). Just because the charts imply a specific strategy, doesn't mean it's necessarily "correct", because my Level 5 model isn't perfect (for example, I don't think always scrapping explorers on turn 5 is correct). But if Level 5 is better than you, you might learn something helpful from the data below:

Some examples of the insights:

These are generalizations based on watching the model play thousands of games, and don't reflect the intricacies of its decisions in any particular situation.

Loading strategy charts…

Settings

Choose a card to scrap

Select a card to scrap. Each option is shown once per available target.

Decision required

Choose an option

Choose an option to continue your turn.

Resign this game?

This ends the current game and gives the win to your opponent.

Local models

Downloads, imports, and names stay in this browser. Imported models are never uploaded.

Add an opponent

.actor.npz, converted .astro.gz, or .model.php export

Opponent names