IA Logo


IA Information
Communication

Dave Mark's books

Post-Play'em - Observations on Game AI


Posts Tagged ‘Left 4 Dead’

Interview with AIGameDev re Left 4 Dead

Wednesday, April 15th, 2009

Back on April 5th, Alex Champandard of AIGameDev interviewed me for about 90 minutes for the Members portion of his site. Our topic was how to use behavioral mathematics (such as I cover in my book) to improve the bots in Left 4 Dead. We cover a lot of interesting information in the interview. Some of the examples refer to things I covered in my columns here on the AI in the game.

He has it posted in audio and video formats (although with me rocking back and forth in my office chair, I look like I’m autistic!). I seriously advise that you check it out. (You will need to have access to the members area to view it.) If you are already a member of AIGameDev, you can find the interview here:

Fable 2: First Look

Sunday, March 8th, 2009

Continuing with my pre-GDC blitz of “must at least look at” games, I have just putzed around with Fable 2 for about 90 minutes. I had a look at some of this material back at the 2008 GDC when Peter Molyneux was going through his pre-release hype. (Isn’t he always?) Therefore, I knew some of the things to look for.

Most importantly, on the AI front, is the inclusion of the almost legendary “dog” AI. To hear Peter talk, you would have thought this game was a bigger and better “Nintendogs” game… that the entire purpose of buying it was to play with your doggie and bond with him. While that isn’t exactly the case, I have to admit that the dog is a good point of interest. The dog certainly is convincing in many ways.

My Dog Runs Rings around Me!

I think one of the things that was startling to me was how it moves in a general area around you. Most companion AI tends to lag behind you. For example, my recent mucking about with the companion AI of Left 4 Dead has me convinced that I am the only person in the entire world with any initiative. This is obviously a logistic issue because very rarely can the AI know where you want to go or when. This is sometimes mitigated in linear games where there is only one place to go. In my short experience with Gears of War 2 today, I saw that exact phenomenon. My companions were able to move ahead of me and take up positions specifically because there was no other way to go.

In Fable 2 this is done via the “breadcrumbs” trail. Despite being far more “open world” than other games, if you have selected (or the game has selected) a destination, by extension, the dog knows where you are headed. Of course, if you turn around and backtrack or go off to one side for some reason, the dog has to react and come back to you… but this is what happens in real life anyway.

The result of all this is that the dog will playfully romp or explore ahead, behind, of off to one side or the other in a general “halo” around you. If you stop traveling for a period of time, he will come back and see what’s up. If you stand still for very long, he may even lie down for a bit… all the while keeping an expectant eye on you as if to say “now what?” It’s all very convincing.

I really noticed one particular aspect of the dog’s animation after I put the controller down and switched off the 360. I went to go feed our own dogs and, as I was walking from the food bin to the bowl, one of our dogs was walking a few feet ahead of me. However, he had his head turned slightly back toward me, keeping an excited eye on me and the cup of food that I was carrying. He did that very dog-like routine of glancing forward and then back at me over and over all the way to his bowl. It struck me that this is exactly what the dog in Fable 2 was doing as I walked. As he would criss-cross in front of me, he would keep glancing back as if to make sure that I was coming along with him. It was this sort of attention to detail both on the behavior and the animation AI that really sold me on this dog. I’m looking forward to experimenting more with it soon.

Look at Me When I’m Talking to Ya!

Interestingly, there were times with the villager AI that I felt that the eye-contact issue was the problem rather than a feature. I’m not talking about how, while in conversation, people will glance away or past you. This was a problem with where they were facing in general. If they started their spiel while I was in one place, and then I moved to one side or the other, they would continue to face the spot where I was. Only after a moment (usually after finishing a line of dialog), would they turn to face me again. It was all rather disconcerting. Compare this to how well games like Half Life 2 continued to address you throughout a conversation… even to the point of turning and walking backwards if necessary.

Dialog Pauses

Another problem I had with the villager AI was how many of the scripted dialogs had very unnatural pauses between lines. There was an awkward silence between many of their sentences that left me wondering for a moment if they were finished or not. It was one thing when it was in response to something I had selected. However, when they paused in conversation with each other, it was odd. When they paused between their own lines, it was horrific and very distracting. I have to imagine that this is because each line of dialog needed to be loaded and accessed separately, but I can’t see why this would be a problem.

