Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Inside F.E.A.R. 2's Engine and AI

Soulskill posted more than 5 years ago | from the our-robot-overlords-will-arise-from-FPS-bots dept.

Games 34

Gamasutra sat down with software engineers from Monolith Productions to discuss the technology behind F.E.A.R. 2: Project Origin, due out in February. They provide insight into the development of the game's engine, and they discuss the goals and procedures behind creating entertaining AI. Quoting: "For instance, let's say that the AI wanted to kill the enemy. That would mean that there are a whole bunch of actions that satisfy the requirement for there being a dead enemy; let's say, 'Attack with ranged weapon,' right? ... Where the power comes from is the fact that those actions themselves can have conditions that they need to have met. So, 'attack with ranged weapon' may have conditions that say, 'I have to have a weapon, and I have to have it loaded. Go find me more actions that satisfy those requirements.' ... at that point, he may find another action, which is 'go to this weapon,' and then he may find another action which is 'reload your weapon.' So, that whole chain that I just described to you, of him doing three things in a row — which is going to pick up a weapon, loading a weapon, and then going to attack the player — that was not a directed thing that the level designer, nor that the AI engineer had to program; it was just the fact that we have these aggregate actions that the planner can pick from at will.

Sorry! There are no comments related to the filter you selected.

Um.... (0)

