Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
I doubt that most games use adaptive AI... –  jco Jul 22 '12 at 17:42

3 Answers 3

up vote 16 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.