AI Follies: Interesting Behavior

By Shamus Posted Tuesday Aug 18, 2009

Filed under: Programming 32 comments

Here are some thoughts on the goals of an AI programmer, which should have gone at the beginning of this series. Let me put them up now before we go any further.

My first computer (which you can read about here) was the Tandy MC-10. 4k of memory. Less than a single megahertz of speed. Once I got my programming legs under me, the first thing I tried to do was make a game clone Pac-Man. For reference, here is what the original looked like:
Continue reading ⟩⟩ “AI Follies: Interesting Behavior”

 


 

Team Fortress 2 Update

By Shamus Posted Monday Aug 17, 2009

Filed under: Notices 24 comments

Apologies all around to everyone. I heard there was a TF2 update. Normally when this happens, I just need to log in, poke the “reboot” button, and it sorts itself out. The update is completely automated. People kept sending me emails: “Hey Shamus, there was a TF2 update. Sever needs a restart.”

I’d restart it, and wander off. Then the next day I’d get another email, “Hey Shamus, there was a TF2 update. Sever needs a restart.”

Wow. Another one? Okay then. *Poke.*

This went on all week until I actually looked into it this morning. Turns out the server wasn’t needing an update. It HAD updated, and was now crashing. The new version conflicts with SourceMod, which does… some thing important relating to administrating the server that I can’t quite remember at the moment. From the SourceMod forums:

It sounds like Valve changed engine headers without a public beta, without describing the changes, and without an SDK change.

Boo. I’ve disabled SourceMod and I’m in the process of restarting everything and checking it this time.

Thanks again to everyone who donated.

 


 

The Path

By Shamus Posted Monday Aug 17, 2009

Filed under: Game Reviews 50 comments

thepath1.jpg
It’s common knowledge that our children’s fairy tales descended from older and significantly darker stories. Cinderella and Sleeping Beauty had already been Disney-ified once before Uncle Walt ever attempted them.

The Path is an indie game from Tale of Tales. (Not to be confused with Telltale Games.) It goes back to the original stories of Little Red Riding Hood and turns them into a series of disturbing interactive adventures. It’s survival horror, but without the “survival” part. (Maybe.)

When I say “survival horror”, note that I’m talking more about Silent Hill and less about Resident Evil. In fact, The Path is about as far from the narrative of Resident Evil as you can hope to get. You might have trouble understanding The Path because it’s open and ambiguous, while you might have trouble understanding Resident Evil because it was written by drunken chimpanzees. The Path is subtle, unnerving, playful, and full of imagery. This is not a game that tries to scare us with tentacle zombies popping out of closets. This is a game that tries to scare us by showing us the parts of life that usually go unregarded. A lot of games tackle the question of “can games be art?” The Path seems to be asking, “can art be a game?”

thepath2.jpg
In the game, you will guide six girls along the path to grandma’s house. The youngest is the six-year-old Robin. The oldest is the seventeen-year-old Carmen. The game instructs you to “stay on the path”. You can do this, and arrive at grandmothers without incident. Or, you can actually play the game. Leaving the path will lead the girls to their adventure, but also to their undoing.

The events you see will be “open to interpretation”. You can view it as a painful journey of children brushing up against the adult world. Or you can take a literal approach and see it as a game where you steer six girls into situations where they are possibly molested, murdered, menaced, or raped. There’s no blood, no nudity, but both violence and sex are alluded to, so don’t go buying this for your kids just because it has Lil’ Red Riding Hood.

thepath3.jpg
When I was a kid, I found the adult world terrifying. Men were immense hairy beasts. Women were less physically daunting, but their forms had some sort of inexplicable power over my mind. Adults seemed grim and joyless, and their stories were blood-soaked tragedies. (This was particularly true in the 70’s, when movies with happy endings were seen as things for Plastic People. You know what I’m saying, man?) Even their comedy was mean and hurtful. (I remember recoiling at the blood in Holy Grail. Oh! That poor historian! Is he going to be okay?) Cigarettes, alcohol, cars, heart attacks, jobs. Everything in their lives seemed strange and threatening. I hated the dullness and stupidity of school, but even more I dreaded the day when it would end because what came after seemed to be so much worse. The Path found those long-forgotten ideas laying around in the back of my mind, and woke them from their decades-long slumber. For a moment I was able to be an adult seeing myself as a kid picturing myself as a grown-up. The game reached into my childhood and played with old fears that never even had a name.

thepath5.jpg
I live happily in the adult world now, and I’m a lot more content at thirty-seven than I was at aught-seven. But The Path reminded me of how scary and mysterious this adult world looked to my seven year old mind. I found myself connecting with the girls, even as I led them to foolishness and ruin.

