PDA

View Full Version : First Person Shooters AI, possibly a rant



Whammydill
2010-06-30, 10:00 AM
I'm no programmer, but really, how hard would it be to program an AI for FPS that isn't merely downgraded omnicience? Is it hard to manage or something or just not something any of them strive for?

It seems most, if not all FPS have a good degree of "If there is open line of effect, you are getting hit" going on. Some are worse than others about it. I forget what game it was, I want to say the original Ghost Recon, but a friend and me were playing and I was observing enemies while he was moving around and once they were aware of him they were just rotating in place following his movement even though they had no line of sight or reason to know where he was.

Maybe I'm rambling but anyone else feel like the same omnicient AI gets recycled in most FPS?

What are some good FPS that don't have this problem?

Maxymiuk
2010-06-30, 10:06 AM
If anything, I find enemies that can see perfectly through "soft" cover, such as vegetation even more annoying.

I like S.T.A.L.K.E.R. Shadow of Chernobyl for its enemy AI. Sure, it has its hiccups, such as the flanking conga line, but it's one of the very few games I've played where the enemies act based on where they last saw you, instead of where you are right now.

Whammydill
2010-06-30, 10:09 AM
Yes, thank you for adding that. AI's ignoring concealment/soft cover..etc.

Dogmantra
2010-06-30, 10:17 AM
The trouble with AIs in shooters is that to win shooters, along with aiming, obviously, you need adaptability and spontaneity. Giving AI something like that is really hard, because even if it takes a hundred hours of play, they will eventually still become predictable. Instead, most devs opt for the easier option of giving the higher difficulty AI super-amazing aiming skills or clairvoyance.

GolemsVoice
2010-06-30, 10:18 AM
Seconding S.T.A.L.K.E.R., and, just to add some letters, F.E.A.R. actually has a decent AI that flanks you tries to get you out of cover with grenades, and doesn't have mysterious omniscience.

Also, the AI of most human enemies from any of the Crytek games is pretty good, I've heard.

Domochevsky
2010-06-30, 10:27 AM
Eh... no. One word: Farcry. Tall grass everywhere, but everyone still immediately knows where you are, filling your awesome shirt with holes.

In the same vein there's also the fact that in most games every enemy immediately knows that you are there and even where you are as soon as a single enemy has seen you, as if they were telepathically connected. :smallannoyed:

Lord Loss
2010-06-30, 10:49 AM
A game series I find good for this is the PS2 Socom series. I have the third and first, and the enemies are challenging, but they act like real humans.

Resistance: Fall of Man has this problem.

RationalGoblin
2010-06-30, 12:25 PM
This is why I like the Thief games. The AI (especially in later games) is specifically designed to look where they saw or heard something, and check that place, but patrol around a little bit more before going back to "normal mode".

Thief counts as a shooter; technically. What with all the arrows you get over the course of the game.

SolkaTruesilver
2010-06-30, 12:35 PM
Republic Commando's friendly AI was surprisingly competent. So was the ennemy's (less so, but still competent).

Bayar
2010-06-30, 01:11 PM
This is why I like the Thief games. The AI (especially in later games) is specifically designed to look where they saw or heard something, and check that place, but patrol around a little bit more before going back to "normal mode".

Thief counts as a shooter; technically. What with all the arrows you get over the course of the game.

If you count Thief a shooter, then Morrowind or Oblivion are shooters too...

Just because a game has weapons that you could shoot doesn't mean that it is a shooter. Thief is more of a stealth game.

chiasaur11
2010-06-30, 01:24 PM
Ever seen Half Life 2's AI when it's being competent?

Not a sight to be missed. The stories I could tell...

Well, I've already told them to whoever would listen. Just try Minerva Metastasis. The combine can be VERY smart.

factotum
2010-06-30, 03:13 PM
Actually, writing proper AI is *hard*. There's a reason that scientists have been working on it for years and still not managed it! The sort of AI you get in a game is really just a fairly simple expert system, and as such, the programmer will probably only bother including parts where the player can hide if the game itself has a stealth element, which most don't.

