Game Creation with XNA/AI/Introduction

From Wikibooks, open books for an open world
< Game Creation with XNA
Jump to: navigation, search

Games always provided an environment for developing artificial intelligence. So in the last decades it became one of the most important components of games. Nowadays games that have sophisticated AI are state of the art. Some simpler and some more sophisticated algorithms you will need in many games. It is used in many situations, some are:

  • control of NPCs
  • pathfinding
  • dynamic game difficulty balancing
  • combats / fights

History[edit]

Already in the very beginning of game development, in the 1970s, programmers and developers came face to face with the field of game artificial intelligence. But at this time AI was simple and so to say humble and that status didn’t change until few years ago.

"AI has been quietly transformed from the redheaded stepchild of gaming to the shining star of the industry" - Steve Rabin, AI Game Programming WISDOM, 2002, p. 3

The first games featuring a single player mode and therefore AI in its very beginning like the Atari game “Qwak!” didn’t have AI like we would describe it today. Enemy movement was mostly predefined and stored as patterns. Only with the improvement of the hardware like the incorporation of microprocessors, that allowed way more computation, further random elements could be implemented. Games resulting from that were for example Space Invaders, Galaxian, and Pac-Man. Those games presented e.g. an increasing difficulty level, complex and varied enemy movements, events depending on the players input and even different personalities for each enemy. Along with the loom of new game genres in the 1990s new AI tools were developed and used. Among these tools were for example finite state machines. In the newer games AI became the main aspect of game. The improvement of AI didn’t only depend on the given hardware components. Well, in fact it definitely was a very important aspect. There were some problems that couldn’t be solved without significant processor resources. But it should be added that in the beginning of game development programmers simply didn’t take AI overly serious. Mostly AI was done in the very end after completing all the high-priority tasks.[1]

Today AI climbed up the games ladder to be the highest-priority task.

Difficulties[edit]

AI has to be calculated live (during the game), therefore (good) performance is very important to let the game run smoothly. To ensure that there are many simplifications, workarounds, cheats in the algorithms which approximate the ideal behaviour of the player. So they are fast and intelligent at the same time. When performance is an important issue, it is clear that stuff like bruteforcing all possible decisions is not the best way to deal with such situations in game AI.

Another essential fact is that the computer player should not play perfect even if he could. Cheating is a big word in that topic, because the computer knows all facts and has all kinds of information about the game world so it would be possible to let the AI player know things they realistically could not know. The player has to think he plays against a real enemy and not a computer, that is why firstly the AI has to be beatable (not invincible) and furthermore it has to act human-like (do mistakes, act randomly in some situations, etc.). If the AI does not behave in this way the game would be soon very boring for the player or just frustrating if he has no chance to win. Some games use approximation algorithms instead of perfect solutions and implement "wrong" (or worse) decisions in their algorithms.

half-dozen rules of thumb and heuristics, just enough to give a good gameplay experience

References[edit]

  1. Steve Rabin (2002). AI Game Programming Wisdom. Cengage Learning. 

Authors[edit]

  • iSteffi
  • LWAGNER