IA Logo


IA Information
Communication

Dave Mark's books

Post-Play'em - Observations on Game AI


Skyrim: Points of Interest

January 25th, 2012

Another minor observation. I was hanging out in a small town and, for some reason, there was a Frostbite Spider corpse in the middle of the road. I don’t know why it was there since I wasn’t the one that killed it. However, what I did notice was that various villagers walked up to it while making eye contact (head contact at least) with it, stopped to look at it for a moment, and then moved on. A guard even knelt down and touched it.

This is such a huge point of immersion in games. That is, people noticing things that are out of the ordinary whether those things are objects that shouldn’t be someplace or events that are unexpected. Certainly, we can’t afford the processing power for people to suggest that a chair would be better off in the other corner of the room, but having a large venomous spider corpse the the middle of the road (or even in town at all) is certainly worthy of note.

Sure, we have done this with the monsters when they are alive. (Although there are plenty of examples where NPCs don’t notice this as well.) However, often people ignore things after they are dead. Even the agents that kill things will often simply state change to walk away from something as if it never existed in the first place. This, on the other hand, is very different. To me knowledge, these people didn’t even see the spider get killed. They simply noticed the corpse as an object that was worthy of note.

Well done!


Skyrim AI Weapon Selection

January 14th, 2012

Say what you want about Lydia and her lack of pathfinding prowess, she does do some things right. The problem is (as is the case with all good AI), unless you are looking for it, you might not notice.

Early on in my relationship with her, I had noticed that she would switch between her bow and a sword. Later on, as is part of her duty (which she will remind you of in her sarcastic, resigned drawl), I had given her a bunch of stuff to carry for me. That included a few different weapons and 3 different magical staves with varying abilities.  During a combat, I noticed that she was using a paralysis staff to disable a mage we were fighting. After knocking his ass to the ground in such fashion, she joined me in whacking him into oblivion (not to be confused with “into Oblivion”).

I’ve seen her in other situations use the paralysis staff, switch to using two other more offensive damage staffs, and then pull out an axe in place of one of the staffs… all as the situation warrants and all in the same combat sequence. This is something I’ve  been looking for in games for quite some time.

I haven’t been able to completely discern whether she is using a specific rule-based system or if there is some sort of underlying utility model at work. I would tend to say that it would be at least a portion of the later. That is a model that is far more expandable which is necessary when you include the number of potential weapons (and other objects, I’m sure) and potential factors to consider. If I notice more, I will mention it.


Skyrim: It’s a Free-for-All!

January 1st, 2012

Just had a battle out on the plains west of Whiterun. It was bad enough that I got jumped by a dragon. Then, the dragon flew a ways away and started chillin’ a nearby mammoth. Lydia and I continued to take potshots at Mr. Dragon (Mrs. Dragon?) while the mammoth ineffectually stared down its assailant. Eventually, the mammoth started running (right past me and Lydia!) and the dragon seemed to give up on it.

Unfortunately, I soon realized that there were a couple of mages wandering around the area who, for some reason, apparently decided that Lydia and I were far more menacing than the circling beast. And then there was the skeleton — who may or may not have been the product of the mages who started attacking me. By the time I dispatched the skeleton, the dragon had gotten bored with whatever it was he (she?) was fighting nearby and came back to visit. This all came to a rather unfortunate end… but that’s not what I came to tell you…

“There seems to be a serious lack of proper prioritization of targets.”

The point of all of this is that there seems to be a serious lack of proper prioritization of targets. For example, despite the fact that a mammoth might look awful tasty to a dragon, said morsel is not going to be able to attack you. Better to dispatch the pair of annoyances that are pumping arrows into you and come back for the hairy buffet later.

The same can be said for the mages. If there is a dragon cruising around, it seems rather silly to attack two relatively harmless bipeds. In fact, the chances of defeating the dragon (and therefore surviving) would go up considerably if it was attacked by a group rather than by a couple of individuals. An additional bonus would be that the dragon might take such a toll on your secondary opponents that it leaves you an advantage you might not otherwise have.


Obviously the target selection algorithm doesn’t take a lot of this into account. It’s really a matter of mathematical modeling. Ironically, it is the same sort of modeling that goes into non-combat games such as The Sims. The good news is that it is relatively simple to put together and can adapt to pretty much any situation that your NPCs find themselves in. It can also be  tied into the entire combat selection system so that the possible actions could include not attacking anyone at all (even running away, if necessary).

For those that are curious as to how such utility-based systems can be built, it is pretty much the entire point of my book, Behavioral Mathematics for Game AI.


