16
\$\begingroup\$

I'm no gamedev, I'm just a curious coder of not-games. I wonder, how does AI work in popular modern games, say, FPSs? Is it based on hard-coded rules? How much does it have in common with other kinds of AI (like the one which powers autonomous cars etc)? How do developers ensure the AI behaves naturally and is fun to play against?

Stuff I've googled mentioned different derivatives of MinMax but failed to answer how AI deals with continuous, changeable world, for what actions/states AI is rewarded and how it figures out its chance for success of different actions. I've also seen Machine Learning mentioned here and there but it seems it's not used in any serious game?

\$\endgroup\$
1
  • \$\begingroup\$ I doubt that most games use adaptive AI... \$\endgroup\$
    – jcora
    Jul 22, 2012 at 17:42

3 Answers 3

16
\$\begingroup\$

There are many methods. I will answer for FPSes because each genre has its own set of problems, and AI approaches are heavily dependent on the problem domain and how best to represent it.

Common FPS approaches include:

And various permutations and variations on the above.

Minimax is not generally used for games with continuous state like FPSs, more for turn-based games in discrete game spaces like Chess etc. It can be used for planning at a high level, but generally it is not because there are better systems (ie. the above) when faced with multiple enemies, incomplete information, but simple plans.

They ensure the AI is fun by playtesting. If it's too challenging, they may introduce error into any decision heuristics, or a delay on their reactions, or apply a random factor to their aiming, etc. If it's not challenging enough, they will just need to improve the data supplied to the algorithm.

\$\endgroup\$
5
\$\begingroup\$

There are papers out there on how various AIs work, the one I'm most familiar with is F.E.A.R

\$\endgroup\$
2
\$\begingroup\$

Two more common methods

UCT search. There is a formalism, but the idea is basically to do a random playout until the game ends, with feedback to weight the winning games more heavily than losing ones. The nice thing about the pure form of this is that the AI needs no knowledge about what might be a better or worse move.

Minmax search, usually combined with alpha-beta tree pruning, basically does a complete search of the game space to some depth, evaluating every terminal node with a static evaluator which assigns a numerical value. This works well for games where there are obvious metrics that measure progress toward a win.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .