Artificial Intelligence in Computer Games

Aug 10, 02:02 AM |

One of the most challenging tasks in the game development is creating good artificial intelligence. Here are some basic principles.

AI takes place whenever you want to simulate a living creature, no matter whether it plays the role of player’s enemy, friend, or (rarely) is indifferent to them. Very often it is easy to cope with, just aplying a straightforward, dumb-minded algorithm which uses an unconditional rule.
For example, if you want to simulate zombie (which is not quite living, so not quite AI), your task is simple. You let them go the nearest possible way to the player. That’s all the zombie AI.
Remember the immortal Golden Axe arcade game? The enemies have very simple AI too, not more complex than zombie AI, I suspect.
But what if you want to hide some facts from the creature? Say, they don’t know where the player is until they see him. Now real aspects of AI come into play.

Golden Axe Zombie-AI

I was solving the real AI problem several times. What I realized as main principles, is listed in the points bellow. You first need to imagine yourself as the artificial mind you want to simulate, and ask yourself these questions.

1.What is my goal?
2.What are my possibilities and my limitations?
3.What do I know and what can I perceive?

The strategy
The 2nd question is asked when thinking about the creature’s “motorics” and powers. The first two points are enough to create real AI. They compose the question of strategy. The most shining example is board game like chess. But even in the fighting game you may need some strategically based AI. In Spear and Katana, I made the enemies move not only forward, but somewhat randomly to make their movement less predictable.

The world image
The 3rd question is very important for adding more life to the artificial mind. It’s only natural that the creature hasn’t a direct access to all the variables of the program inside which it lives. (Provided you don’t want to simulate gods.) So you create the creature’s image of the surrounding world, an incomplete one and not necessary the true one. For example, you may want to add the rule that they see the player only when close to him. Or even only when they are looking in his direction and nothing is in the way of their eyesight. If they are smart, they can deduce where the player could go after losing him from the sight, but they still may be wrong or tricked by the player, which makes them feel very living.
In Spear and Katana, I limited the enemy reflexes, which is the instance of both points 2 and 3. Most of the time, the thug doesn’t really know where the player is! They only localize him once or twice per second, the rest of the time (there are 18 frames per second) they only deduce where he is from his last known location and his movement direction. It allows the player using some tricks resembling real fighting feints.
In Spear and Katana 2, I took vision limitation into account and added two more modes into the enemy behavior: The guarding mode (when they yet don’t suspect the player’s presence), and the searching mode (when they have seen the player or were alarmed and are looking for him).

There is much more to say about the artificial way of creating strategy. I will possibly do it in the near future, using the example of board game with full information (like chess), where the above mentioned AI point 3 is absent. It’s because the full information makes the hardest and purest strategy.





Web design (c) ThunderBird Animations, 7/2011. Powered by Textpattern.