Skyrim: Pardon the Interruption

December 31st, 2011

This is a quick one. I have seen this numerous times in my few hours of playing, but I haven’t captured as many of them on video as I would like.

“They neglect to take any sort of context into account.”

People in Skyrim obviously have a proximity trigger with your character. If they have something to say, they will say it either when you get in range of them or vice versa. While this makes for some great immersion at times, they neglect to take any sort of context into account. They don’t observe what is going on and decide whether or not they should talk to you.

I don’t recall anyone doing it while I was in an active dialog tree, but there are certainly times when I am listening to something important — and especially if I am obviously part of a group discussion (such as in the two examples in the video). People doing their random walks will pass close enough to me to trip their trigger (so to speak) and say their piece. It’s horribly distracting.

“Real people have an awareness of unwritten social rules.”

The reason that this breaks immersion is that (real) people have an awareness of unwritten social rules. This is notoriously hard to get right in games. Richard Evans has been working on it for years — most notably with his work in The Sims 3. However, we aren’t solving for behaviors such as “don’t walk in on someone where they are taking a leak.” We are simply saying, “if I’m involved in something important, don’t interrupt me.”

If it is, indeed, the case that there is a boolean to not interrupt when a dialog is active, this is a simple fix. Apply the same boolean flag to when something important is going on that the player must listen to. In the case of the street preacher in Whiterun, this isn’t as big of a deal. By definition of his role, he is going to repeat himself. However, in the cases shown in the video, this is a one-time thing with important information… don’t play your random engagements.

“If I’m not
looking at you,
don’t speak to me.”

Another way of solving this is through a slightly more complicated method of simulating “eye contact”. That is, if I’m not looking at you, don’t speak to me. Let’s face it… that’s a common one that we all use in public anyway. In the case of the examples in the video, the 2nd one would have fallen into this category. The guard just happened to be walking by — behind me — and decided based on proximity to say his line. In the first video, at least I looked at the guy.

In effect, many of these rules can be combined together in some form of rule-based system… even an additive one using cumulative values. By assigning values to the various considerations (including a value on the importance of the message itself) you can define a threshold above which you are allowed to say the line. That solution would be much less brittle than the simplistic one that is being used here, and yet it is still lightweight and easily customizable by designers and programmers.


Skyrim: To Headlook or not to Headlook?

December 30th, 2011

While playing my initial few hours of Skyrim this week, I’ve noticed an interesting disparity in the way headlook is used by characters. While I enjoy headlook in games for the most part, there are times when it can either be overused (“why is everyone in town staring at me all the time?”) or used in such a way that it looks unnatural to the character. Here’s a video with a few examples. Watch it first because the commentary addresses the scenes within.

 

Look at Me When I’m Petting You!

First, the dog in Riverwood doesn’t seem to care that I’m there. With nothing else going on in the middle of the night, you would think that he would at least be interested in me. Instead, he just sits there staring at nothing. While that is perfectly acceptable for a dog to do (ours do it rather often), the problem arose when I actually “talked” to the dog. He barked in reponse — but wasn’t looking at me at all when he did so. He looked around randomly — but not towards me.

If you are going to make it so that the dog responds to being addressed, at least make him stand up and face you or turn his head to see you (if possible). You do this with enough other agents in the world, it shouldn’t have been hard to include a line or two of code to do it with the dog. (I have yet to test this with other animals in the world.)

Look at Me When You’re Talking To Me!

When I entered some tavern or other in Whiterun, I was immediately spoken to by the owner of the place. She was standing behind the counter. However, I noticed that she was not looking at me — just staring straight ahead. Ironically, she only looked at me when the server lady spoke to me (and mentioned her name). Then, she wouldn’t stop looking at me at all. One thing I forgot to test was to see if it was proximity based. That is, if I went father across the room, would she have stopped looking at me. All in all, with that sort of incessant tracking, I feel like I’m being targeted by and anti-aircraft gun. At least with the bar there, she had a reason to continue facing that one directly.

Move More than Your Head

Now to this clown Heimskr in Whiterun. As seems to be his job, he runs his mouth out in the town square. When I walked up to him, he started tracking me. (Grateful to have an audience, I suppose.) While it looked OK at first, at one point he raised his hands up… right between my face and his. He was still trying to look at me, but his hands were in the way. As I moved back and forth (after stopping to grab some lavender), he kept his body facing forwards and his hands raised — but his head kept tracking me.

