OK, here''s my theory on the Artificial Intelligence in
Half-Life. I only have SOME of them, and they could be incorrect.
In case you''ve ever read "Tricks of the Windows Game Programming Gurus", you probably would have come across the chapter about AI.
I remember something about an "attraction" AI, that draws entities to you.
When the guards are just standing there, they actually have a simple "GUARD AREA" AI. That means that when a monster gets close enough, they notice it, and start the "ATTACK" AI. When the player comes close and tells them to follow, they either have the "Sorry, sir, I''m on duty" AI, or the "Let''s Kick some Butt AI", which makes the player like a magnet. So until one of these 3 things happen, they will follow the player:
1. Guard gets killed
2. You tell them to quit following you
3. You are seperated by something (like the doorway collapses as soon as the player gets through)
As for the "COVER ME" AI, I think that it simply consists of one bad guy coming to kill you, and it sends a message to another bad guy, who throws a grenade or something in your direction.
At least, I think that''s how it works.
Yes, it does look like a state machine. There are a few more states you forgot to mention:
They will stop following if -they can''t see you any more -they reach the edge of their invisible boundary
If there is another NPC near, they will randomly say something, and a random response is generated from the other character. I love this.
Most of the bad guys are very simple state machines (basically, if you are close enough, they hit). The enemy troops are more interesting. They follow you, at least a little. They seek cover, so they know their environment. They have different weapons, and will use the appropriate one. They will also not go straight at you - sometimes they go around objects and attack you from the rear. These guys are interesting.
Grandpa Simpson - "I never thought I could shoot down a German plane, but last year I proved myself wrong!"