Both the facing issue and the dialog pause issue may be related to the same root cause, however. It may be a result of waiting for an associated animation to finish and report back that it is done. If a line of dialog (and the code to “face the player”) are associated with a particular animation, they would each have to wait for the other to finish before they both advanced to the next segment. If the animation finishes first, it isn’t as tragic because the animation can sit in idle for that extra second. However, if the voice finishes first, the next line must wait until the animation is done — causing the unnatural pause. This is just speculation on my part for the moment. I figure that if I analyze it a little further I can make the determination down the road.

Individual Individuals

One thing that jumped out at me during the initial city quests was how the group of kids all reacted slightly different to my various gestures, poses, and flatulation. I would get more “love points” (or whatever) from some than I would from others in the group. Upon a little examination, I found that each person had their own likes and dislikes — that is, things that they were more impressed by or didn’t like. It’s one thing to have different “respect ratings” from different people. It’s quite another to have different models of what causes respect on an individual basis.

I found this rather amusing since I am doing a co-lecture on this very subject at GDC in a few weeks. (“Breaking the Cookie Cutter: Modeling Individual Personality, Mood, and Emotion in Characters“) It’s something I would like to see more of in games in the future — although maybe not in quite as transparent a fashion as what appeared on-screen in Fable 2.

Will You Treat Me Different When I’m Famous?

I think it will remain to be seen what happens when I’m more renowned than I am so early in the game. In the original Fable, it got rather annoying that everyone, everywhere wouldn’t shut up about you. The comments that they heaped upon you were not as many in number as there needed to be. (You can only hear “chicken chaser” so many times before you want to crack someone’s head.) With a nod to my friend and colleague, Adam Russell, who did the villager AI for Fable, that isn’t an AI problem as much as it is a content problem. (This is another bit that I will bring up at the AI Summit panel, “Characters Welcome: Next Steps Towards Human AI“… it doesn’t matter how many decisions our AI can generate if we don’t have enough art and sound assets to express it.)

Anyway, this is a bit long for a first look. I will tag on some more as I experience more of the game. On the other hand, I will be shipping this back to GameFly in the next day or so. I need to check out a couple more titles before GDC in a couple of weeks.

If you are just jumping into this one article, make sure you click the tag(s) below to see if I have written anything else about Fable 2.

Left 4 Dead: Companion State Changes

Wednesday, February 25th, 2009

Another interesting observation in Left 4 Dead. In this case, it is about the state machine that the companion AIs are using. First, the observations:

The first clip in the video below shows me getting ready to leave the safe house at the beginning of the level. My companions did their usual “grab some stuff” behaviors and then lapsed into “random wander” idle behaviors (I couldn’t hit the screen shot key fast enough to show Louis standing with his nose in the corner like a punished boy.) When I went down the stairs to the door, I was mildly perturbed that they didn’t follow.

I then opened the door and shot the zombie standing outside. They still had not moved to join me. A zombie rushed me, I leveled him, and my sidekicks were still admiring the walls upstairs. Only when I stepped across the threshold did they move to join me (with Francis doing a completely unnecessary walk on the railing… but that’s a future post). Something not shown in the video is something I have experienced before. Usually, when I step across the threshold of the safe house, they are in quite a hurry to leave the room, even to the point of pushing through me to do so. It probably would have happened in this case if we had not been under attack at the time.

In the second clip, we were at one of the intermediate buildings on a map. We had run inside, closed the door, stocked up on ammo and health packs, healed ourselves and whatnot. I opened the door and left the building. The video picks up as I look back inside realizing that my pals didn’t seem to want to leave. This was different than the first clip in that the trigger was not leaving the room.

There was a Boomer behind the building that I could hear. Even when the Boomer came around the corner and started waddling toward me, they didn’t move. Only when I fired my weapon did they decide it was time to rush out.

