IA Logo

IA Information

Dave Mark's books

Post-Play'em - Observations on Game AI

Company of Heroes: My First Look

February 7th, 2009

Well, now that I’m finished writing my book, I am grabbing a few demos of games that I really need to take a look at. I pulled down the free demo of Company of Heroes off of Steam the other day and have had a chance to putz with it a bit.

One of the reasons that I wanted to see CoH was the articles by Chris Jurney in AI Game Programming Wisdom 4. He wrote up a pair of articles on the pathfinding algorithms that they used–one for constructing realistic turns for vehicles and one for the ‘leapfrogging’ of squads. Both are good reading.

Anyway, I haven’t touched an RTS since Empire Earth (which chewed up way too much of my time in its day). It took me a bit to get back in the RTS groove. I was immediately impressed by the way the squads moved, but perhaps that is because I was looking for it. Also, they seem to react well to the unexpected. One concern that I had was how they didn’t seem to always go for cover when I would have expected them to. Despite having plenty available, sometimes they would hang out in the open. This is more alarming when 4 of the 6 squad members are in cover nearby but the other 2 don’t go. It makes me briefly wonder if the value being tracked is the amount of cover per squad rather than per soldier. I will have to investigate further on that (or just ask Chris when I see him next month).

The vehicles, as well, move admirably. Calculating vehicle movement on the fly (in a destructible environment!) is, indeed, a pain. Again, I will observe more, but they seem to do fairly well. The tanks have the advantage of being able to turn in place. However, the jeeps and trucks do not have this luxury and need to plan ahead lest they find themselves unable to make a turn.

On the 2nd campaign map (with the 3 bridges), I noticed some serious influence map work going on. As I got my bridge defenses shelled (and failed to rebuild quickly), the offensive seemed to shift to that bridge. As I reinforced it at the expense of another bridge, they seemed to shift to the one I had borrowed from. Now, with the fog of war in place, I don’t know for certain that is what happened. They may have been hanging out over there and just were able to push forward when I moved away. I will have to see if there is a replay mode that shows the enemy.

Sometimes I wish that the squads were a little more autonomous. There are times when I wish that they would take some more initiative with their orders. When I give them orders, everything is cool. I can tell a squad to attack/move all the way across the map and they will engage and move repeatedly until they get there. However, if I only give a unit partial orders, they will wait patiently until I get back to them… even if that means standing in the middle of the street.

One example of this is when I had an anti-tank artillery unit pointing one direction with no target and a tank started firing at them from behind, they didn’t turn around. While sticking to my orders is cool and all, some intelligent reactive behavior would have been warranted there. I’m not sure if this aspect is more of a design decision than a failing of the AI, however.

Again, I need to play with the game a bit more to get a feel for it. Right now I am spending more time noticing what I am doing rather than what the AI is doing.

(If you jumped into this article, you may want to click the “Company of Heroes” tag below to see if there are more observations on it.)

Team Fortress 2

August 15th, 2008

Ok… this really isn’t observations on the AI of Team Fortress 2. It is one of my weekly columns that I write for AIGameDev.com entitled “Play First… Code AI Later“. In it, I talk about how observing other players online (especially the bad ones) really helps make me a better AI designer and programmer. There is much to learn from watching the differences between how the good players approach things when compared to the less-than-stellar tacticians. Most of it is on a tactical level… not anything to do with pathfinding, aiming, etc. This is more about how to think as a soldier (or engineer in this case).

Anyway, hop on over… it’s actually rather long. Yeah… there’s definately a rant tone to it at times. *shrug* Sorry…

Tenchu Z: Ninjas Had It Easy

June 28th, 2008

I will preface this commentary with three things:

A) We got a copy of Tenchu Z for free.
B) My 13-year old step-daughter (a black belt in taekwondo) is enamored with ninjas and the like – which is the only reason why I even broke the seal on this game.
C) I didn’t get too far into the game – so if it gets better as it goes along, I missed out.

I can write off the game design itself as perhaps being “not my style”, but from an AI standpoint, this game is just plain bad. Even my step-daughter, with her rudimentary knowledge of game AI (just from being in the same room with me often enough) was pointing out the obvious issues it has.

Advertising States

First off, welcome to the land of plainly exposed finite state machines. The enemies may have well been traffic lights since they were broadcasting the very few states that they had. I haven’t touched the game in a few weeks, but off the top of my head, they were… Pace, alarmed, sniff (yeah, sniff), chase, fight, panic, die. Sure, there were some sub-states in there, but those were pretty much just to animate the characters.

