IA Logo

IA Information

Dave Mark's books

Post-Play'em - Observations on Game AI

Archive for the ‘Bugs’ Category

Dragon Age: Origins – Don’t Crowd!

Tuesday, May 25th, 2010

OK, so it has been a little longer than “later this week” for getting to Dragon Age: Origins commentary. I can’t believe I wrote my first look post back in late February. Of course what that really means is that I’m burning some serious GameFly time on this one title… and it’s not like I’m playing it much. My son has managed to get all the way through it, however.

Still, there are some things I noticed as I was going through (which, admittedly, is not all that far yet). One was an odd happening in the Ostagar camp. I was cruising around looking at things and talking to people. As I was standing there talking to Duncan (and a couple of others), a camp soldier of some sort came and stood near us. From the looks of it, he was supposed to be dealing with another person there, if I recall correctly. This didn’t really catch my notice until a 2nd soldier came up and attempted to stand in the same spot and talk to the same person. They jostled each other for a bit until the first one walked away – apparently on a random patrol route.

…a 2nd soldier came up and attempted to stand in the same spot…

I believe that it was the random patrol routes that caused this issue in the first place. My guess is that the guard logic simply selects a new destination and heads out in that direction. If, for some reason, there is someone already there, it doesn’t detect this or care… it simply continues to try to get to the node.

There are a few ways to either avoid that or fix it. First, the goal nodes could be reserved and released as they are selected and then left. The problem with this solution is that a goal node would be “out of commission” from the moment someone reserved it to the time they left it. If they were coming from all the way across the map, that node would be off the market for quite some time without actually being used. Additionally, it would prevent someone from heading in that direction until the original occupant actually left.

A lot of work to make the camp “feel alive” went down the drain…

A more realistic solution would be to simply be aware of other people. If there is someone on your “spot”, don’t actually try to move onto it. This could be done by simply stopping short of your intended goal (e.g. stand next to him) or by using some local avoidance. The later is probably better because collision avoidance should be part of the movement scheme anyway for other reasons.

Anyway, the result of this was that it was a jarring cancellation of my suspension of disbelief. Because it was right next to me and in view, I couldn’t help but notice that these two dolts were climbing all over each other. A lot of work to make the camp “feel alive” went down the drain right there.

Odd Glitch in Company of Heroes

Thursday, February 11th, 2010

Just to be clear, I really like Company of Heroes. I have always been an RTS fan since the original Warcraft and progressing through Starcraft, Age of Empires/Kings and especially Empire Earth. That being said, CoH is very well done.

I only recently got around to grabbing the full version of the original CoH and the expansion, Opposing Fronts. (Thank you Valve weekend sales!) My prior posts here were only about the downloadable demo. Obviously, there are some significant differences in the full release version. I like them all.
Rather than continuing through the script-fest that campaign maps usually are, I have been playing a lot of skirmishes against the computer. I find a lot of the tactics by the computer to be pretty familiar for RTS games.
For example, as I mentioned in a prior post, it is obvious that there is a lot of influence mapping going on. If I find myself a little behind on producing units, I will often be drawn into a series of dashing from defense point to defense point as the computer picks on whatever is currently the weak spot. My only question in this situation is how much is the AI cheating with knowledge about my force disposition. I know that it is not that easy to discern what the computer has placed and entrenched… it seems like he knows where my weak spots are even if they are deep within my territory.
Anyway, as I was playing a skirmish map, I ran across something very odd. Normally, I had been playing against the “normal” level of difficulty. I had been winning fairly regularly against that level, however, and decided to ratchet it up one level. I was playing the Lyon map against the computer on “hard.”
Because this was a control point map, I was quite used to meeting the “normal” AI at the river as we battled for those 3 points. I figured that the “hard” AI would be just as quick to get to the river. However, I captured the first point… then the second… without seeing the AI at all. I began to suspect that either something was dreadfully wrong or that “hard” used a different tactic than “normal” – such as “build up and crush him” rather than “dash for the control points”. Not too long after that, it became obvious that something was indeed seriously amiss.
Thanks to the wonders of replay files, I was able to go back and witness what the computer did… or did not do. A video is included below.
I sent the video privately to my friend and colleague, Chris Jurney, who did much of the excellent AI work on CoH. He thought it was amusing as well. His speculation was that the Lua script exploded somehow. It obviously didn’t cease working entirely because we see some orders trickling through at times. He invited me to send him the replay file so that he could forward it on to the Relic programmer who is responsible for it now.
It doesn’t seem to be a problem with the map itself as I did go on to play a new match on that map on “hard” and it proceeded to hand me my buttocks as I expected. On the other hand, it may be a problem with a combination of that map, that difficulty level, and a randomly selected tactical approach that knocked a variable out of bounds or something. Regardless of the cause, this is a great example of how important testing is… and yet things still slip through.
Anyway, I will try to do more video captures of some games later – especially the view that shows how the computer is moving throughout the map during the game. That has been very interesting to analyze because it shows how the influence mapping and even the pathfinding is working as part of the decision making.

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.

Driving Crisis in Crysis

Wednesday, January 16th, 2008

Just a brief note as I played through the downloadable demo of Crysis. I was curious about the AI. The reason stems from a GDC a few years back – one of the AI guys I was having a beer with pointed out on a nearby playable setup of Far Cry that you could lure the enemies into the laggoon, make them tread water, go get more enemies into the lagoon, and when you collected enough of them, lob a grenade in to where they were happily treading water. Well, I wanted to see how Crytek improved since then…

Well, I was intruiged at first – the enemies looked like they were doing cool stuff. When I quit for a while, I found the massive number of AI videos on YouTube about Crysis. They were all about the dumb stuff the AI does or doesn’t do. How come I hadn’t seen this? I realized that it was because I was playing the game the way it was supposed to be played… I was letting the AI agents play their roles without challenging them. The guys in the videos were stepping just outside of the parameters at times and the AI would get stuck in a particular animation/behavior and not adapt.

In the example below are some fantastic examples of the AI being almost confused. And this is just a sample of what’s on YouTube.

Well, I went back to playing the next day. Almost immediately I had a situation arise that had me shaking my head. I had driven a jeep along the road for a bit and then decided to hop out – leaving the jeep blocking the road. Soon, an enemy jeep approached from the other direction. I watched from the rocks and trees beside the road as the jeep drove up to mine and, in an effort to stay on its patrol, ran up onto the front bumper of mine. It stayed that way, its front wheels spinning a few feet off the ground. The driver and gunner were oblivious – still stuck in their animations as if they were still out for a Sunday drive.

So, 2 things went wrong – they didn’t react to the fact that my jeep was in their way and adjust their course accordingly. Second, once they were stopped by the physics engine, they didn’t react to this fact. I should have stepped out of the bushes to see if they would have even noticed me at this point (like the boat drivers in the video above didn’t notice people).

It’s a shame that Crytek got so close and so convincing on some things – but has such massive gaping holes in others.

Add to Google Reader or Homepage

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