IA Logo


IA Information
Communication

Dave Mark's books

Post-Play'em - Observations on Game AI


Posts Tagged ‘using cover’

Splinter Cell: Conviction — Last Known Position

Thursday, July 21st, 2011

I’ve been playing quite a bit more of Splinter Cell: Conviction. Thankfully, I’ve been finding the game a lot easier than I did early on. Part of it has to do with getting used to the flow of things in a more stealth-based game.

I had noted in my “First Look” post that the enemies do a decent job focusing on the “last known position” mechanic that the game is proud of. To explain, when you are sighted and then go back into cover, the game draws a black and white line art model of your position when you were last seen. This is meant to be a marker of where the enemy thinks you are. The encouraged play is to separate yourself from that point so that you can either hide elsewhere or flank and surprise them. This is a helpful reminder and is only made possible by the fact that the AI has a mental model of your position other than the old fashioned “omniscient” method that games used to use.

Again, they do a good job of searching for you—whether at your actual location or your believed one. They will use cover, approach cautiously, and when the discover you aren’t really there, start to search in what looks like a meaningful way. This is where the problem occurs, however.

The enemies will begin to search the entire area even when they should know
that you are not in those places.

In some instances, when they find that you aren’t where they thought you were, there could be many directions or places to which you could have escaped. At other times, however, there are very few options—or even only one option—that you could have selected. However, the enemies will begin to search the entire area even when they should know that you are not in those places.

One example I saw that was glaring was when I had engaged enemies from a door to their room. I never actually entered the room but rather was firing from the doorway. Eventually, outgunned as I was, it was in my best interests to retreat into the room that I had come from. As I moved away, the line art silhouette marked me as still being crouched next to the door. I watched as they came up to the door to attack where they thought I was. Upon discovering me, however, they exclaimed something or other about losing me… and began searching their own room! They had been watching the doorway the whole time and should have known that I had never crossed to their side of it. The logical conclusion should have been that I was on my side of the door. The result was that I was able to slowly re-assault their position because they were no longer wary of me in the direction of my approach. Good for my survival; bad for my suspension of disbelief.

Good for my survival; bad for my
suspension of disbelief.

The solution to this problem is to leverage “occupancy maps”. The concept has been around for a while but very much came to the game dev forefront when Damián Isla gave an excellent presentation on it at the GDC AI Summit in 2009. The idea is based on the concept of influence maps where the grid space values represent the probability that a target is there. Obviously, if you can see a location, then the target is not there. You then simply spread the probabilities over the areas that he could have gone. By selecting the highest grid value at any one time, you are, by definition, going to the most likely place that the target could be. The result is a spectacular mimicry of how people (and animals for that matter) search for something that disappeared from site.

This method is slightly more memory and processor intensive than simply having a shared (x,y,z) location for the last known position of the player. I honestly don’t know if they had resources to burn in the game. However, I have to wonder if they even thought of trying the approach. I wish they had, though. An otherwise well-done stealth based game would have been that much better for their efforts.

Splinter Cell: Conviction – First Look

Sunday, July 10th, 2011

I’ve been putzing with Splinter Cell: Conviction on and off in recent weeks. As a side note, my use of it has mostly been “off” because I find it frustratingly difficult, even on “normal”. That being said, I’m impressed with the game as a whole.

Too often in games can we do stuff that is completely ridiculous and people don’t even react at all.

One of the first thing I noticed was how “by-standers” react to me. If I’m crawling around on a wall or doing something else “odd”, they will turn and look or making some snarky comment. I like that in a game. Too often in games can we do stuff that is completely ridiculous and people don’t even react at all. In order to facilitate this, I assume that actions and/or locations were simply flagged as “odd” and broadcast to the people in the area.

Similarly, I like how the “Thief-like” environmental triggers can arouse the attention of the bad guys. The voice acting in this case really sells it. They are often very subtle about it, saying things like, “hey… I’m gonna go check something over there.” It could have been done in a more heavy-handed way (e.g. “I heard something over there.”)… but the way they did it almost projects how the AI is actually questioning itself. The minor difference makes you (the player) think more “I need to be more careful” rather than jumping straight to “Oh shit!”

Anyway, that isn’t what I was wanting to write about…

No Rails Here!

Obviously, being the type of game that it is, there are more than a few opportunities to lie in way for people. Early on, there was a point where I was waiting for a guy who was unaware of me. I found myself falling back on old gaming mentalities and trying to detect his “patrol route”. That has long been a staple of games—to the point where it has been ingrained in me.