What’s more, some of the states were not even necessarily dependent on the environment. I watched two guards arrive together at a point, stop, give a brief salute wave to each other, chat, turn and go back to pacing. I thought that was at least minimally cool. But then, one of the guards got distracted and was behind the pace of the other quite a bit. Well, being a stealth game, I was fully comfortable sitting in the bush and watching. When guard B came back to the previous meeting point, once again he waved, just like he had when he had been face-to-face with Guard A. After the predetermined period of time, he walked off again. Who the heck was he waving to? My guess was that the “meeting point with wave” was either embedded in the map or, more likely was just part of the patrol pattern of that guard. This is based entirely on the premise that the patrol patterns were timed so that they would meet up. Nice try… but dude looked kinda stupid.

Machine Forgetting

Never mind “machine learning”… how about “machine forgetting?” The premise of a stealth game is that, if you arouse someone’s suspicions, they will investigate. However, if you go dancing around in the open and people see you, the gig is probably up. Not so, in Tenchu Z. Apparently, a little-known fact about ninjas is that they possesses the ability to perform the Jedi Mind Trick. (I link this only because I was startled that it had its own Wikipedia entry. Wow.) You can literally mow down half the compound, run around the corner, and all remaining sentient beings will cease to remember your existence. In fact, you can come up just short of killing someone and even he will forget from whence he received his wounds. It’s like someone spiked their sake with GHB.

Also, they don’t bother to really look for you in more than 2 dimensions. You can leap onto a roof in full view of an entire legion of samurai, and in 60 seconds they won’t even consider the idea that you could still be up there. If you crawl under a building in front of everyone, they can have the building surrounded but will refuse to bend over and look under the building. Oh… and then they will leave so you can get out from under the building that they had you completely trapped under. Spectacular.

Now I suppose that some of this may have been a design decision so as to make the game a little more accessible to the “Dragon Ball Z“/”Naruto” crowd, but it is so striking that it is laughable.

Sensory Stimulus?

I’m not sure exactly what they are using for a sensory system. There is a light meter that shows how illumnated you are. That would be an easy coefficient to apply to a detection rate after LOS has been established. You can move quietly which implies that sound transmits – but I’m not sure if it is just a strict radial decay or if there are environmental factors. Of course, rice paper walls transmit sound through them like a drum head. There’s some sort of “smell factor” which is probably also just a distance factor as well. I did get a kick out of how the guards are so demonstrative in their sniffing (you can fall into nasty stuff and smell bad until you wash it off)… but the doggies that occasionally appear in the game can’t track you in a freakin’ bush 2 feet away.


The combat animation is very schlocky. Maybe I’m just not good at hack and slash games on the console, but it quickly turned into a button mash for me since I wasn’t entirely sure that anything I did was more impressive than anything else. The actual contact of a sword stroke was vague and there seemed to be pre-defined kill animations that involved the positioning of both characters. Let’s just say you should stick with the stealth because the combat system is less than stellar.

The Solution?

When I started writing this blog, I wanted to make sure that I offered up solutions to problems that I noticed. However, I don’t know if that is in order here. One of the major improving points would have been to simply spend more time on it. There are plenty of resources available to get past these issues. Many of them could easily have been addressed.

It is at times like this that I wonder if I can truly blame the AI programmer. Again, as I mentioned before, it may have been a design decision that the experience was not going to be deep and/or challenging. It also may have been a production decision based on time and budget. I can’t think that it would have been based on available clock cycles since their graphics don’t look like they came close to taxing the 360. So… it either comes down to a low-priority item for them a sub-par effort by an AI guy.

Portal: Sometimes No AI Is Just Fine

June 28th, 2008

As much as I hate to admit it, there are times when no AI is perfectly OK. I finally got around to playing Portal last week. I figured I would find out what all the fuss was about. Like many people, I thought it was very amusing and disturbingly addicting. It held my attention. It challenged me. It made me mad at times. It made me feel triumphant at others. I was captivated by the characters (such as they are). And then it hit me.

The AI in the game was pretty much minimialistic. The computer AI was entirely scripted, of course. (But the commentary was more than entertaining.) About the only true “AI” in the game sense was the cute little turrets… and even those had about as much AI as could be found 15 to 20 years ago: an obvious state machine (idle, scan, fire, scan, idle), and some ray casting. And yet the cute little buggers were a perfect match for the game in which they were placed. (A first-person version of Peggle? *shrug*)

And that is my observation of the AI of Portal. Almost non-existant… yet perfectly matched to the game. Anything more would have been distracting away from the main charm of the title.

Well done, folks.

Web site troubles… new posts coming!

May 9th, 2008

Ok folks, I know this is getting old. I have been having horrible problems with my ISP since early April. I won’t name the ISP yet, but you can look it up for yourself, I suppose. I have been with this company for 6 years and things started fairly well. However, in recent years, especially since a buyout, things have been a little more dicey. Well, this latest issue has to do with a server move gone awry. If the issue persists, I won’t hesitate to name them… at about the same time as I go shopping for a new ISP – something I don’t want to have to waste time doing.