It looked horribly unnatural to have his body pinned to one orientation — especially in a gesture that is meant to be for the audience’s benefit — and yet still move his head so much. Unlike the bartender above, he has nothing holding him to that orientation. I would like to see some pivot to the body as he addresses me that way.

Face Me Once in a While

This one is a little rough. While I commend games for not always having the agent face directly at you, my qualifier is constantly. Sure, orient your body differently as you move around! However, you aren’t being clever (or realistic) if you position your body so that it is facing away for some reason, point your head toward the player, and then leave it that way! In the video you will see 3 clips of people who happened to not be facing me directly when I started speaking to them. They didn’t orient towards me at all when they started speaking to me and didn’t fidget at all during the conversation. The result looked rather uncomfortable.

Not shown in the 3rd clip is that the speaker did reorient himself after we were jostled by someone walking rudely between us (more on that subject later). I thought that was interesting in that it triggered some sort of alignment code in the agent. Therefore, it seems that some such code exists, but just wasn’t being used.

How to Fix it

This really isn’t that difficult to fix. Not only would it look less uncomfortable, but it can be leveraged to make for far more engaging characters. All that needs be done is the following:

  1. If the player moves outside of a particular front-facing zone, pivot the body as well as the head. You don’t need to pivot to face him completely, only enough to get the head into a more natural range. For example, if the zone is 60° on either side of center and the player moves out of it, pivot so that the player is now 30° off-center instead. Try it on yourself and see how natural that feels.
  2. As you are talking to the player, reorient yourself once in a while through various shuffling animations. Again, make it so that your body is always somewhere between +/- 30° off of the centerline to the player.
  3. Don’t always stare at the player. People don’t do this in conversation. Randomize headlook more. Look around occasionally — even while you are talking but then glance back at the player directly. The points where you glance back at the player can actually be marked up with the facial animation so that you glance at the same time as important points you are trying to make. Otherwise, look around either randomly (and not all in the horizontal plane, either… up and down are OK, too!) or at other points of interest in the room. For example, people walking by, the performer in the tavern, windows and doors in the room, etc.

Anyway, these are just minor things that have jumped out at me in my initial few hours with the game. While not really bugs, certainly, the headlook issue breaks immersion for many people if it is not done naturally.

There are far more annoying things I have seen that will be addressed later.


Dragon Age: Origins — Final Thoughts

November 16th, 2011

Well, after messing around with it for over a year, I finally got around to finishing Dragon Age: Origins. I have to admit that the game grew on me after a while. Here are some final thoughts on it. (Note that you can read my earlier posts on the game.)

Custom AI Tactics

“I kind of liked dealing with the AI tactics.”

Once I finally dedicated a little bit of time to looking into it, I kind of liked dealing with the AI tactics. It’s a simple rule-based system, of course, but one that gives you a feeling of control. The reason that I specify “feeling” in this case, is that most of the rules are pretty obvious. For example, a rule for Morrigan might read “When there are 3 or more enemies clustered together, use Fireball.” I’m sorry, but that goes in the “duh” column. Really, that should be a part of the logic for the Fireball spell in the first place. The same goes for the “dual weapons sweep” logic that I used on my main character (for when I wasn’t controlling him). “If there are 2 or more enemies surrounding you, use dual weapon sweep.” (I also found that I used it with one enemy just because it looked cool and did great damage.) Regardless, many of the usage rules just simply made logical sense.

“The solution to this is to build the logic into the abilities themselves.”

The solution to this is to build the logic into the abilities themselves. If you are wounded, use a healing poultice (if you have one). If you are low on lyrium energy and have a potion, use it. If you are strong and have a shield, do a shield bash against your enemy. There really should be no need for the player to construct these manually. Of course, I don’t know what the chicken/egg order was on this mechanism and the “tactics” abilities that were built into the character customization. That is, did they create the AI tweaking mechanism and then decide to add the character abilities that allowed you to unlock more tactics slots or did they create the notion of “has better tactics” and have to come up with a way of expressing that?

“That character has that cool new ability but never uses it!

The unfortunate by-product of this is that I can see how it would be very frustrating for people who didn’t know that the tactics screen was there or didn’t understand how to use it. I’m sure there were more than a few people who would cry, “that character has that cool new ability but never uses it! This AI is stupid!” Of course, there is always the possibility that the reason this mechanism was in place was because they were struggling with how to have the NPCs use their skills intelligently. By putting the onus on the player, they absolve themselves of a little of the responsibility. I don’t buy this line of thinking because, by creating a customizable rule-based system in the first place, the battle is almost won.

Companion Pathfinding