I kinda just had to mentally will him in my direction.

Needless to say, the baddie didn’t follow a pattern of any sort. I kinda just had to wait him out and mentally will him in my direction. Plenty of that time was spent watching him not move at all. I actually wondered for a while if he was a static set-piece rather than an ambulatory one. He wasn’t… he was just alternating between hanging out and wandering around. It really did a good job of selling the idea that this guard was that reasonable mixture of responsible and bored to tears.

On the other side of the coin, when the guys are actually searching for me, the game does a good job of making them look reasonable in their search for me, but also looking somewhat unpredictable. They don’t do the standard “run right toward where the player should be” gameplan once they lose track of me. That would be too silly. Once they have “lost me”, however, they don’t just go searching around willy-nilly; they keep to a reasonable area. That makes for a lot of tense moments when you are holed up in a corner!

While they are searching, the agents do a good job of looking around with that slightly spooked feeling. They will swing their flashlights around—sometimes in radical changes of direction like they are either surprised by a noise or trying to catch me by surprise. I actually found myself just watching the AI search for me to see what all they would do. (Well… the fact that I was on the outside of a windowsill with nowhere to go was a factor.)

Down in Front!

The combat AI seems solid. Their reactions are decent and they usually take cover fairly well. I don’t believe they use cover quite as well as what I have been seeing in Gears of War 2 (which I am finally almost done with). Sometimes they seem to be on the wrong side of it. Not on my side, mind you… just on perhaps the 90° side of things rather than opposite me.

A guy ran up and hid along the side of the couch that I was crouching behind.

On the other hand, the enemies don’t seem to do as much pointless running around as they did in Gears. They might want to consider more than simply cover points, though. There was one moment where a guy ran up and hid along the side of the couch that I was crouching behind. I was so startled that he would run up to get within point-blank range of me that I was very taken aback.

They don’t seem to use their environment in as dynamic a way as F.E.A.R. did, but it doesn’t set them back. In fact, if they were flipping couches and knocking over bookshelves, it might have looked a little contrived.

You Really Get Around!

The pathfinding is decent (thanks, I’m sure, to the excellent navmesh work of my buddy Martin Walsh). I believe there was one moment early on where I saw someone backtrack 2 steps before doing a turn the other way as if he was on a grid. That may have been something else, however. I just remember noticing it because I knew ahead of time that the game was on a navmesh.

While the local avoidance on the streets seems OK, I think that the “personal space” buffer could have been increased slightly. People coming the other direction weren’t steering to go around me soon enough. That’s minor, though.

When I make Sam stop and reverse direction quickly while running, the animation reminds me a lot of the same action in Assassin’s Creed. I have to wonder if that is a coincidence or not.

All in all, I’m quite pleased with it so far. I do need to pay a bit more attention to the AI in the combat situations. On the other hand, the fact that I’m so distracted with staying alive means that the enemies are certainly doing their job well!

Gears of War 2: Cover vs. Running Around

Sunday, June 12th, 2011

The recent E3 (2011) reminded me that it was time to catch up on some games. Additionally, it reminded me that I really want to comment on the AI of the games that I play—something that I haven’t been doing as much of lately… at least not on here. So, after having not touched it for a while (2 years!), I picked up my copy of Gears of War 2. (Thanks again to Epic AI Programmer, Matt Tonks, for providing me with a copy of the game.)

Peek-a-boo

The AI in Gears 2 actually uses cover in a reasonably intelligent manner.

It took me a while to get back into the groove of the control system—most notably how to use their cover system. At the time, using cover that way was a fairly fresh idea. It has been utilized in plenty more games since then, of course. Even better was how the AI was using cover. Unlike other games that I have played where the AI either subscribes to the “Doom model” of standing out in the open, or half-heartedly takes cover, the AI in Gears 2 actually uses cover in a reasonably intelligent manner.

For example, compared to how the AI in Mass Effect used cover as two ends of a shooting gallery path, the AI in Gears 2 seems to take advantageous cover and keep it. This really adds some nice depth to the game in that, often, the only way to solve the resulting stalemate is to flank them so that their cover is less useful.

I can’t just sit there and play Whack-a-Mole.

Their “pop-outs” to fire on me are quite unpredictable which is frustrating (in a good way). Additionally, if the cover is long enough for them to move behind it, they seem to do so. Again, this is one of those things that, unless I was running a video recording, it would really be hard to discern in the middle of a firefight. What I do know, is that I can’t just sit there and play Whack-a-Mole with someone who is in cover—waiting with my cursor positioned perfectly so that when they pop up, I can pop them. That has always been a tactic that my slow thumbs relished because it was so simple to defeat. If the enemies are moving and popping up at unpredictable intervals, I either can’t anticipate where or when they will do so, or I simply get anxious and move on to another target that is visible.