chiasaur11
2010-06-30, 03:40 PM
Actually, writing proper AI is *hard*. There's a reason that scientists have been working on it for years and still not managed it! The sort of AI you get in a game is really just a fairly simple expert system, and as such, the programmer will probably only bother including parts where the player can hide if the game itself has a stealth element, which most don't.

Again I cite HL2.

You can hide. And the enemy will form teams to hunt you down and flush you out.

SlyGuyMcFly
2010-06-30, 04:06 PM
Again I cite HL2.

You can hide. And the enemy will form teams to hunt you down and flush you out.

HL2 has a pretty awesome AI, yeah. STALKER, as others have mentioned is pretty darned good. But writing a good AI is really, really hard. About as hard on programmers as realtime rendering of water (or making skin that actually looks like skin) is to the graphics crowd, from what I gather.

chiasaur11
2010-06-30, 04:20 PM
HL2 has a pretty awesome AI, yeah. STALKER, as others have mentioned is pretty darned good. But writing a good AI is really, really hard. About as hard on programmers as realtime rendering of water (or making skin that actually looks like skin) is to the graphics crowd, from what I gather.

No, I get that. Just felt the need to praise Valve.

Oslecamo
2010-06-30, 05:04 PM
GoldenEye AI.

SoldierA: Hey, isn't that the sound of a machine gun in our base?
Soldier B: Let's see what it is!
SoldierA:Should we advance one by one?
SoldierB:Nah, let's gather some more friends and advance togheter!
...
Bond: Holy s*** from where are coming all those soldiers? Ack, stoping using your own as meatshields! Wait, it's that a grena-MISSION ABORTED

Really, gotta love a FPS where the mooks don't just stand at their corners waiting for you to arrive at their sections.

Erloas
2010-06-30, 10:18 PM
Realistic AIs in FPSs is really quite difficult. Its not really that hard to get them to work together, or take cover, but it is really hard to program their ability to see or not see through cover. Especially with things like foliage where there isn't an easily defined see/not see area associated with it. Its hard to make a realistic method of having enemies have an idea of where you are without knowing exactly where you are. Its really hard to program perception, the chance of an enemy to see or not see you when you are only partial visible or at long ranges.

The other challenge is making a game fun at the same time. You could probably get a decent algorithm put together by watching players extensively, but in most cases against other players no one tends to get more then 1-3 kills per death. A game where AIs are as alert as real players, work together like players, and have the visible distance and scan all directions, would lead to lots and lots of player deaths, and really probably wouldn't be very fun.

Of course people do play a lot of games against other players, but I don't think it would work very well for a story. And what you can do with PvP scenarios wouldn't make a very good total game.

Murska
2010-07-02, 04:48 AM
Yeah, I realize it's pretty hard. That's why I usually expect the AI to be poor and then am sometimes happily surprised to notice them doing something intelligent.

Things like suddenly jumping out from behind a corner right in front of a soldier in the middle of a base where nobody has been alerted yet during that entire mission and seeing him react with superhuman speed, lifting the gun he, for some reason, was still carrying in his hands and shooting at you once before you stab him, thus alerting the entire base, is sad but expectable.

Triaxx
2010-07-02, 06:11 AM
GRAW on the PC has AI that scans all directions, and yes, it leads to lots of player deaths.

Murska
2010-07-02, 07:11 AM
There's a running gag in my gaming group about the AI of the original Ghost Recon... Mainly, a single incident.


There is this swamp map, at night, with fog everywhere. The enemies have no nightvision or anything like that, and they're totally unalerted while me and my friend sneak forwards. Now, the nightvision equipment has this funny thing: It removes the fog so you can see farther even during the day, but you see even farther if you look with the edge of your field of vision rather than straight on.

Now, my friend, with this tactic, manages to spot the silhouette of an enemy soldier at maximum range. He takes out his gun and starts to aim when the enemy somehow spots him from the middle of the fog without nightvision in the middle of the night halfway submerged in the swamp in the middle of a ton of foliage. Then this enemy starts running towards him, AK-47 in hand, and shoots a burst from the hip, headshotting my friend instantly.