I hate to say too much about events that unfold in the game, because to relate them is to interpret them, and I don’t want to impose too many of my impressions onto your experience. I went into the game with very little idea of what I would find, and so I found a lot of myself in it. If I’d read an overview I might have gone in expecting more and getting less.

thepath4.jpg
The controls are interesting in their near-absence. (I’m using a gamepad, but it also supports the mouse & keyboard duo of old.) You move your character. You look around. Press a button to run. There’s a button to see what items you’ve collected, but it’s not really an inventory. You don’t get things back out. It’s more like a scrapbook of strange crap that you’ve found. And that’s it for the controls. To “interact” – to do something besides walk around – you need to stop giving input. You steer the girl to some remote place, far off the path. Then you simply let her go and see what she chooses to do.

If you’re like me and you’ve been lamenting about how games have been stuck in a rut of boilerplate storytelling and carbon-copy gameplay, then you owe it to yourself to check out The Path. I don’t give the game my full endorsement as a game, but I give it full marks for having a bold vision and running with it. It’s innovative, unique, and it’s only ten bucks.

 


 

Mario AI

By Shamus Posted Saturday Aug 15, 2009

Filed under: Movies 21 comments

In keeping with the series on AI, here is an interesting project: Mario AI Competition, a competition for people to build the best Mario-playing AI possible. Here is one of the entries:


Link (YouTube)

Here is the project page for the particular AI featured in the video.

The Mario game itself is a procedurally generated infinite level. John Funk likened this to putting a slinky on an escalator.

Interesting stuff.

 


 

Experienced Points: Mod’s Playground

By Shamus Posted Friday Aug 14, 2009

Filed under: Column 45 comments

This week’s Experienced Points is a bunch of gushing about the Fallout 3 mod scene and how much it rocks.

For the curious, my current Fallout 3 play-through is as follows:
Continue reading ⟩⟩ “Experienced Points: Mod’s Playground”

 


 

Stolen Pixels #116: An Existentialist Crisis

By Shamus Posted Friday Aug 14, 2009

Filed under: Column 11 comments

I’m now playing games faster than I could ever hope to review them. I used to have to make each game last for six weeks, sometimes more. Now I have to change titles every other week in order to feed the comic mill. This is good, because it means I get to play a lot of games.

But it’s also bad, because some games will get played without being reviewed. Today’s comic is basically my entire review of MadWorld. It’s a competently executed effort, more or less killed by a single idiotic (and easily fixable) design decision. I got about halfway through the game and realized I was tired of the looping announcer messages, tired of doing the same thing over and over, and tired of indecipherable two-tone images. Alas. The game had a few promising notions and a lot of voice talent, but those attributes can’t rescue fundamentally broken gameplay.

EDIT: Too bad I didn’t write a review. I never got the chance to describe the graphics as “urine-soaked line art”.

Oh wait, I just did.

 


 

AI Follies: Detection

By Shamus Posted Thursday Aug 13, 2009

Filed under: Programming 48 comments

Inasmuch as the bad guys are a part of the program you’re running, the bad guys always know where you are. The game knows where you are in the same way that a puppeteer knows where the puppet is. Your position in the game is just another variable it’s constantly tracking as part of running the show.

But unless you want every bad guy to begin homing in on the player the moment the loading screen vanishes, you need to pretend you don’t know where they are. Detection is the system of deciding when to stop pretending you can’t see them. By default the bad guys can draw a bead on the player and ding them between the eyes at an unlimited distance the instant a clear shot becomes available. AI is used here not to make the foes more potent in combat, but to make them less so.

This usually begins with line-of-sight checking. Calculate a line from the AI in question to the player. If that line hits (intersects) anything before it gets there, then something is in the way and obstructing the AI’s view of the player. A LOS check used to be kind of a big deal, but these days they’re generally considered to be an inexpensive operation. Still, there is a cost to doing the check and thus an upper limit on how many you’ll want to do a second.

Sounds easy, right?

That’s the state of detection as it existed around Wolfenstein, but once you’re dealing with complex 3D environments with varying light levels and trying to make believable enemies things get really hairy. The goal of your AI is to not make a fool of itself by being too perceptive or not perceptive enough. Nothing will distance a player from the game and break immersion like having a bad guy perfectly track them while they are completely hidden behind cover, or see them a half mile away. In the initial post in this series I mentioned AI bad guys that had “super-senses”. Counter-intuitively, super senses are the result of exceedingly stupid AI. In effect, it’s too dumb to know it shouldn’t be aware of you yet.

Complex occlusion:

