Friday 25 April 2014

In depth: Why aren't our enemies smarter? Gaming AI's problem of smoke and mirrors

In depth: Why aren't our enemies smarter? Gaming AI's problem of smoke and mirrors

Creating the illusion


Visit any gaming forum and it'll no doubt be inundated with players complaining about the same thing: "A.I is rubbish". These days the inclusion of perfunctory artificial intelligence is pretty much a given, a tick box for ticking, but only when it goes awry do people start giving it any real attention.


Irrational Games made grand announcements about AI buddy Elizabeth prior to Bioshock Infinite's release. Ken Levine drew comparisons between her and Half Life 2's Alyx Vance, who he feels was the last great AI companion. If it's been nine years since the last great hope of AI-kind, is it stagnating or did everybody just decide to stop caring?


Elizabeth doesn't burden the player like so many ill-fated escort missions, and even actively helps, but it still didn't feel quite right. Ultimately she's a phantom who's invisible to the very enemies that she and Booker are fighting or hiding from. Is AI actually still lagging behind, do gamers just like to moan a lot, or were those games fondly remembered for being so taut actually haunted by ghost of nostalgia?


Alex Harvey, the mind behind upcoming surrealist stealth game Tangiers, believes much of the existing groundwork is sufficient for AI with the help of some smoke and mirrors. "It was around a decade ago that a fairly solid minimum viable product was established for video game AI," he tells us.


"You reach the tipping point of Halo or F.E.A.R. where quasi-squad tactics are implemented to great effect. Does AI really need to be better than F.E.A.R. to give a good gameplay experience? There's a close threshold where you're wasting your time over-complicating things, you create an intricate architecture that achieves little more than smoke and mirrors would."


Artificial expectations


That isn't to say we're 'there' in terms of what it is possible to do with AI. Far from it, in fact. But University of Lincoln games design teacher and game developer Sean Oxspring just feels the level of acceptability hasn't changed much.


"Most 'new' AI in games is just cleverly faked and nowhere near as groundbreaking as people make it out to be. Buzzwords like 'neural networks' are far less complicated than they sound - they're essentially flowcharts with multiple actions that AI agents follow based on things going on around them."


Age of Empires


The reason for this nostalgic perception that AI was somehow better at the turn of century is tied to technological breakthroughs, many of which seemed to begin to be taken seriously at the same time. "Tactical games like Age Of Empires needed to take on board path-finding techniques like A* whilst also developing systems to make computer controlled players actually appear to play tactically," says Sean." It was starting to be taken seriously as a vital part of the game design process."


The A* search algorithm is one of the most widely used forms of pathfinding. In its simplest sense this is where all routes are calculated in a grid system via a point score, the 'lowest' score determining the shortest route. Think of it like traversing to the other side of a mountain range in Civilization, but performed hundreds of times per second by any given enemy.


Adapt, engage


While Ken Levine might prefer Alyx Vance, both Alex and Sean believe the most engaging AI experiences come through rewarding and reacting to a player's own intelligence, providing the player with a well-earned sense of agency. Sean's favourite AI comes in the form of freeware 2D shoot 'em up Warning Forever. "It's got a simple AI behind it that adapts each new boss you fight to make it harder for you. It's really interesting to watch it adapt to different peoples play styles and I love watching people playing it."


Warning Forever's stream of bosses adapt to your style of play


Alex feels authenticity is irrelevant if masked correctly, and recalls an encounter that really resonated with him in STALKER: Call of Pripyat. "I came across a party of Stalkers affiliated with my faction. They've just been ambushed, I step in, the valuable reinforcements that save them. Heading to a mission, I notice a little glow on top of a water tower. A little incidental detail I thought, a group setting up camp for the night in a safe location.


"In the middle of the mission and things have gone wrong. Surrounded by incoming hordes of mutants, I'm starting to run low on ammo and health. Then a group of stalkers runs to my assistance. It's a tense battle, one of them dies. I look up and recognise my new allies. They're the group that I'd saved a few days prior. A wonderful emergent moment that wouldn't have hit with such power if it was executed in a manner that was even remotely scripted."


In hindsight, it might not have been based upon past events, but the presentation is just abstracted enough that you can fill in the gaps. Whether fully authentic or not, it was a perfect execution of a life-like, engaging AI."


Despite its criticisms, at one stage Thief's enemy AI was apparently too smart, or as director Nic Cantin put it, "too realistic". Alex sees perceived dumbness of AI as not necessarily detrimental.


"With good AI, the goal isn't actually to make it smart per-se, but to make it engaging and to provide an illusion of such. If a shoot-em-up pits you against military engaging in actual small unit tactics, obviously you wouldn't last two minutes. Fending off a theatrical, clumsy flanking attempt is always going to be more fun to the average player than dealing with AI that can play chess."


Where do we go from here?


The fallibility complex


Sean also sees player cues and AI fallibility as essential. "Difficulty is a difficult thing to get right. It's often the case that games have to add in audio cues when AI controlled enemies do things in order to help the player understand what is going on. Having a character yell 'I'm gonna flank him!' is generally a good way to make the player realize what is going on.


"You need to consider adding in the chance for the AI to make a mistake - even if it's something as simple as handicapping an enemies projectile accuracy. Making an AI look like it's made a genuine mistake without having the player think it's broken is very hard. I think making mistakes is a genuinely important part of a good AI enemy


"Subtlety is also key - having a character behave realistically as if they aren't just always waiting on the player to trigger an event. Things like running ahead of the player – Elizabeth in Bioshock Infinite – or exploring the environment autonomously – the Dog in Fable 2 – really give off an impression to the player that the game world isn't just all about them."


FEAR


As for Alex working on Tangiers, he faced a similar problem to Eidos Montreal had with Thief and created what he calls a 'smug system'. His AI was just too good.


"Rather naively, we went very overboard in our first attempts at this, aiming for an incredibly smart, analytic approach. The AI would break down the environment, assessing and cross-referencing the characteristics of space, the relationships of space and any existing audio/visual clues as to the player's location, in order to determine the player's likely location.


"From the player's perspective, the AI would just hone in. Nine times out of ten, the AI would correctly determine the player's location - the stealth loop was degenerated down to pot luck. To fix this, we kept the idea of the system but abstracted it, and added inefficiencies.


"Take F.E.A.R. It was great to have the AI actually flanking you, moving to strike you from the side while you were pinned down. Except that the AI didn't actually do that. There was no flanking behaviour within the AI, just a blend of more predictable behavior and savvy level design. Give the player time and a gameplay loop to engage & interact with. Implementing a genre-appropriate version of that clumsy FPS flanking manoeuvre."


Looking to the future, Sean wants the NPC to take on a role that betters the player's experience as well as its own.


"More simulated agents and more complex decision trees for NPC characters. I'd like to see more complex interactions between AI agents themselves. What I'd really love to see is a game where the NPCs themselves have goals, 'emotions' and ambitions - they then procedurally generate quests for the player in order to further their own goals.


"For example a baker wants to kill someone they dislike - so they give the player a quest to deliver some poisoned bread to their target."


In a similar vein, Alex wants to see AI progress towards creating more intricate emergent experiences, the sort of encounters to make for campfire stories like his helpful band of Stalkers, and getting the AI to perform the same ridiculous exploits as DayZ's humans. "AI that isn't just capable of functioning in a systemic environment but that takes advantage of it and transforms the player's experience."

















No comments:

Post a Comment