How does artificial intelligence work in games? [closed]

Artificial intelligence is present in many games, both current and older games. How can such intelligence understand what to do? I mean, how can it behave like a human in a game, allowing you to play against itself, or that AI plays against itself?

In games like Age of Empires, for example.

closed as too broad by wythagoras, user58, NietzscheanAI, Dom, Robert Cartaino♦Aug 15 '16 at 14:22

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• In games like Age of Empires for example. I updated the question too. – Florida Aug 6 '16 at 5:05

There are many different kinds of AI used in games; AI for historical board games (like chess or Go) tends to be much better than AI for computer games (such as Starcraft or Civilization), in large part because there's more academic interest in developing strategies for those games.

The basic structure of a game-playing AI is that it takes in game state inputs and outputs an action; typically, the internals also contain some sort of goal and some sort of future prediction.

But beyond that, there's tremendous amounts of variability. Some AI are little more than scripted reflexes, some are built like control systems, some do actual optimization and forward thinking.

Getting into the details of how the many different approaches work is probably beyond the scope of this site, though.

Most of the existing AI bots which can play games use deep search from possible space and choose the best move. This is done by most of the chess, Go, Tic-Tac-Toe, etc bots.

However, there has been a recent breakthrough where (deep)neural nets with deep search techniques like monte-carlo search, etc; which might be more human-like and demonstrate a much more complex game behaviour than the above bots. One such example is the Google's Alpha-Go bot.

• Don't a lot (the kind we might find in an interactive game, for instance), also use heuristics? – winwaed Aug 4 '16 at 15:39
• It really depends on what sort of game we're talking about. This answer seems to be aimed mainly on board games. It would be quite different in racing games or real-time strategies, for instance. – Disenchanted Lurker Aug 4 '16 at 15:46
• @winwaed Yeah, I assumed it under the term Deep Search. But, I'm not really sure it makes it look a lot human-like :) – Dawny33 Aug 4 '16 at 15:48