That LOS calculation we talked about a second ago is fine for simple scenarios, but it falls apart quickly in anything less than a barren cube-shaped room. What part of the player is the bad guy trying to look at? Sure, you project the line from the bad guy’s eyes, but where does it go to? The player’s eyes? If so, then you end up with the hilarious “I can’t see you so you can’t see me” logic. If you’re standing in the open but you have something hiding your eyes, then you’ll be invisible to the bad guys. Picture Chris Farley hiding behind a lamp.

So, the AI needs to do several LOS checks to various parts of your body. It needs to be able to see the top of your head poking up from behind the couch, your legs sticking out from behind saloon doors, and your shoulder poking out from around a corner.

Field of View

Obviously AI should not have eyes in the back of their head, and there needs to be some limit on how far they’re allowed to see. Generally, you see quite far and in great detail directly ahead of you, but this high level of perception falls off quickly at the corners of your vision. (The edges of our vision see mostly motion and colors and changes in brightness, and aren’t very good at picking out shapes.) People are also generally very bad at looking up or down, and their vertical vision can often be even worse than their peripheral vision.

Now, most people intuit all of this, even if they don’t know it. We usually have a sense of when other people should be able to see us, and deviations from these expectations are jarring. AI that can detect an unmoving player out of the corner of his eye at fifty meters feels like a rotten cheater. An AI that only sees a 90 degree cone in front of him feels like a bumbling moron. (Although the latter is often forgiven for the sake of being sporting. Because they’re viewing the world through a monitor, the player can only see a ninety degree cone themselves.)

Light Changes

This has become more important since the introduction of HDR lighting in games. It’s now possible for the player to be blinded to areas with vastly different light levels. If you’re standing in the sun, you can’t see into the dark train tunnels. If you move to the tunnels, the area outside becomes too bright to make out. Players expect these restrictions to apply to AI.

But this one can get really tricky, and I don’t think a game has done it right yet. I first raan into the problem in Thief, when I’d crouch in a doorway. I’d be in darkness, but the room behind me would be well-lit. The guard in front of me should have spotted me instantly. In real life, it would be safer to stand in the lit room than to stand in the dark with the light directly behind me, forming a perfect back-lit silhouette. Eventually players learned to rely on the visibility gem instead of their common sense to judge how visible they were.

I suppose it would be sensible to extend any LOS check that succeeds. That is, if we draw a line from the bad guy’s eyes to (say) the player’s shoulder and it actually hits, we then continue to follow the line until it hits something. We can then compare the light level of the player to the light level of the thing stuck, and have any variance in those values count against the stealth rating of the player. This sounds reasonable, but I suspect that we’d see the failure modes move to somewhere else if we did this. Definitely one that requires more thought.

Camouflage

Just because the LOS check passes doesn’t mean the AI should truly “see” the player. If I’m wearing camo and crouching in the underbrush, it feels very unfair to be spotted by the AI. However, if I’m just behind some furniture it feels perfectly reasonable to be spotted.

So the LOS check needs to do more than just figure out if I’m visible. It needs to examine what sort of things are obscuring me, how much of me is visible, how much I should blend with those things, and if I’m moving. This is complex and it requires that your artists get involved with the AI system by tagging objects according to how camo-friendly they are. A fern? Very camouflaging. A beach umbrella? Not so much. I’ve never run into a game where I thought this was done well. In Crysis, the enemies sometimes had foliage-penetrating X-ray vision, and being spotted while sitting still in a thicket is no fun.

Subjective Perception

This is the most complex one, and the most annoying to players. Generally soldiers don’t immediately begin shooting to kill the moment they see someone milling about in the distance. There is nothing more tedious than the army of clairvoyant soldiers who can tell friend from foe at two hundred meters with enough certainty that they are willing to shoot to kill.

However, if I’ve already gunned down half the guys in their base then I do expect this level of paranoia from the AI. Uh, unless there is no way for this particular bad guy to have heard about the attack, in which case he should go back to be more curious than trigger happy. Unless he’s heard shooting. Or he’s spotted me in a forbidden area where only an enemy would go. (I think it’s fair to assume that anyone coming out of the sewers or air ducts is a troublemaker. (Unless there are civilians around.))

Aren’t you done with the AI yet? We’re going gold in a few weeks.

Having these systems fail is often worse than not having them.

In one of the Cat in the Hat books, the story features a red mess that the kids keep trying to clean up. Each attempt to do so just ends up moving the mess from one place to another. I’m sure this was an environmental message of some sort, but it’s a nice metaphor for the problems that AI programmers are up against. Every time you try to fix a hole in the AI you just move the failure mode to a new situation. Adding better complex occlusion just makes the field of view problems stand out. Fixing those reveals the problems with camo. Fixing that (if you can) will expose the shortcomings in subjective perception. And so on.