How is Game AI developed? Does AI start acting optimally and then they make it fun? With Dota 2 showing off an AI that can beat the best players 1v1, I wondered why I should be impressed? I thought designing AI that always plays perfectly was relatively easy and the hard part was designing mistakes to make it useful (or fun). How wrong am I?
There’s a pretty big difference between the AI you’re used to and the AI that they demonstrated at The International 7. Here’s the thing - if the rules of the game are simple enough such that there is an optimal strategy, then yes - you can start with that optimal strategy and always win or tie. If such a thing exists, the game is considered “solved”. These games are generally deterministic - you don’t even need to play in order to tell who will win. Tic-tac-toe is the textbook example of such a game - if played properly, the second player can never win.
However, most competitive games aren’t solvable - there isn’t always one perfect way to win, because the game has play and counterplay. For example, consider the game Rock-Paper-Scissors. Is it possible to come up with a winning strategy for this game? In general, the answer is “not really” - it entirely depends on what the opponent does. If you have a good read on your opponent you can defeat her, but there is no perfect solution. An AI can be trained to play rock-paper-scissors but it can’t always play perfectly because there is no such thing as true perfect play in Rock Paper Scissors.
Another means of gumming up the work is simply to have too many confounding factors for the AI to account for everything, especially in real time. For example, on Wall Street, several firms have set up banks of computers that trade stocks at super high speeds. Super high-end machines running complicated algorithms place buy orders here, sell orders there, often microseconds apart, trying to take advantage of their inhuman reaction times to snap up favorable transactions. However, even these machines aren’t perfect. If they were, they would obsolete every other form of stock trading on the market. However, they are not infallible - they are susceptible to errors in the algorithm, incomplete or incorrect information, taking too long to crunch the numbers and make a decision, and more. The cost of these computers and the internet connections that connect them run in the millions of dollars all to shave milliseconds off of the calculation response time, and even then they are not money-printing machines. They often get it right, but they will also often get it wrong, losing millions of dollars for their owners.
The AI at TI7 was playing a very simplified version of Dota - 1v1, mid lane only, and both players were restricted to Shadow Fiend. With such a setup, there were few enough factors that the AI could process them all and come up with a winning strategy. And even then, it wasn’t a perfect strategy that was made by a human, but it was a set of strategies the AI itself built from playing millions of games against itself and finding points for improvement. Even though it managed to defeat Dendi, there were many human players who managed to outsmart the AI by doing things it had never encountered before, such as dropping items on the floor. Now consider expanding that challenge to a team of 5 heroes selected from a potential pool of 105, each with different builds and item loadouts. The complexity grows by many orders of magnitude. Then consider the actual details of the game itself - items, build, team role, scouting, creeping, and so on - and the complexity grows by many more orders of magnitude. Coming up with the correct strategy here is very difficult - the AI would need to play millions of games against good players in order to construct a viable set of strategies and counter-stratgies that would make it even remotely competitive.
Is there an optimal strategy for Dota 2? Possibly, with enough computing power and data, machines could figure it out. More likely, there will be a metagame that evolves from the available choices - a variety of viable (counter) strategies with reasonably close win percentages. But as it stands, there is no perfect script that we can just tell an AI to follow that will guarantee victory, because there’s so many different strategies and counter-strategies at play that there’s no way for humans to account for all of them.
Got a burning question you want answered?
Short questions: Ask a Game Dev on Twitter
Long questions: Ask a Game Dev on Tumblr
Frequent questions: The FAQ