Now, for the explanation. It seems that Valve is using an HFSM (Hierarchical Finite State Machine) or another such tiered approach (a behavior tree can cause this as well). There is likely a high-level state that we will call “In Safe House”. When in this state, other lower-level states are things like “random wander,” and “random comment.” The only thing that seems to override it is if they see a zombie outside a door (many of the safe house doors have those barred windows). They will actually engage and kill zombies outside the safe house from inside the door. Therefore, there is an “engage/kill” state that is contained under “In Safe House”.

On the other hand, another high-level state is “In the World”. It is in this state that the AI spends most of its time. Apparently, “stick with the player” and “defend the player” are only included in this high-level state. That is why they would not follow me down the stairs while I was still in the safe house or defend me when I got attacked. However, once I crossed the threshold, a message was sent to them to change states to “In the World” at which point, they were free to analyze their usual parameters such as distance (move to the player) and threats (defend the player).

Note that this would not have been a big deal if I had simply stepped out the door. Alternately, in other safe house situations, the random wander location is in sight of the door. Therefore, when I got attacked, they would have likely seen the zombies and fought back. This particular arrangement did not allow for that.

Now, I don’t know what happened with the building in the second half of the clip. Because that isn’t an “beginning/end of level” safe house, I would suspect the above rules don’t apply. Why did they not leave, then? I have seen other behaviors where they don’t seem to follow me like I would expect, but I have usually found other explanations for that (another post on that later). In this case, it would have made sense for them to leave along with me just like they tend to stick close in other circumstances. That leads me to believe that there was an artificial state in play that led them to believe that they were supposed to be there (or rather had yet to convince them it was time to leave).

Regardless, in this case, the obvious trigger was me firing my weapon. This was not the case in the safe house example.

Neither of these issues is dreadfully wrong in a gameplay sense. They are only noticeable in certain circumstances. And certainly the companion AI in L4D is better than some we have seen. However, when issues like these happen, they do make us pause and ask “what are you guys thinking?” Therefore, while the logistics of the game may not be affected too much, the perception of the game is. It breaks that coveted suspension of disbelief by making us ask (in typical gamer parlance) “WTF?!?”

A simple solution would have been to pay more attention to what was under the HFSM state of “In Safe House”. Alternately, have more than one trigger to transition from “In Safe House” to “In the World” would have been better. For example, opening the door is an obvious trigger that it is time to go. Getting attacked certainly is urgent enough to warrant attention as well.

Additionally, abandoning the rigidity of a HFSM could be the answer as well. Much of the problem would be solved by using a system of free-floating priorities such as what I describe in my book, “Behavioral Mathematics for Game AI”. In that arrangement, you can generally dispense with the state/transition model in favor of one that always has all possible actions in play through a system of calculated utilities and priorities. Something similar to this is probably already in effect in L4D for things like target selection, action selection (fight, heal, reload, etc.) and other actions. Therefore, extending it to cover the situations covered above would not be terribly difficult, in my opinion.

Anyway, all in all the companion AI seems to be fairly decent. As we AI programmers know, companion AI is a beast simply because of how involved the companion is with the player. There’s more scrutiny, more options of what to do, and far more potential for the “WTF?” moment and the ensuing frustration. I think that companion AI is the next frontier of game AI that we are already in the middle of. L4D is in the vanguard of this movement and doing an admirable job of it.

Remember to click the tags below for more Post-Play’em observations on Left 4 Dead and other related subjects!

Also, if you liked this article, please take a moment to submit this link to StumbleUpon, Digg, or Reddit. I would appreciate it, as would many other game AI enthusiasts!

Left 4 Dead: Forget Something?

Tuesday, February 24th, 2009

I saw an interesting error of logic (which is different than an error of execution) in Left 4 Dead earlier today. As I was holed up in a safe house, about to head out on the next stage of the map, Zoey neglected to grab a health kit. She was slightly injured at the time. The rest of us had health kits already so it wasn’t that she was saving it for us or a semaphore was set saying “leave it for the player”. Also, because we were in the safe house, there were no distractions requiring her attention. She simply was oblivious to the fact that there was a health kit there.

I thought that this was very odd. It would seem that the one thing that the AI sidekicks should do is stock up on stuff whenever they can. This is very much like how they take a moment between battles to do things like reload, pop some aspirin, or heal up. Those are the times that you are supposed to do things. Additionally, during those lulls between the frenetic nightmares, you should also make sure you are stocked up on “stuff”. You never know when you are going to need it. However, while everyone else seemed to do so, she did not.