Because the site has been up and down for 5 weeks, I’ve been a little hesitant about posting. I have plenty of material I want to put on IA on AI and have been wanting to start putting some new observations on here. I have been assured that the ISP issue will be solved soon (although I was told that over a month ago). However, I think that I may just start writing some of this material anyway. Since I use Blogger, everything is stored on their site first anyway. It wouldn’t take me much to republish if I were to lose things.

Anyway, for those of you who have been checking the blogs and finding only errors, I apologize. I appreciate your loyalty nonetheless.

Thank you,

Dave Mark

Bioshock interview and Civ 4 notes

February 28th, 2008

Ok… this is kind of a Post-Play’em article. Check out my taped GDC interview with John Abercrombie, AI Lead on Bioshock over at IA on AI.

As I play further into the game, I will eventually post actual play observations. My interview has kinda spoiled the purity of my game experience, though. I know what to look for!

Also, I have posted my notes from Soren Johnson’s GDC lecture on the AI of Civ 4. It doesn’t get hardly at all into the actual mechanics of what they did (which I plan on doing in my Post-Play’em later) but rather covers how he tried to position the AI as somewhere between “good” (real) and “fun”.

Stay tuned for the actual Post-Play’em on that one!

Civ 4 and Bioshock updates

February 11th, 2008

A month ago, I mentioned that I was going to be doing analyses of Civ 4 and Bioshock. Well, I have decided to wait until after the GDC next week. The reasons are clear…

1) I will be attending a lecture at GDC by none other than the man behind the AI on Civ 4, Soren Johnson entitled Playing to Lose: AI and “CIVILIZATION”. From the description of the session:

Artificial intelligence performs a crucial role for any strategy game, providing a compelling opponent for solo play. While many of the challenges of AI development are technical, there are also significant design challenges as well. Can the AI behave like a human? Should it? Should the game design be adjusted to accommodate the limitations of the AI? Should the AI be exposed to modders? How do we make the AI fun? Should the AI cheat? If so, how much? Do we even want the AI to win? [...snip]

And from Soren’s own blog, “Designer Notes” on a post entitled “A Farewell to Civ”:

Essentially, I will be talking about the difference between thinking of the AI as the player’s opponent and thinking of it as simply an extension of the core game design (what one might call the difference between “good” AI and “fun” AI). There will also be a long section on AI cheating – the bane of my existence for many years – concerning which type of cheats are acceptable to players and which type are not, using Civ as an extensive case study. Further, I hope to prove that, for Civ at least, there is no such thing as – and never could be – a “fair” difficulty level where the AI is playing the same game as the human. Your mileage , of course, might vary.

Given that I will be getting a peek into what he was actually doing in the AI design, I don’t want to stick my neck out and make comments about how wonderful this or that was and find out that it was either unintentional or cheating. That would be embarrassing. Also, I’m hoping to have the opportunity to interview him – or at least hang out with him to some extent. That would provide a lot of great material for a Post-Play’em entry.

2) On a similar note, I received this email a few weeks back under the subject of “Bioshock on Post-Play’em”:

Hey Dave,

Cool blog (both of ‘em). I’m waiting for the Bioshock review though… curious what you think. :)

See ya at GDC (?)

John Abercrombie (AI Lead on Bioshock)

Oh yeah… that wasn’t even remotely intimidating!

I’ve talked to John a bit since that point… he’s actually really cool about the whole thing. It’s not like I was planning on ripping his work apart anyway. I’m actually quite impressed with some of the things I’ve seen in the game so far (I’m still not terribly far in.) We are planning on getting together for a while during GDC. I’m very much looking forward to meeting him and talking shop. In fact, I hope to pick his brain a little on some of the much heralded AI in the game.

So that’s what’s holding me back on doing those two games right now. I hope to be giving you some juicy tidbits… if not next week during GDC, then possibly the week after I get back. Remember to keep an eye on the IA News blog next week as I report from the GDC and let you know all the nifty stuff I see and do (complete with pictures!).

… if I make it home without going into a coma. What a week GDC is!

First Encounter with F.E.A.R.

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.


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)

Driving Crisis in Crysis

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.

Upcoming reviews – Bioshock and Civ 4

December 28th, 2007

In the post-holiday mode, I have been playing through Bioshock and Civilization 4 (“Warlords” expansion). I plan on doing a post on each of them in the near future. Civ 4 especially has me intruiged since I spent way too long playing Civ 2. Also, at the 2008 GDC, there is a presentation on the AI of the Civilization series that I plan on attending – so this is research, right? :-)

Make sure you check back – or better yet, make sure you subscribe to the RSS feed so that you can keep up with whatever I am doing over here at Post-Play’em.

In the mean time, if you are an AI fan, make sure you check out my other blog, IA on AI for news and commentary on the world of game AI. (It wouldn’t hurt to subscribe to that one either!)

Add to Google Reader or Homepage

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