Video Game Design/Programming/Framework/AI
Artificial Intelligence (AI)
Artificial intelligence is what make your game world come alive and gives your in-game creatures a mind of their own. AI also allows the difficulty of the game to change either by having a user select their own difficulty level or by having the game adapt automatically to the players skill level. There are many ways to implement AI in a game.
Finite state machines
Very simple type of AI were used in Doom. Finite State Machines consist of a list of possible states (or "emotions"). Let's say there is a game that has guards that patrol a room looking for intruders.
Let's also suppose these guards have five states:
- Patrolling - The guard is walking along on his assigned route
- Waiting, or idle - The guard is standing somewhere, possibly talking with another nearby guard, smoking, etc.
- Suspicious - The guard has heard a noise and thinks something is nearby (ex: a guard heard a player kick a rock off a ledge)
- Alert - The guard has visibly seen you and is attacking, or possibly shouting out for help
- Injured/In trouble - You have hurt the guard, but he is alive, and is running for help
These states would have particular actions consistent with the "emotion" of the guard. Patrol would activate the waypoint system, Alert would mean you activate the targeting system for the AI.