FEAR, HL2, AI, and only doing cool stuff when the player is looking

(gravis did a comment on my FEAR post so long he made it a post, and now I’m doing that with that post, and this ends up being about all kinds of things)

Half-Life 2 (and maybe 1, but I don’t think so?) had a trigger type called trigger_look, which was like a regular trigger, but it only executed if you were both standing in the trigger and looking at the specified entity. They used it heavily for Gman stuff – in HL2, if you walk backwards into an area you’re supposed to see the Gman in, and then turn around, that’s when he straightens his tie and walks away, he only does it if you’re looking.

I remember thinking this was incredibly cool at the time, and it was, not for the ability to do that check necessarily, but for exposing it to level designers as a trigger type – a coder at Valve saw the problem of “player isn’t looking when the cool thing happens” and provided LDs (who were the ones making all the scripted sequences) with an easy way to say “wait til the player’s looking, then do it”. It’s a level of facilitation by code of LD that, these days, you’re surprised (and often pathetically grateful) when you see it.

HL2, while I have my issues with it, was a rare case of a sequel seeing a lot of the core concepts that worked in the first one, which are hardly ever the ones that players notice, and digging deeper into those. The “do cool thing only when player is looking” stuff is everywhere in HL2 – if an NPC’s bullet is going to miss its target and hit an explosive barrel, only do that when the player’s gonna see it, otherwise the player doesn’t know why the thing is on fire. The fast zombie only leaps at you when you’re looking at it. The Strider only fires its big alt-fire cannon when someone’s gonna see.

While the AI in HL2 was, for me, a big miss (and I did a youtube video about it) this “look trigger” stuff is, I reckon, a big piece of the oft-neglected puzzle of making game AI feel smart, a goal which I’ve come to reckon is basically at odds with how most games are produced (at least beyond indie, indie being usually not where a ton of AI work gets done).

There are a ton of games, real expensive AAA games, with what you’d call, if you were a person who writes AI, really good AI, but players don’t note the AI, and have no stories to tell about it.

The last two Splinter Cell games are like this – the AI is doing cool, impressive things, and nobody is impressed; it comes across as serviceable. Nobody says it’s bad, nobody says it’s good. But the very first time you play a level of those games, you are impressed. You’re impressed when you’re hanging off the side of a building, and an alerted guy who thought he saw you running towards the window a second ago actually bothers to stick his flashlight out the window and check the side of the building. That’s incredibly cool, the first time. It stops being cool the same mission, because they do it constantly, even if they never find you there. Suddenly we’re living in a world where the outside upper wall of a multi-storey building is the first place you look for an intruder. Everyone knows that!

The issue is rarity: behaviours are cool because they’re rare. AI looks smart when it deals correctly with an unusual situation. Like in FEAR, the way a scared soldier who’s the last in his squad will throw himself onto his belly to crawl under a truck, and this only happens when there’s a scared last guy in the squad and he doesn’t think you can see him and there’s a truck. You can easily never see this happen!

But the way big games are produced, if a thing is cool, it cost money, it continues to cost money to keep it working, and you better justify that investment by putting the Thing on the screen whenever you can. What’s the point if nobody sees it, right? But actually, what’s the point if everyone sees it all the time.

I reckon the best approach to making smart, reactive-feeling AI in a real-time game that people relate to, remember, talk about, get freaked out by (especially, but not necessarily, in an action or horror thing) is to really budget and stagger out your cool behaviours, the way some of your smarter games will handle dynamic dialogue (eg Left 4 Dead) such that they’re genuinely rare – one-offs, even – and making sure that when they do execute, they have the player’s attention. There was a pre-release interview about Half-Life 2 where some dev said the zombies were so smart, they could encounter a locked door, punch out the little window in the door, reach through and unlock it from the inside. That didn’t ship, but imagine if it did, and then they made it super unlikely? Wouldn’t that be the coolest fuckin’ thing that ever happened to you?


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *