The Three (Or More, Or Less) Laws Of Gaming AI

It's pure fantasy. Robots won't ever actually rise up and go to war with humanity. You know why? Because the robots of the future will be governed by Asimov's three laws of robotics.

For those who don't know what those are, know that sci-fi writer Isaac Asimov established three basic laws governing the programming of robots for his works, which later became almost canonical amongst other sci-fi writers, and which remain popular to this day.

Those three laws are:

1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
2. A robot must obey orders given to it by human beings, except where such orders would conflict with the First Law.
3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.

Simple. It's a paper/rock/scissors sequence of programming that allows a robot to look after itself without ever inflicting harm upon a human — which will be good to know in the dark, distant future when there are robots advanced enough to require such programming!

For now, though, the closest things we have in the real world to the classic idea of a "robot" are automatic vacuum cleaners, giant arms that work on factory floors and bipedal toys wheeled out at Japanese robotics shows.

But what about video game characters? They're governed by AI. And, in many cases, incredibly complex AI, to the point where non-playable characters can behave more naturally than the robots in Asimov's works. So this being robot week and all, we decided to ask a few game developers what their versions of Asimov's three laws were when coming up with gaming AI.

Jonny Ebbert, Relic, lead designer on Dawn of War 2:

1) Fun before difficulty. Always try to level the challenge appropriately at each level so that players feel good about playing. So make your Easy A.I easy, and your Normal A.I. kind of easy. Leave the sadism for Hard and Expert.

2) Add frailty but avoid stupidity. A.I.s need to make mistakes for the player to exploit from time to time but they shouldn't look dumb doing it. A.I's aren't fun to play if they always trigger their abilities perfectly when they have the chance (anyone old school enough to remember trying to Death and Decay a peon line against a Human AI), and they shouldn't always retreat at the perfect health level. But they need to stay in the range of competency when they do make "mistakes." It's a fine line to walk, but an important line.

3) Be a good teammate. Try to support your teammate's army when possible. Help out your opponent's base when it's under serious attack. Players love it when they see an A.I. that cares about how they're doing. They feel like they're cooperating rather than playing next to something.

4) Cheat wherever you can. A.I.s are handicapped. They need to cheat from time to time if they're going to close the gap.

5) Never get caught cheating. Nothing ruins the illusion of a good A.I. like seeing how they're cheating.

Matt Tonks, Epic, gameplay programmer on Gears of War 2:

Simplest answer:

1. Act smart until the player kills you.

Or, to be a bit more specific:

1. An AI must value its own life; take cover against threatening enemies, and avoid life-threatening situations.

2. An AI should attack the most threatening enemy, unless we are threatened… in which case, see rule #1.

The friendly AI has a couple rules added to the top:

1. A friendly AI should never get in the player's way. If you're in the player's way, get out of the way.

2. A friendly AI should stay near its assigned squad leader (usually the player).

And then the other rules:

3. An AI must value its own life; take cover against threatening enemies, and avoid life-threatening situations.

4. An AI should attack the most threatening enemy, unless we are threatened… in which case, see rule #3.

Todd Howard, Bethesda, executive producer on Fallout 3:

"I'll give you one from the old Terminator games, since the new movie is coming out. The Terminator cannot be reasoned with, can't be bargained with, and cannot be stopped. Unless of course he hits a chair, and since he can't path around it, we have him just start shooting."