As a follow -up to that last point, it is often hard to switch from one target to another in time because their exposure is so limited. They truly do only “pop out” rather than “come out and remain a really obvious, easy-to-hit target.” All of this serves to create a very frenetic atmosphere in the combat… even the “trench warfare” combat that could normally get pretty stale.

Round-and-Round

Unfortunately, there is some issue I take with the combat AI. Sometimes, both friend and foe seem to get into a mode where they are dashing around in odd ways. This seems related both to target selection (and by this I mean not just who to shoot but where to go) and idle situation positioning. In the former, it seems similar to what I experienced with Dragon Age: Origins. In that case, enemies would run past one of my allies—completely ignoring them—in order to get to me.

It simply doesn’t make tactical sense to leave your group like that.

In this situation, it isn’t necessarily limited to the enemy having an unhealthy preoccupation with me. My allies will run off into combat way out in front of what are obviously established lines. This surprises me quite a bit when I’m looking way downrange from our location (even sniping) and suddenly see one of my allies appear in my scope. It’s not as if I am holding back—often there is combat happening directly in front of us. In a game where one of the mechanics is being “revived” by one of your allies, it is disturbing when one of them runs so far afield. Even without that mechanic, the nature of this game is one of squad tactics. It simply doesn’t make tactical sense to leave your group and go deep into a group of enemies like that.

The issue (both friend and foe) could be solved by a better decision selection algorithm that takes into account proximity better. This could be achieved in two ways — first by scoring individual choices better (e.g. including better opportunity cost for cover points), or on the whole by including influence mapping. Certainly, influence mapping would then be rolled up into the decision-making process, but you could manage better mathematical decisions without necessarily inducing the overhead of an influence map.

There is no concept of “personal space“.

When the characters are supposed to be idle, I’ve had a number of situations occur where my allies were simply not paying attention to me or other allies. They will bump into me in an open area obviously trying to get to a spot on which I’m already standing or at least near to it. There is no concept of “personal space” even to the point of them trying to be in my space.

Sure, much of this could be solved by the inclusion of simple steering and separation algos, but I have to wonder if the decision of where to go isn’t being locked in too early and therefore overriding the sensibility of how to get there. What was a legitimate destination when you started there became a poor choice by the time you were half-way. Therefore, you either look like an idiot going there in the first place or, once you get there, you immediately change your mind and go someplace else. This would certainly lead to some of the “running around” behaviors as well. The solution partially lays in updating your target location often. Sometimes, changing your target location is really not that big of a deal anyway. If your goal is simply a random walk, your destination is unknown to the observer and largely irrelevant anyway.

Working Together

One thing that I haven’t seen (yet?) is a good sense that the enemy is working together. I mentioned this in my First Look post on the game over 2 years ago. Having played plenty of Halo 3 and Halo: Reach, I’m used to seeing the “organized fall-back” behavior that was built into their enemy AI. Not seeing it here in Gears 2 is actually kind of startling by its absence. Certainly building in that kind of behavior goes beyond the AI brain of the characters. It needs to be designed into the levels, etc. That may not have even been an option for the Gears team much less a consideration. I just wanted to point out that I “felt” it not being there.

Anyway, I’m not done with Gears of War 2, so if anything else comes up, you will see it here.

Gears of War 2: First Look

Sunday, March 8th, 2009

In preparation for the AI Summit that I am helping put on at the 2009 Game Developers Conference, I am rapidly cranking through some of the key games of the year. So, I signed up for GameFly just so I could putz with some games in the short term. I will likely buy some of these games down the road, but the research budget for IA doesn’t cover spending $300 on games in only a few weeks!

Well, the first thing in my queue (along with Fable 2… check back later for that) was Gears of War 2. I had seen a number of the reviews in various places and I was impressed by not only what I saw but by what people were saying about it. Despite having Gears 1 sitting here, I had never really played it. (My son had.) So really, I had no idea what I was getting into.

Ok, wow.

Obviously, it is a very good looking game… but that’s not what this column is about. After watching Yahtzee’s take on the game, I was also fully prepared for plenty of “chest high walls”. Of course, there’s good reason for that given that the cover fire system is an integral part of the game. On the other hand, I have not seen the poor AI quirks that Yahtzee cracks on the same review. (Although I suppose referring to the generally satirical and sarcastic Zero Punctuation blurbs as “reviews” is a bit of a stretch now, isn’t it?)