From this moment onwards, we've never been really afraid of enemy snipers, but if we hear of enemy militia combatants with AK-47s, it's time to carpetbomb the area from orbit.

Triaxx
2010-07-02, 09:07 AM
They're scarily accurate with them. I do hate when needing nightvision only makes it harder on you than the enemies.

Erloas
2010-07-02, 09:17 AM
They must have had their AI programmed to the "if the player can see them, then they can see the player, if the player aims at them and they are facing that direction have them act"

Night vision is also hard to program for, since the computer doesn't see with light either, and of course any arbitrary distance limitation for AIs to act makes it way too easy to just snipe entire areas without much risk. With night, there is a potential to see a long ways still, its just harder, and trying to get "harder" right is, well, hard.


My brother was playing Batman the other day and we were talking about difficulty settings. I was saying they need 4 settings, easy, regular, hard, and "looks up."

Triaxx
2010-07-02, 12:38 PM
Right, which is why I like to have them on an equal footing, more or less. In GRAW, when you had to use night-vision, the enemies had lights instead. But if I'm in the shadows perpendicular to, or behind the lights, they should not be able to spin around and pick me off before I've started firing. After is acceptable even if I have a silencer on.

But if we don't have night vision and can only see 10', then they shouldn't be able to pick me up from 20' with any consistency. Such as when I'm not moving. But if I've got goggles and can see them from 40', they shouldn't be able to unless my character is standing in the light or moving. Particularly if they don't have goggles.

I'm not asking for blind enemies in the dark, but being able to defeat them if I don't make stupid mistakes isn't too much to ask.

Vorpalbob
2010-07-03, 08:10 PM
I had this game a long time ago, possibly one of the Tom Clancy games, in which the AI was simply, "Was that a gunshot? I better run directly towards it and stand on the exact spot where it came from! That will help!"

They did have limitations, basically they could hear different weapons from different distances, and some 'guard' enemies would never leave their post, but the easiest way to kill every one was to set off some C4 (the loudest weapon), get to a high area, and drop a grenade once everyone had gathered. Usually about 10% of the enemies remained.

The AI in the original Mercenaries is actually quite decent. Soldiers will run for cover, man emplaced weapons, fill empty spaces in friendly vehicles, and guard officers. The one thing that pisses me off is their target priority. I drove a tank up to the gates of a North Korean base, got out, and an Allied soldier jumped in. I planted some C4 at the base of the gate, took cover behind the tank, and blew the doors wide open. The tank rolled in, blasting away, and I held back.

The soldiers inside the base, who were armed with RPGs, moved AROUND the TANK to get a shot at ME! WTF? While I am probably more dangerous than a tank, would random NK soldiers know that? Really?

Gralamin
2010-07-03, 09:15 PM
So, In a Computers and Games course I took last year, we had a presentation from a Grad student. He had spent his time developing an AI for Counterstrike, that would accurately guess where someone is based on every occurrence of seeing them, and the amount of time since seeing them. He had trained it on many replays, and had it quite accurate.

However, this had taken him years to do. This isn't even accounting for firefights, the correct battle responses, etc. Even with a larger team, it'd be very difficult to get something like this working well. This is because the Mathematical model behind it is non-trivial, and many require "Training" it with data. These features make it very difficult to make an AI, and very time consuming, both of which are not very financially viable.

aje8
2010-07-03, 10:03 PM
Yeah, basically it's super difficult to make Shooter AI. It's not hard to make an AI that shoots perfectly at someone's head all the time at any distance. What's hard is to make an AI that shoots reasonably accurately, but doesn't hit all the time, considers cover, distance away, weapon ect. It's actually extremely complicated to make a good FPS AI and often simply not worth the time and money.

warty goblin
2010-07-03, 10:44 PM
Yeah, basically it's super difficult to make Shooter AI. It's not hard to make an AI that shoots perfectly at someone's head all the time at any distance. What's hard is to make an AI that shoots reasonably accurately, but doesn't hit all the time, considers cover, distance away, weapon ect. It's actually extremely complicated to make a good FPS AI and often simply not worth the time and money.