“I usually was pretty pleased with their positioning.”

With Skyrim being out, one of the comments you hear about the companions is that they can do silly things like block doors or passages and be completely clueless about the fact that you want them to move. This is not something that I ever found to be a problem in DA:O. In fact, despite the fact that I usually had 3 other companions along with me, I usually was pretty pleased with their positioning. They followed at respectful distances, they didn’t get trapped behind geometry, they handled it fairly well when I would reverse direction on them, etc. Most of the time their “group” behavior was very believable.

There was only one time that I noticed anything really odd. I was in Dust Town in Orzammar and Zevran (easily my favorite NPC, by the way) managed to get up on a pedestal of some sort and was unable to get down. After some examination, I realized that it was an extension on either side of some stairs. He had somehow managed to enter it from the top of the stairs but couldn’t exit that way. Likely there was navmesh geometry on the pedestal (why, I don’t know) but no link to the rest of the mesh. For some reason, when my back was turned, he skipped a mesh boundary by being nudged off the main mesh. I’m just speculating here. Anyway, I had to actually exit the zone without him and come back.

Enemy Targeting

In an earlier missive on DA:O, I had complained about how the target selection seemed to be a bit nonsensical at times. Perhaps I got used to it or perhaps it wasn’t as bad as I initially thought… but this issue didn’t seem as bad as I had commented on earlier. There were times when I thought it was a bit odd, but it wasn’t altogether unreasonable. That, of course, has been one of my mantras for some time and, in fact, is something that I stress in my book: “Not always perfectly rational, but at least reasonable.” I don’t know if that was the goal here or if their targeting was simply sub-optimal.

Of course, with regard to my companions, some of it had to do with the tactics selection and aggressiveness settings. If I had them set wonky, they would act wonky. However, I can’t use that excuse with the enemies. On the fly, it is hard to determine what sort of logic they are using… e.g. “nearest visible” vs. “strongest”. This would be something I would have to record and slow down to decipher. However, since it doesn’t seem to be that weighty of an issue, simply “knowing” wouldn’t really change much.

Again, though, some of this is mitigated by the fact that you can control each character in turn. Is this a bandage, though? Are we at another chicken/egg moment? Did they allow you to control the character targeting because they felt people would be frustrated by the target selection? Probably not… it’s not that bad to force them to build a whole huge mechanism (character control) around it.

Scripted “Random” Conversations

I found the seemingly random chit-chat between companions as one of the most amusing parts of the game. I have to admit that it was so endearing, that it made me want to replay the entire game with different companion combinations just to see what all these conversations were. (The combination of Zevran and Morrigan was a riot!)

“You begin to get used to the fact that riiiighhhtt here someone is going to start talking.”

The initial impression is that these asides simply take place “whenever”. Conveniently, they would also take place when you really weren’t doing much else. It didn’t take long, however, to realize that there were “hot spots” in the terrain that triggered these conversations. Not to the extent that Place A triggered Exchange A; they were randomly selected from the available list. They were obviously placed in areas where you needed to do a bit of walking and, therefore, wouldn’t be interrupted with much else. The long bridge to the Proving Ground in Orzammar has one, for example.

The problem is when you have to walk the stretch more than once — especially in succession. You begin to get used to the fact that riiiighhhtt here someone is going to start talking. It’s even worse when you have to reload because it doesn’t remove the conversation from the potential list… and you may get stuck with the same one over and over. While I like the conversation as a way of both fleshing out the characters and making the scenic walks a little less boring, I have to wonder if there is another way of doing it.

Facial vs. Body Animation

“The lip-syncing is worthy of being looked into by the pop-music industry.”

While this doesn’t necessarily seem to be AI-related, I figure that it probably is. The facial animation in DA:O is great. The lip-syncing is worthy of being looked into by the pop-music industry. With how good the lip-sync is, I found myself staring obsessively at the mouth only while people were talking. Maybe because I was drawn to the only realistic part in the whole face.

The rest of the facial animation is spotty, however. I would love to see more expression in the rest of the face, too. The eyes, eyebrows, and, in fact, the entire head, needed to be more animated. While the head wasn’t “Fallout” creepy, it needs to move more… look around a bit. Same with the eyes. Little tiny twitches are nice, but people do things like glancing at the floor, etc. You’re on the right track, but need to do more.

“People don’t just wave their hands randomly.”