So far the AI seems pretty solid. Now note that I have only played the opening level up to just past the epic speech (<- unintentional pun for those of you who actually pay attention to the names of the game studios who crank out your entertainment products) so I haven't experienced too much of it. However, what I have seen has been pretty decent for a shooter. The enemies are frustratingly adept at using cover. I have often found myself flanking them just so I can get a shot around whatever “chest high wall”-like object they are behind. What’s more, I have noticed that they will shoot from around different sides of the object. If the baddie is behind a desk, he may pop over it or around the side. This is a nice touch of realism that steps away from the typical method of 1-1 relationships of designer-tagged points. That is, there is no “and at this point, the AI can shoot over the object.” There seems to be simply “here’s a hiding spot… let him do what he needs to do.”

My allies seem to be pretty proficient at using the cover as well. Of course, I haven’t been paying too much attention to what they are doing since I have been concentrating more on saving my own ass. (Nota bene, I’m playing on the hard difficulty level.) However, as we move from battle to battle, I do notice that they are very conscientious of taking cover as we go… even when they are simply waiting for me to catch up.

All of this cover-taking is very refreshing in a shooter. I have (for 15 years?) been so tired of enemies (and allies) that simply stand out in the open and either wait to get shot or are so invincible that cover is unnecessary. (Yahtzee suggests this is possible in GoW2, but maybe he was on a different difficulty level than I am.)

For the most part, the animation seems clean. The transitions are pretty decent and any quirks seem to be more a result of the control system than the animation. That’s a hard problem to solve, so I don’t bitch about it too much. A better example is watching the animation of the AI characters rather than of myself. Everything seems smooth as they move, duck, fire, etc. I will pay more attention to that as I go.

I have yet to play enough to see how much of the enemy combat events are scripted and how many are dynamic. For example, early on the Locusts in the hospital are retreating… but that is obviously scripted as I have played through it three times (twice by myself and once in co-op with my son). I understand that. However, as I play on, I would like to see if there are places where the enemy retreats simply because I’m kicking his ass. I saw a lot of this in Halo 3, for example, which was controlled by Damian Isla and Max Dyckhoff’s battle management system. Given the impressive use of cover in Gears, the inclusion of a good fall back or retreat system would be cool. We’ll see.

That about covers it for the moment. More later. If you are jumping into this article, remember to check the Gears tag below to see if I have written anything else about this game.

First Encounter with F.E.A.R.

Monday, January 21st, 2008

Ok… this isn’t necessarily going to be a full-fledged review of all of the AI in F.E.A.R. (Monolith studios) Actually, to do that justice may take an entire book anyway. However, I have been playing it for a few days. One of the reasons that I had to get a hold of it anyway (I bought the Platinum Collection) is that I also got my hands on the SDK. It is a special treat to be able to see the actual code that went into making this ground-breaking gem of a game.

Anyway, I had a taste of the game a few months back via the downloadable demo from Gamespot. Even with that brief glimpse I was impressed. Now that I have been able to “dork with it” (research term) a little more, I have found myself saying a few things that surprise me.

“Son of a bitch! Where did he come from?”

This usually occurs when I fall into old patterns of thinking that the enemies are going to generally either stay put or move toward me in something resembling a direct assault. The first time this happened was on one of the more open, but box-laden arenas (which I am realizing was a design decision to show off this exact effect). I was slowly closing on a group of enemies… or at least where I thought they were (more on that later) when I get pegged from behind.

Now this isn’t a “Doom 3″ sort of assault (see my post on the subject) where the game either spawns a monster directly behind me or pops open a completely illogical hidden panel in order to literally kick me in the ass. As I thought about where this dude could have come from, I realized that it was one of the enemies that had been in front of me… but off to one side. He actually had circled around some obstacles and come up behind me. Sure, he probably didn’t realize that I had moved until he reached the spot where he had last seen me – but then rather than stand there, he continued on the only logical way I could have gone until he did discover me – and proceeded to politely pop a proverbial cap in my ass. Score one for the bad guys.

“Get your butt back here, wimp!”

Again, unlike shooters that I have played in the past, I encountered something that was actually almost frustrating in the novelty of it. It was realistic… which actually took some getting used to. When I would engage an enemy, they were just as likely to fall back as they were to move forward. I may take a shot or two at them only to see them walk, run, or dive around corners. They weren’t just going to cover, they were pulling back. This left me in the uncomfortable spot of having to move into a hostile environment where I knew dudes were camping for me… a position that I have always tried to put the enemy AI in. Now I know how effective it is – since I don’t really relish having to be the one doing the hunting.