Because she was almost healed, I have to wonder if there was a fuzzy threshold that was not quite crossed at the time. I had half a mind to shoot her and see if she would change her mind. If I see it happen again, I will do so. Still, it doesn’t make sense to ignore the purpose of what is an obvious pit-stop in the game.

Left 4 Dead: First Look

Monday, February 23rd, 2009

Ok… half price weekend on Steam finally got me into Left 4 Dead. After watching all my TF2 buddies drifting away to this mysterious “other game”, I needed to jump in and take a look. Also, since it will likely be the buzz of GDC next month, I figured I had better have an idea of what it looked and felt like.

I have to admit that it’s a pretty groovy game. All the stuff we have heard so far is correct. The online, team play is cool. It’s so much better than most team shooters in that it seriously punishes you for separating from your cohorts too much. Also, because there is such a significantly different array of tactics that are necessary for playing as the infected, the versus mode is almost like having a second game. But that’s not what this column is about…

The big AI pull on Left 4 Dead is the “AI Director” that we have all heard so much about. In an interview with Edge Online, Valve’s Gabe Newell talks about all the nifty stuff they tried to take into account. Wikipedia even touches on the AI Director. It’s no secret that this tech was a big deal.

When I finally got to playing it, I was very impressed with it myself. Having played through some of the levels more than once (like No Mercy, for example), I am well aware that I don’t know where anything is going to be next. Compare that to other games where the 2nd time through you already have an idea of what is coming next… by the 3rd or 4th time, you have it down. I don’t like that amount of rigid predictability. With L4D, I have been on my toes at all times.

It does seem like it does a decent job of balancing the flow of the game. There are plenty of times when I’m “on the edge”. Compare this to the rubber banding I suspected in Doom 3 where it just seemed that the lower I got on health, the less damage the enemy did. The result was an (almost) asymptotic approach to 0 health. Exciting? A little. Contrived? Definitely. With L4D, this feeling is much more natural in that it is adjust the pacing of the enemies themselves rather than adjusting the abilities they present. Rather than the confusion of “why is this horrible monster doing very little damage now that I’m almost dead?”, I find myself saying “thank God they aren’t coming after us just now… I need to heal up a little!” It’s a subtle difference, but it is there.

That’s not to say that the game is always winnable in true rubber band fashion. On my first day of play, three friends and I played that last rooftop level of “No Mercy” about 8 times and kept coming up just short. It was exciting each time. Finally, we beat it by only barely dragging our asses into the chopper. Quite the getaway! As we reflected on what had happened (the game was new for all of us), I noted that every single time was different. Different monster placement, different ammo placement, different items, different pacing. We couldn’t do the same thing each time because the computer wasn’t doing the same thing. One time we used gas cans to light fires. The next time, I went looking for the gas cans… only to find that they weren’t there (they were across the level). The next time, there were no gas cans at all… just more propane tanks — which meant a different strategy entirely.

What I have found interesting is, while playing the infected (which I am having trouble getting the hang of), I can watch the other zombies “pop in” as they spawn. It’s kinda fun to see them do that. Oddly, I feel a strange kinship with them at that point. (“Yeah, right here buddy! We’re gonna get ‘em from this closet, right dude? Right? Hey… pay attention to me!”)

The other thing I get to watch as the infected is how their “idle” behaviors work. There are quite a few of them and they blend well. Admittedly, by their nature, zombies don’t have to be terribly engaging, but it is a nice touch to come around a corner or see a group far off actually doing stuff. Sometimes, I feel that the sensory distance is a little short, however. If a little beepy grenade gets every zombie in the same zip code to freak out, why doesn’t my shotgun wake them all out of their staggering stupor as well? Again, people just don’t model the sense of hearing well in games. *sigh*

The AI of your counterparts is pretty decent, for the most part. I’ve seen a couple of odd glitches, however. Therefore, I think I’m going to make that a separate post so I can possibly post some FRAPS-caps of them in action.

(As always, make sure you check the tags below to see what else I may have written about this game.)

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