The body animation during conversations was simply horrible, though. I like the whole “hand-wavey” thing that they tried to do. It’s better than standing perfectly still. On the other hand, people don’t just wave their hands randomly — they use them to augment what is being said while it is being said. They use it to punctuate words much the way I used italics in the this paragraph. If I had italicized different words that were obviously not meant to be stressed, I wouldn’t have communicated the same thing or, worse, it would have distracted or even confused the reader. That’s what I felt about the hand motions in DA:O. They seemed vaguely relevant but so imprecise and ill-timed that it made things worse rather than better.

The solution likely lies in a markup of the dialog to map to the animation selection. By tagging the stressed words with the appropriate gestures, you can match them dynamically. The trick, of course, is that you have to back-time the start of animation so that you can finish on-time. The shorter the target animation, the easier this is to pull off.  That would actually require two markers… e.g. “move to position” and “execute”.

For example, if I want to slap the table as I’m saying “now”, I would tag a point 2-3 words ahead of time with the “raise hand” animation and then the word “now” with the “slap table” animation. Imagine the impact (so to speak) of having a character be able to slap that table, point the figure, shrug the shoulders, incline a head, wave something off dismissively, etc. and have it happen right at the precise moment it needs to. Now that would be immersive! (Note that the word “that” would have been a great place for a couple of key animations, eh?) (Note that the word “eh?” in the prior sentence would have been a great place for a… OK… never mind.)

That said, the rest of the animation was spot-on.

Summary

“The companions didn’t cause me undue stress… which is a spectacular accomplishment.”

All in all, Dragon Age: Origins was a really well done game. I enjoyed a lot of it and never felt really “constrained” by a specific narrative. I know I left a lot of side-quests on the table, but that’s almost a requirement for a Bioware game these days. You aren’t going to do them all and still manage to be a productive adult.

The companions were, indeed, companionable and didn’t cause me undue stress… which, as far as companion AI goes, is a spectacular accomplishment. The enemies were reasonably intelligent and only some of the more obvious boss monsters were pattern-style scripted (which is a disappointment because pattern-style scripted AI looks less intelligent).

All things considered, I enjoyed the hell out of the game. People have told me that DA2 is well worth the time. I just wish I had more of it to dedicate! I have a feeling that it isn’t a game I can finish in a weekend!

 


Splinter Cell: Conviction — Last Known Position

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

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

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.


Dragon Age: Origins: Why pick on me?

May 26th, 2010

Another moderate gripe about the AI in Dragon Age: Origins. In the encounters I have had so far, I’ve noticed a peculiar behavior with aggro and targeting.

…the enemy would rush right past my guys and straight toward me.

When I would approach to within aggro range of a target, I was generally in the front of my party (since everyone follows the player). The enemy would aggro, target me, and then rush forward toward us. The problem was, as I stood still—say with a bow, a spell, or because I’m lazy—the initial enemy would continue to rush right at me… in the process running right past my party-members who had moved forward to engage them. That is, the enemy would rush right past my guys and straight toward me. Often this was furthered by the fact that my guys may have selected other targets in the group… meaning that my party-members and the enemy were running right past each other as if they weren’t there. Put another way, it looked like a joust. It even put my pals in the odd-looking situation of having to back-track to get to the fight.

While this wasn’t horribly tragic, it did look silly. It would have been worse had I been a “squishy” like a spell-caster. The expectation that my brutes would rush forward to protect me would have clashed with the idea that they weren’t doing any such thing—really, because they weren’t allowed to do so in time.

While I haven’t played too much with the customizable party AI settings, it really makes me wary of the “charge into battle” selection in that the battle might run right past them.

Suggested Solution?

…the idea should be “I’m attacking those guys over there.”

To me, it would seem that an extra calculation is in order after the initial positioning of the participants. For example, after my guys start to move forward (and likewise for the enemy), re-process who each person is targeting. After all, it is unreasonable for them to initially say “I’m attacking enemy XYZ” when the idea should be more along the lines of “I’m attacking those guys over there.”

This calculation can be repeated at intervals so that targets of opportunity are selected. Instead, it seems that a target is selected and fought “to the death” regardless of whatever else is happening nearby. This doesn’t need to be run terribly often. Perhaps every second or two and then event-based as well (e.g. “my opponent is dead“).

Again, this is a minor issue, but it does break that suspension of disbelief because it just looks wrong. As I mentioned, given the expectations of behavior, in some circumstances it can be frustrating as well. Thankfully, this is something that is fairly easy to fix.


Add to Google Reader or Homepage

Latest blog posts:

IA News

IA on AI

Post-Play'em




Content ©2002-2010 by Intrinsic Algorithm L.L.C.

OGDA