I'm not much of a programmer, but making an AI that doesn't shoot with perfect accuracy does not strike me as a particularly hard problem. Once you have the code that tells the AI where it wants to shoot, just add some vertical/horizontal inaccuracy* to get its actual aimpoint, then hand that off to the code that handles ballistics.

*This would also make it fairly easy to scale difficulty. Take both vertical and horizontal inaccuracies from some approximately Gaussian distribution with mean the actual vertical/horizontal aimpoint, and standard deviation scaled by difficulty. For a very easy AI, have the deviation be large, for a better shot, make it smaller.

Similarly knowing at what range to use what weapon seems a pretty easy problem. Just give the AI a table of effective ranges, and an event that causes it to reference that table whenever distance to current target has changed by some number of units since it last checked. If the check finds that the target has moved to distance where some other weapon in the AI's inventory with ammunition is more effective, equip that weapon unless that weapon was already equipped in the last few seconds.

Tragically however you are right, such considerations are apparently not really worth the money. I mean Call of Duty still sells buckets and has AI somewhere between atrocious and non-existent.

Demented
2010-07-04, 12:21 AM
I'm not much of a programmer, but making an AI that doesn't shoot with perfect accuracy does not strike me as a particularly hard problem. Once you have the code that tells the AI where it wants to shoot, just add some vertical/horizontal inaccuracy* to get its actual aimpoint, then hand that off to the code that handles ballistics.
The catch isn't making the AI inaccurate, it's making the AI's inaccuracy responsive to the same conditions as for a human.

An AI that has the same accuracy all game is likely going to get too many hits in situations where its accuracy should have been poor, and too few hits in situations where its accuracy should have been excellent.

Gralamin
2010-07-04, 12:29 AM
The catch isn't making the AI inaccurate, it's making the AI's inaccuracy responsive to the same conditions as for a human.

An AI that has the same accuracy all game is likely going to get too many hits in situations where its accuracy should have been poor, and too few hits in situations where its accuracy should have been excellent.

Exactly. It is easy to "Cheat" and make the AI follow something like Warty Goblin described (Goldeneye actually did. You could scale the enemy accuracy up something like 1500%), but it is hard to make it respond in a realistic way.

742
2010-07-04, 01:07 AM
GoldenEye AI.

SoldierA: Hey, isn't that the sound of a machine gun in our base?
Soldier B: Let's see what it is!
SoldierA:Should we advance one by one?
SoldierB:Nah, let's gather some more friends and advance togheter!
...
Bond: Holy s*** from where are coming all those soldiers? Ack, stoping using your own as meatshields! Wait, it's that a grena-MISSION ABORTED

Really, gotta love a FPS where the mooks don't just stand at their corners waiting for you to arrive at their sections.

but considering the IP it was based on this is crappy AI, except for the "using your own as meat shields" part.

Triaxx
2010-07-04, 06:00 AM
I have no problem with AI's that are very accurate. I expect exceptional marksmanship from my enemies. But not from maximum draw distance with a full-auto machine gun.

It's even worse when you find yourself hoping they have sniper rifles because they're LESS accurate.

Domochevsky
2010-07-04, 03:04 PM
On the topic of AI... kinda peripheral, but what's up with your allies in oh so many FPS'? They take roughly 2 minutes to kill something that you can push over within 2 seconds with the same weapon, but when you (accidentally) shoot them they utterly destroy you before you notice what's up? (Assuming there's friendly fire.)

