A way to deal with enormous branching factors in strategy games
togelius.blogspot.com
togelius.blogspot.com
I've written an AI for a similar game, where you can't always even iterate over all your moves for this turn, let alone do a multi-ply tree search.
Using their terminology of Action and Turn, my method was to first evaluate individual Actions using a simpler evaluation function, and apply a cutoff so that only a reasonably number of Actions had to evaluated, then combine that reduced group of Actions together to make a reasonable subset of full Turn moves, then use the full evaluation function to find the best Turn.
Writing a good evaluation function for a complex game is hard, so I picked a whole bunch of inputs and then used a genetic algorithm to find weights for them. (Let the various AIs play entire games, and let the winners breed.)
Works okay, but still can't beat a decent human player very often. (There's enough randomness in the game that the better player doesn't always win.)
In this paper, their Online Evolution beat the other four computer strategies, but they don't mention whether it can beat good human players. If it can't, it's not clear to me whether Online Evolution is a good algorithm. Beating their other four algorithms doesn't seem to be a very high bar.
In Hearthstone, you have a specific amount of options you can play (anywhere between 0 and 10-ish), and each option may have one or more targets (usually again between 0-10 ish). This sounds high, but you're able to discard a lot of those options much more easily than you would in Go/Chess (eg. damaging yourself is seldom a good idea).
There's often multiple options you can play per turn, but each option has to be evaluated under the current state of the board since playing a single option can radically alter the game state. So a much fairer approach is to look at a branching factor of about 15, with multiple successive "turns" (eg. each option is a single "turn", and you can play multiple turns before ceding control to the opponent).
If both of you have 3 minions on the board, each of your minions has a choice of 4 targets, which is already up to 4^3=64 choices. Then considering each order of attacks, and the fact that you can play any card of your hand before or after attacks, and the branching factor has the potential to explode.
As for the order of actions, I did mention that. The basis of my argument is that you shouldn't consider an entire player's turn as a "turn"; instead, consider each action as a turn.
And if you want to get truly smart, you also have to consider what the opponent might do, which, as viewed by the player, opens up the search space to a lot more cards both in their hand and in their deck.
So yes, each turn the branching options to play is relatively small compared to the other examples. However, the evaluation of future moves and the "true" board state is much, much harder and has a huge branching factor.
> We use an evolutionary algorithm to evolve sequences of actions that could make up a single turn. The fitness function is the quality of the board state of the end of the turn, as measured by some straightforward metrics.
My interpretation of this (and your suggestion) is that they take the number of possible actions in one turn, and prune them according to how they affect the board state. That seems to be what you're describing.
Evaluating those pruned action sets across multiple turns seems like the next logical state.
Like with the birthday paradox, one would intuitively think it might take hundreds of people in a room before two had the same birthday, but of course we know that is indeed not the case.
Birthday paradox: different people are coming into the room with different randomly-distributed birthdays; how many people do you expect need to come in before two people in the room will have the same birthday?
Ordinary random search: there are several people in the room with birthdays that are unknown to you. How many birthdays do you expect you'll have to guess before you name a birthday that is actually the birthday of someone present?
But it's possible that I'm just bad at video gaes.
* This is not to say that these authors copied AlphaGo -- my uninformed guess is that this general approach of constraining MCTS has been known for a very long time.
You're right that the problem structure is key. There's a key theorem called the No Free Lunch Theorem for Search which says that will always be the case. But on search problems with many related local maxima, evolution will often outperform a series of stochastic gradient ascents, because the information in one hill can be applied to another.
Of course, search and knowledge are always two sides of the same coin. The less knowledge you encode, the more search you'll have to do. But GAs allow you to encode knowledge too, in their operators, particularly.
There's been quite a bit of work done on the kinds of fitness landscapes that evolutionary algorithms are better suited for.
[NB: Used 'ascent' terminology to avoid confusion - it's a convention only, of course, energy minimization or fitness maximization]
Pretty standard A.I. from what I could tell. But my memory might not be that great, it was awhile ago that I played it.
Is the new one significantly different from that? What stuck out for you as being particularly clever?
At the same time, you've laid out how the game works quite plainly, and I've read enough about Pac-Man to know that video games can seem more clever than they seem!
IIRC, in Fire Emblem every character gets some small amount of actions per turn, whereas in Hero Academy you have a pool of action points that you can spend among all your characters.
I mean there's some complexity beyond that simple description in FE (which hero moves first, their positioning and abilities can affect effectiveness of subsequent moves), but fundamentally the tree you must traverse is a lot wider and deeper with Hero Academy.
But the real hard problem is evaluation of moves. Even for simple games encoding of positional and temporal advantage is hard. This is really important for things such as build and research orders. Once weights are known, you may use any number of asymptotically optimal scheduling algorithms.
I feel like it might apply well to a strategy game but for something like chess, would not fair as well. Mixing two great move sequences in chess would probably result in disaster
How does it fair against good human players? Would it do much worse with randomness added back?
I didn't realize the go solution "just" used monte carlo branching. Still impressive, but does not seem as revolutionary as it's been portrayed.