“I don’t have all freakin’ day!”

Rather the opposite of above, I have tried to fall back to patterns of “agro-ing” the enemy and then dropping back to wait. As often as not, they don’t fall for it. If they know I’m there, they may very well not come for me – especially if I have nowhere to go. I’m used to being quite comfortable simply waiting around a corner with a shotgun to my shoulder ready to multi-perforate the first moving object that shows itself. I wait… and I wait… until I hear “Flush him out!” followed by that delightful ping of a grenade rattling around at my feet. Crap! But do they just come running dumbly around a corner like my cat hearing the food in his bowl? Nope… I gotta come to them.

“Would you show yourself, damnit?!?”

Somewhat related to the above is their stubborn insistence on using cover. Yeah, using cover is cool. We’ve been talking about it at GDC roundtables and message boards for years. For a while, AI programmers were all happy to use preset “cover points”. In a general sense, they looked good… but they were easy to exploit by just being in a place where that specific cover point was not truly a cover point at all. I get a feeling that these assholes would be perfectly comfortable playing hide-and-seek in a round room with a round pillar in the center of it. They seem to process cover the same way that a human does… “can this specific spot be seen by that dude over there?”

It gets really frustrating when I get into peek-a-boo mode with a guy. The enemy may position itself in the shadow zone of a strip of wall, a column or something to take cover. If I peek around one side, he will move a little to keep the cover between us. If I move to look around the other side, he moves also. There isn’t any invisible pre-defined spot that he’s on, he’s simply trying to not be seen. It pisses me off! Game AI is not supposed to act this way!!

“Quit acting like you guys like each other!”

[Cascade this from above...] If Ol’ Chuck there is running to cover like the little bitch that he is (my language gets salty when I’m pwning), do me a favor and let me gun him down like an arcade ducky. Do NOT annoy me with suppressing fire and all that military squad nonsense. He’s got his back turned and I want to blast him before he gets to that box because, once he gets there, we have already determined that he’s not going to show me anything more than the barrel of his gun for the next 20 minutes. You really are not helping me out by scattering an endless cornucopia of metal alloy in my general direction. It really is distracting and makes it awfully hard for me to jump out here in the middle of the doorway and calmly aim down the sight at his weenie little ass. You act as if he’s on the same team as you or something! What the hell is wrong with you, anyway? Sheesh!

“OK… that’s not funny anymore!”

This was my latest little adventure. I finally met up with one of these “Watchers”. They are like freakin’ Spiderman The Rabbit Puncher. The first time I saw one, I thought it was one of the hallucinations again so I didn’t think to actually shoot it until it walked up and bitch-slapped me… and then disappeared into the damn ceiling before I could blink. Uh. Ok… that was odd. Until, from the corner of my eye, I saw him (or his buddy) swing down from the ceiling, off the wall, over the desk, smack me on the butt again, and then perform a similarly frenetic egress.

For the next 3 minutes, I was twitching around all over the place like I was going through the DTs while on LSD. These two dudes were zipping up, down, “over, under, around and through” so as to keep striking me from behind. If I turned and saw them in time, they were just as likely to about face and retreat and replan. I began to realize that “replan” is exactly what they were doing. This wasn’t a pre-set script to whack me when I got to a certain location… they were making this up on the fly (crawl, leap, cling, whatever)! I finally managed to pop one with the shotgun but the other got me. I was too shaken by the fact that they were actually being clever that I had to quit… and start writing.

Damn.

I’m not sure what I want to do now. Crawl through a billion lines of AI code spread across 100 different AI classes so I know what they are doing… or keep playing so I can experience it more and maybe put myself into a position where I can actually understand some of the more esoteric stuff that I encounter in the code. Right now I’m too shaken up by my encounter with real AI to do either one.

Maybe I’ll go play Doom 3 instead. For some reason, creepy lighting and environments and stupid enemies is not as daunting as generically bland lighting and environments and monsters that actually act like they have a brain for a change.

Congrats to Jeff Orkin and company – I’ll see you next month at GDC. I will be honored and excited to meet you and “talk shop” such as it is. But don’t be surprised if I have a PTSD reaction and slug you before you get a chance flip over that damn table and hide behind it.

(More on F.E.A.R. AI at AIGameDev.com)

Add to Google Reader or Homepage




Content 2002-2015 by Intrinsic Algorithm L.L.C.

OGDA