Anonymous Coward | more than 5 years ago | (#26185865)

FEAR and it's expansions all sucked. Sure the first 15 minutes were good, but that's it... why would I care about FEAR 2? the two x-packs for FEAR 1 were just copypasta of different parts of FEAR 1 maps.

FEAR 2 had better be amazing, because I really don't see me buying it unless it's actually rather good. (Or I could just pirate it. hehe.)

Re:Um.... (2, Informative)

Kneo24 (688412) | more than 5 years ago | (#26186085)

The expansions weren't done by Monolith, but Time Gate Studios. FEAR 2 will be the real sequel.

Not hard to program that kind of thing. (1)

mind21_98 (18647) | more than 5 years ago | (#26185911)

Really, it's a graph that you create a topological ordering from in order to execute the correct sequence of actions. The cool part is seeing the end results of that sort of thing (and what algorithms and AI can do), not the exact implementation details. Although, I guess they're doing all this faster than real-time, so that's cool, too. *shrug*

Re:Not hard to program that kind of thing. (1)

DirtySouthAfrican (984664) | more than 5 years ago | (#26185993)

AFAIK, this is essentially the script paradigm of AI, which is fine to augment intelligence (we do it all the time), but without learning, it is quite expensive, and susceptible to the Chinese Room argument.

Re:Not hard to program that kind of thing. (3, Insightful)

Dutch Gun (899105) | more than 5 years ago | (#26187843)

AFAIK, this is essentially the script paradigm of AI, which is fine to augment intelligence (we do it all the time), but without learning, it is quite expensive, and susceptible to the Chinese Room argument.

I can only speak for myself, of course, but I never had any qualms about simulating intelligence artificially (aka Chinese Room Argument [wikipedia.org] ). Games are, and will be for the foreseeable future, a very limited domain problem, which in turn calls for a domain-specific solution. The notion of whether an AI is actually "intelligent" or "aware" is so far removed from the reality of today's game development, it honestly has never even crossed my mind.

In some sense, the notion of AI in regards to game development is almost a bit misleading. Game developers are not interested in programming artificial intelligence, only replicating its behavior using any practical method available. Don't forget, we're also constrained by CPU power and a real-time environment. If a simple state machine with directed goal-oriented pathing is enough to simulate human-like intelligence in a combat-focused game, then we'll be happy to stop there.

Re:Not hard to program that kind of thing. (2, Insightful)

Anonymous Coward | more than 5 years ago | (#26186003)

On the surface they face a "simple" action planning problem. What the summary describes is what a simple SCRIPS-based planner would do. This would be an intro-to-AI type of a problem that any CS student taking an AI class would deal with.

The major difference from an intro-to-AI type of a problem here is that the environment is dynamic. Thus goals that might have been achieved just a few steps ago may now no longer be, and vice versa.

Suppose your planner has executed a couple of actions that have reached half of your sub-goals. Now, due to environment changes, only a quarter of your sub-goals remains. Heck, some external environment changes may actually be productive and add to your reached sub-goals -- say if your enemy got into your firing range, you don't have to chase him anymore.

It's much harder to generate reasonable, much less optimal plans when environment changes -- the planner needs to be quite more complex. It's a current research topic, and has been for a while.

Cheers, Kuba

Re:Not hard to program that kind of thing. (5, Insightful)

Dutch Gun (899105) | more than 5 years ago | (#26186629)

The major difference from an intro-to-AI type of a problem here is that the environment is dynamic. Thus goals that might have been achieved just a few steps ago may now no longer be, and vice versa.

Actually, unless you're talking about an "intro-to-AI" class at a game development studio, I'd venture to say that the primary difference is that game development AI is ultimately a much more pragmatic affair than academic research (although naturally, good developers try to use whatever knowledge they can glean from any source available). The ultimate goal of the AI is to make the game fun for the player to play against, while operating on only a small, real-time slice of the total CPU budget. It's an important distinction to make, and it often answers the question of "why don't they use x or y techniques?" Game programming has real-world problems and constraints, and it's important to be able to peek into an AI brain and understand exactly why some behavior may or may not have been working exactly why you'd expected it to. But it's also perfectly acceptable to alter the world itself in order to enhance the AI (and indirectly, the player experience), something that traditional AI research would typically not consider.

Boiled down simply, yes, this is a dynamic graph traversal problem. I've used systems like that before in games I've worked on to execute intermediate goals, although nothing quite like this. The large problem is not the planning - it's actually perception that's really hard for an AI to do. The article discussed this when talking about the artists having to pepper the level with AI hints. For instance, how does a computer analyze the best location for cover? Typically, it's been a level designer that places tens of thousands of hint nodes all throughout the game to mark points of interest for the AI. I used a node-based approach in a brawling game I worked on, and these nodes would interact with the game engine to convey all sorts of information to the AI. As the environment was dynamically altered, these nodes (which doubled as both pathfinding and status communication nodes) would indicate to the player what was happening in the world.

For instance, a bridge would start shaking as though it were about to collapse. Via the level's automation system, the nodes on which the AI was standing would switch status to "danger", and the AI would know it's top priority was to move off that node. Alternately, pathing nodes could be dynamically switched on and off in order to deal with obstacles in the world coming and going. The AI would continuously re-evaluate the path to the target in the background, based on higher-level goals, so it would just naturally move around obstacles and find alternative paths to other entities, or would alter goals altogether.

So often, there's a whole set of systems built specifically to communicate information to the AI in a non-visual way. Game developers are starting to integrate these sorts of systems at a deeper level into the game engine, so that its simpler to build on top of these low level core systems, and execute more advanced tactical planning. This way, for instance, instead of a scripted event that must be manually hooked up to these informational notes, you can allow the physics engine to alter the world, and the AI will react naturally to that - not just in pathfinding, but perhaps the altered terrain provides new tactical possibilities. From there, it's great to see interesting emergent behavior come out of the simple building-blocks you've put together. The coolest thing for an AI programmers is to see players infer much more about an agent's behavior than you ever programmed into the game.

I have to admit, I do miss AI programming. It's a really exciting field that I believe is going to gain more prominence in the public eye in the future (we're seeing it already in Left4Dead) as game developers look for ways to differentiate their games from their competitors, especially as graphical quality approaches its limits on the current platforms. I can definitely see those extra cores on current and future platforms being put to good use. I would have loved to have this on the last gen of consoles.

Re:Not hard to program that kind of thing. (0)

Anonymous Coward | more than 5 years ago | (#26186737)

STRIPS.

Alternatives? (0)

Anonymous Coward | more than 5 years ago | (#26185923)

I guess I'm not seeing where there are a lot of alternatives- its fight or flight really. Do they really have code that says "Am I hungry, if so go to a Wendy's. No Wendy's close by? Find transportation. Can't open car door? Look for keys in nearby office...whoops I've been shot in the head."

Awesome (1, Insightful)

Anonymous Coward | more than 5 years ago | (#26185965)

Wow, this is how far we've come with game AI? I've been doing more elaborate things in CLIPS forward and backwards chaining in my AI class.

Re:Awesome (0)

Anonymous Coward | more than 5 years ago | (#26188437)

Re:Awesome (4, Insightful)

BitZtream (692029) | more than 5 years ago | (#26188691)

As someone who's dabbled in designing a game engine, this sort of things always sound like no brainers. Then when you get right down to implementing them in a game and making them actually fast enough to keep the game real time, you realize that a lot of cool ideas that can be used to make things more realistic from a simulation perspective are no feasable with the processing power available.

Lets face it, while Zork was awesome in its original form, if the processing power was available to do 3d graphics at the time, they probably would have done so. But it wasn't. Nor was the capability to do graphics anything even remotely comparable to what the game would have needed to do it justice. So instead, they use text because the processing power required to turn that text into something that was usable they did have available.

Right now we can simulate phyics, use ray traced graphics and reverse kinemetics to make games look pretty damn realistic, just don't expect to get 60 frames a second out of anything the home user has in a world like F.E.A.R. uses. Sure, you can pre-render a movie, but that 2 minute movie clip make take an hours worth of processing power depending on enviroment complexity.

So while you may look at these kinds of things and think: 'So what, I've done better in my little test apps where I was experimenting.', doing it within the constraints the developers of a real time game have is another story. I know I have done several things 'better' than the latest games have done, for instance I've written some AI to make the X-Plane flight simulator more realistic with its ATC traffic, but when plugged into the simulator and loaded it up several other aircraft in close proximity like you would expect to find at a large airport, the ATC calculations require too much processing power for my machine to nicely run the simulation. So I have to back out things till I get the speed to an acceptable level. The end result? My AI wasn't all that impressive since I ended up backing out most of the code that made it better in order to get it performing fast enough. In my case, I probably could have solved it with some multithreading goodness, or at least made it fall somewhere between what I originally created and what ended up running in the drawing thread but I think you can see my point.

Re:Awesome (4, Insightful)

Dutch Gun (899105) | more than 5 years ago | (#26196443)

Wow, this is how far we've come with game AI? I've been doing more elaborate things in CLIPS forward and backwards chaining in my AI class.

Awesome. Let me know when you've integrated it into a complete game, and it's running in real time using less than 5% total CPU load (no spikes) on the target spec machine. You're also responsible for:

* Dynamic pathfinding and waypoints (it's all pointless if the agents can't move well)
* Hint nodes and environmental information (finding a good cover location, escape route, etc)
* Animation selection and agent movement subsystem (the enemies need to look good too)
* Weapon aiming and firing system (AI can't be more than humanly accurate, or it's no fun)
* Sensory detection and reaction system (simulating eyes, ears, nose of enemies - how do they detect you?)
* Difficulty scaling (AI should get smarter at harder difficulty levels)
* Creating a personality trait system (10-20 different enemies with different movement patterns in the game)
* Squad controller agent (for your automated teammates)
* Anything else the designers want to be able to do that involves moving critters around in the game autonomously

Oh yeah, and it has to be "fun" as well. Finish this on schedule, show me the final product, and then I'll be impressed.

Game AI != Academic Research Projects

Http://fr.netlog.com/Alphonsette (-1, Offtopic)

Anonymous Coward | more than 5 years ago | (#26185967)

Http://fr.netlog.com/Alphonsette

ahh, slashdot and AI (0)

skelterjohn (1389343) | more than 5 years ago | (#26186015)

Whenever I read slashdot comments, I always think "man these people are insightful", until there is a story I actually know something about (AI). Then I think "man these people only have the barest clue about what they're talking about. this is quite pathetic". I wonder if it's like that for experts in other topics as well?

Re:ahh, slashdot and AI (5, Insightful)

Anonymous Coward | more than 5 years ago | (#26186035)

Dude ... that means you're supposed to be the one providing the insightful comments. That's how it works.

Re:ahh, slashdot and AI (0)

Anonymous Coward | more than 5 years ago | (#26188941)

Wish I had mod points... Well said.

Re:ahh, slashdot and AI (0)

Anonymous Coward | more than 5 years ago | (#26186073)

wow for someone so knowledgeable regarding the topic at hand you sure know how to write an insightful and meaningful post that adds to the discussion.

Re:ahh, slashdot and AI (2, Funny)

TheLink (130905) | more than 5 years ago | (#26191993)

He might actually be an AI, and that's why you didn't get that much insight and meaning from that post.

who gives a fuck? (-1, Troll)

Anonymous Coward | more than 5 years ago | (#26186059)

go fuck yourselves in your faggot asses faggots. bitch whore tricks. fuck you and your faggot linfux.

Re:who gives a fuck? (2, Funny)

Spatial (1235392) | more than 5 years ago | (#26186655)

We would, but unfortunately the bitch whore tricks module won't be implemented until kernel 3.1.00.00.

Re:who gives a fuck? (0)

Anonymous Coward | more than 5 years ago | (#26187497)

People modded your post Troll, so I'm going to Reply to it just to spite them. I prefer bacon in my clam chowder.

Re:who gives a fuck? (2, Funny)

geirnord (150896) | more than 5 years ago | (#26190631)

I, for one, welcome our new bitch whore overlords!

advanced ai (-1, Troll)

Anonymous Coward | more than 5 years ago | (#26186111)

If player == negro, shoot down dead and sprinkle crack on chest

Hype like Radiant AI? (2, Informative)

Rockoon (1252108) | more than 5 years ago | (#26186367)

I am reminded of the hype surrounding Oblivions Radiant AI before the game was released, and how the final product needed most of its AI ripped out completely.

Re:Hype like Radiant AI? (1)

Ascagnel (826800) | more than 5 years ago | (#26186379)

That was because the AI was a little too good. For example, a pair of drug addicts would seek out all the drugs they could afford, and would then go and knock off a drug dealer. There's a mod that reinstates this AI and stuff like that happens pretty frequently. Since the AI doesn't have as complex motivations in a combat-focused game like FEAR, I could see better AI being a boon rather than a detriment.

Re:Hype like Radiant AI? (2, Interesting)

Anonymous Coward | more than 5 years ago | (#26190001)

There are mods that "unlock" the Radiant AI in Oblivion and its not pretty. Since non-"essential" NPCs can be killed off and never respawn (obviously not counting guards and monsters) if you "wait" long enough out in the middle of nowhere, about 1/3rd of the population in Oblivion will kill itself off for SOME reason as dictated by its AI "goal".

AI like this DOES exist but because it'll take things to such extremes, developers have to dumb things down for gameplay purposes. A bot will never miss a sniper shot, so that has to be dumb down. A group of pistol wielding grunts will obviously lose to a machine-gun armed player, so they have to be programmed NOT to run away. An enemy tank will obviously win against a machine-gun armed player, so it has to be programmed in a way to NOT kill the player unless the player does the "wrong" thing. Etc.

It's a stretch to call this AI (4, Insightful)

NinthAgendaDotCom (1401899) | more than 5 years ago | (#26187473)

True AI is a hard problem. The restrictions that are in place in a game make it so that you're no longer producing intelligence, just producing a "trained pigeon" effect. Bots don't have the full range of actions and freedom available to them. Hell, the PLAYER doesn't have the full range of freedom, not even close.

Re:It's a stretch to call this AI (1)

religious freak (1005821) | more than 5 years ago | (#26187663)

This is certainly AI, what you're referring to is a more general AI... or AGI, in singularitarian parlance. http://en.wikipedia.org/wiki/Strong_AI [wikipedia.org]

Which game had the best AI so far? (1)

toxygen01 (901511) | more than 5 years ago | (#26188225)

Maybe out of topic question, but I think it's worth noting (if for nothing, just to give the credit for being best to the programmers), which game is considered to have the greatest AI compared to any other game?

Re:Which game had the best AI so far? (0)

Anonymous Coward | more than 5 years ago | (#26191083)

That depends on what you're looking for.
Games like the Halo series used "sensory" information for all the bots in the game. They didn't know explicitly where the player was or what they were doing, until the player fired a gun (made noise) or came into line of sight.

Black and White used some other techniques to "train" your minions.

Spore basically set up a groundwork of actions and created a bit of a sandbox for players (disclaimer: I haven't actually played the game, just read about it... SecuROM was enough for me).

Even Quake 3 had some interesting A.I., they had a higher level goal-oriented architecture on top of some actions to accomplish the goal. If the bot decided "I'm getting the flag", it would send a message to teammates, who would decide to help or not, then the bot would find a path to the flag (a feat in itself sometimes), then the flag would get pursued.

So, it really depends on what you consider to be great A.I. In general it has to do with believability, adding more and more complexity to it doesn't do any good if the bot continues to run into walls or get stuck in doorways.

Re:Which game had the best AI so far? (1)

Jabbrwokk (1015725) | more than 5 years ago | (#26206857)

I know it's old hat now, but when I first encountered the marines in Half-Life I was impressed by how they tried to flank you, how they would run from grenades, how they would try and flush you out from your cover and how they would rarely ever chase you to encounter the business end of your shotgun in the classic "player runs around the corner and shoots pursuers" ambush.

The Far Cry baddies were also pretty good.

I found the programming for the Unreal 2004 bots to be pretty good, too. On the higher settings they rarely did anything idiotic.

And finally the Black and White creature programming had to be the most entertaining. Training my creature to fling his poo at the enemy and eat villagers is a highlight of gaming for me.

But as many other posters have pointed out, it's not really AI, it's elaborate scripting tricks. True AI would be as unpredictable as a human being's responses.

A taste of what's to come. (1)

Ostracus (1354233) | more than 5 years ago | (#26188527)

And on the outside... (0)

Anonymous Coward | more than 5 years ago | (#26197665)

...the AI, uh, reloads his weapon, and shoots the player.

Man, we have really made some amazing advances in AI, huh?

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?