Basically what im wondering is... why the different standards? Why do they play by different rules? (Not even talking about infinite magazine depth. Though that's part of the issue as well.) To make you as the player look more important? They're making you do everything already so they can just put 'kill all dudes' on that list as well?

Another issue is pathfinding. AI in pretty much any game is notorious for only taking straight routes. (Say, instead of jumping over something they run all the way around, since that's how their path is calculated. Glued to the floor.) Leaping over a gap is already a achievement for them.

So... yeah. AI is weak and cheating.

Draconi Redfir
2010-07-04, 03:09 PM
the l4d survivor AI is preity good. they dont pick up grenades, and they tend to heal you when you really dont need it (this sucks on expet levels were the helth kits you find in the beginning are usually the only ones you get) but other then that i really cant find anything to complain about.

warty goblin
2010-07-04, 03:20 PM
On the topic of AI... kinda peripheral, but what's up with your allies in oh so many FPS'? They take roughly 2 minutes to kill something that you can push over within 2 seconds with the same weapon, but when you (accidentally) shoot them they utterly destroy you before you notice what's up? (Assuming there's friendly fire.)

Basically what im wondering is... why the different standards? Why do they play by different rules? (Not even talking about infinite magazine depth. Though that's part of the issue as well.) To make you as the player look more important?


Pretty much, yes. Once you wander a bit farther afield from the mainstream CoDalikes (or shooters that generally insist the player is the greatest thing since sliced bread), this stops happening so often. I find bots designed for multiplayer FPSs to be far more interesting opponents, since they generally play to win. The AI for Enemy Territory: Quake Wars for instance is really pretty fierce, and is perfectly capable of winning matches all by itself. Section 8 is also noteworthy for good bot AI. ArmA and sequels/ expansions has generally good AI prone to occasional bouts of insanity.

SparkMandriller
2010-07-04, 03:34 PM
the l4d survivor AI is preity good. they dont pick up grenades, and they tend to heal you when you really dont need it (this sucks on expet levels were the helth kits you find in the beginning are usually the only ones you get) but other then that i really cant find anything to complain about.

It's not that good. You haven't seen it get confused as hell running back and forth when multiple people are down? Pretty awful at SI defence, too. Can't dodge chargers through anything but luck, and I don't think it even tries for deadstops. No way for it to anticipate when attacks are coming, either, so it's all too happy to run into high danger areas and get itself charged out windows/off stairs/wherever without thinking. Though, well, I guess that would be pretty hard to code. The way it ignores teammates and tries to shoot right through them would be pretty awful too, if the devs hadn't just cheated and turned off friendly damage.

And the problems you mentioned, too, of course. Overall, not so good. Still a whole lot better than the SI AI though!

Draconi Redfir
2010-07-04, 03:42 PM
well im not sure about l4d1 AI as i havent played it in awhile, but i'm preity sure l4d2 AI has been programed not to shoot if there is a teammate in the way. ive never seen an AI have any freindly fire damage on a campain.

SparkMandriller
2010-07-04, 03:46 PM
Yeah, they're coded not to do any damage. If they could, oh man, that wouldn't be pretty. They just don't care at all if there's a survivor between them and what they want to shoot.

chiasaur11
2010-07-04, 03:56 PM
Man, the friendlies in Republic Commando are aces, aren't they?

So useful. Not as good at stabbing stuff as the player, though.

Skorj
2010-07-06, 09:41 AM
Aimbots are just no fun, really. The whole "if it can see you you're taking damage" thing, for me, is the primary difference between a good and bad game.

I was just replaying FEAR. In FEAR and FEAR XP, the opponents seem pretty realistic (as mooks), but for whatever reason the Perseus expansion reverted to "if it can see you you're taking damage", and the difference was immediatly noticable and made the game much less fun. It was also pretty funny: to balance the aimbots, there's a health pack every 3 steps throughout the whole game.

Half-Life 1 had remarkably good AI for its day - and I really liked the fact that some of the opponents were just stupid. If you atacked a bullsquid it would jump up and spin around, but if it didn't see a threat it would go back to what it was doing. Diablo II did this as well - some of the enemies just use bad tactics in a very believable way.

BTW, the thing about FarCry is that some bushes don't block enemy LOS, and some do. They can see you from across the map at night, unless you're in the right kind of bush in which case they will actually bump into you and start pushing you without seeing you. This sounds goofy, but I found it a lot of fun in practice: you're rewarded for sneaking from bush to bush, planning routes into bases, and so on. It's just annoying that you aren't told this up front, as the game is kinda lame without cover, IMO.