Enemy AI and self-preservation

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

User avatar
Oscar Wilde
Padawan Learner
Posts: 340
Joined: 2008-10-29 07:36pm

Enemy AI and self-preservation

Post by Oscar Wilde »

How difficult is it to program an AI that is tough, but fights smart?

Example, on a jeep mounted grenade launcher in Far Cry 2. Guy with a tec-9 runs up and starts shooting, and is promptly blasted to bits.

Is it possible to have enemies who can assess a situatation and determine to stay or get the fuck out of dodge, or is that a limit of AI?
It's funny how every Cracked reader seems to change occupation in between reading each article, so that they always end up being irrefutable field experts in whatever topic is at hand.-Dirty_Bastard, cracked.com commentator
Andrew_Fireborn
Jedi Knight
Posts: 799
Joined: 2007-02-12 06:50am

Re: Enemy AI and self-preservation

Post by Andrew_Fireborn »

It shouldn't be -that- hard. It really seems to be about how much effort the devs are willing to put into the game.

The folks behind the Farcry series have some laughably bad AI, in a supposedly very pretty game.
Rule one of Existance: Never, under any circumstances, underestimate stupidity. As it will still find ways to surprise you.
User avatar
haard
Padawan Learner
Posts: 343
Joined: 2006-03-29 07:29am
Location: Center of my world

Re: Enemy AI and self-preservation

Post by haard »

The problem is how to do it both consistant and 'cheaply', in terms of memory and CPU.

A BDI agent would be able to create a belivable enemy, but you have:
A) the tradeoff between system resources and quality of AI
B) the tradeoff between allocating resources to AI and to eye candy etc
C) the fact that very few game developers seem genuinly good at AI and agent systems
If at first you don't succeed, maybe failure is your style

Economic Left/Right: 0.25
Social Libertarian/Authoritarian: -5.03

Thus Aristotle laid it down that a heavy object falls faster then a light one does.
The important thing about this idea is not that he was wrong, but that it never occurred to Aristotle to check it.
- Albert Szent-Györgyi de Nagyrápolt
User avatar
Covenant
Sith Marauder
Posts: 4451
Joined: 2006-04-11 07:43am

Re: Enemy AI and self-preservation

Post by Covenant »

It's not even developer time, it's that AI of any sort causes massive hits to the game speed. HUGE amounts, that's basically where a grand portion of the computer's effort is going in a game with AI. So if you wanted to make a game with very believable, very clever AI you'd probably want to severely limit the amount of things it has to do besides that--such as making you face only one enemy at a time in an environment the AI has been programmed to handle. Supreme Commander's Skirmish AI, for example, has clues for the AI written into each map. So even when it's not a "mission" the AI is getting some scripted help. In a dynamic, changing environment the AI will come under increasing stress and bog down the system.

Generally though, what would make an AI believable is threat avoidance. The main thing that AI's do wrong that makes us trash talk them is running into things like landmines, off cliffs, and straight into our waiting blades. If the AI were simply programmed for a greater degree of avoidance, I think more people would consider it intelligent than they do now. That's not hard to do, people do that as-is, but they rarely make that one of the key elements of the AI's strategy.

Your grenade example. It's not hard for the AI to get simple instructions that anytime the player is manning a grenade launcher, you should stay away. Or that the AI should avoid the player any time he's within 50 yards of a vehicle, and fire from long range. The AI already has behaviors coded for avoidance, retreat, etc that are rarely called on. All you need is to give it the right order at the right time, and that's not that big of a deal. AI doens't need to be smarter at all, it just needs to have a greater desire for self-preservation.
User avatar
Oskuro
Sith Devotee
Posts: 2698
Joined: 2005-05-25 06:10am
Location: Barcelona, Spain

Re: Enemy AI and self-preservation

Post by Oskuro »

The problem with increasing the AI's self-preservation, is that it can quickly become frustrating to a majority of players that simply want to blast enemies away. It's a thin line the one separating an intelligent AI from a cheating AI, at least in the eyes of the player, and besides, most FPS games require the player to advance, so an AI that manages to counter and force the player to retreat is not desirable.

But, of course, the major problem is system resources, specially if you want not only a single soldier, but a whole army fighting the player.
unsigned
User avatar
NoXion
Padawan Learner
Posts: 306
Joined: 2005-04-21 01:38am
Location: Perfidious Albion

Re: Enemy AI and self-preservation

Post by NoXion »

Wouldn't some kind of "threat rating" system help? It would kind of work like this:

Every damage-inducing entity has a "threat rating", which is a single number that basically sums up how dangerous it is. You could start with the amount of raw damage it does in one attack, or a sum of the damage it does if it has more than one attack (EG, an assault rifle with an attatched grenade launcher, which is being carried by a human-controlled player - the AI would assess the threat of the player based on the weapon carried). Then you increase the threat rating depending on the entity's rate of fire, effective range, how fast it can move (if it can move), and any other property that makes the entity dangerous.

Of course, enemy AI is going to have it's own threat rating, and this is used by the AI to determine whether it should attack (The AI's and any visible allies' threat rating matches or exceeds that of any visible enemies), beat a fighting retreat (the enemy threat rating is slightly greater) or run screaming like a little girl (the enemy threat rating is vastly larger).

I'm not a programmer, so there may be problems with my suggestion as someone's bound to have come up with the idea before me.
Does it follow that I reject all authority? Perish the thought. In the matter of boots, I defer to the authority of the boot-maker - Mikhail Bakunin
Capital is reckless of the health or length of life of the laborer, unless under compulsion from society - Karl Marx
Pollution is nothing but the resources we are not harvesting. We allow them to disperse because we've been ignorant of their value - R. Buckminster Fuller
The important thing is not to be human but to be humane - Eliezer S. Yudkowsky


Nova Mundi, my laughable attempt at an original worldbuilding/gameplay project
User avatar
Sarevok
The Fearless One
Posts: 10681
Joined: 2002-12-24 07:29am
Location: The Covenants last and final line of defense

Re: Enemy AI and self-preservation

Post by Sarevok »

http://www.bungie.net/images/Inside/pub ... /gdc07.pdf

The AI in Halo : Combat Evolved was allocated 15 % of CPU time. On a mediocre CPU that powers the xbox. Yet it produced some of the most lifelike AI ever in a FPS game. The key to this was attempting to simulate critters instead of making quake bots. Halo AI felt angry, frustrated, happy and vengeful depending on how the battle was going. Grunts would flee when being slaughtered, Elites would visibly show their frustration after failing to kill the player and Hunters sometimes charged against all odds to avenge a fallen partner. You don't need the bullshit that pervades most discussions about game AI. The Halo AI implementation was simple. It simulated living critters that did not have aimbot accuracy, instant reflexes and often fucked up and got frustrated at their own mistakes. Unless I am fighting robots that's the type of reactions I want to get from space marines, clone soldiers or aliens or whatever. The Halo AI is ancient, often sucks and has an annoying infinite ammo cheat. The fact this simple effort remains the top AI in FPS games shows how much the video game industry sucks.
I have to tell you something everything I wrote above is a lie.
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Enemy AI and self-preservation

Post by Starglider »

Covenant wrote:It's not even developer time, it's that AI of any sort causes massive hits to the game speed. HUGE amounts, that's basically where a grand portion of the computer's effort is going in a game with AI.
As an expert in AI design, AI speed optimisation and a former professional game developer, I have to say 'not necessarily'. It is usually possible to make game AI both good and fast given enough time and expertise.

However, writing good AI is very hard. Writing fast AI is also very hard. Hardly anyone has the skillset and experience to make game AI both good and fast (the game industry's ridiculously fast staff turnover doesn't help here). Even when they do it isn't normally possible, because the game (and hence the AI) is usually getting changed around a lot right up to release date and that makes it hard to do proper optimisation.
User avatar
Vehrec
Jedi Council Member
Posts: 2204
Joined: 2006-04-22 12:29pm
Location: The Ohio State University
Contact:

Re: Enemy AI and self-preservation

Post by Vehrec »

I hear that the most resource intensive thing that Halo 3's AI does is simply determineing what they can and cannot see. It sounds a little far-fetched, but the article which I cannot find right now said they were using raytrace technology. Tens of thousands of vectors for each and every ai every second? No wonder most people just let their AI wither on the vine.
ImageCommander of the MFS Darwinian Selection Method (sexual)
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Enemy AI and self-preservation

Post by Starglider »

Vehrec wrote:Tens of thousands of vectors for each and every ai every second? No wonder most people just let their AI wither on the vine.
They almost certainly meant tracing rays from the eyes to the centre of mass of each enemy only, or possibly to a handful of extremities. There would be no point doing a full raytrace, it would be faster do just do a quick and dirty polygon render and image recognise that. In fact a few bot AI systems work exactly like that; they render everything in clear flat colours (one colour per object of interest) for the 'AI point of view' to make the image recognition easy ('if at least 1000 pixels of pure red are present, bot can see player').
User avatar
Sarevok
The Fearless One
Posts: 10681
Joined: 2002-12-24 07:29am
Location: The Covenants last and final line of defense

Re: Enemy AI and self-preservation

Post by Sarevok »

As bad as the combat state AI situation it is even embarrasing one fundermental problem has not been solved in 12 years. Starglider as a total amateur to the field I was wondering what do you have to say about solving the biped animation problem. As you are undoubtedly aware humans in videogames don't walk. They are bounding boxes sliding on floors with cleverly timed animations to create illusion of walking. This approach falls flat when characters can't do something simple like open a door or pick up objects without a painstakingly created animation for it beforehand. What good is a physics engine when the principals characters ignore it except when they die and cheesy ragdoll effects play ? How hard would it be to enforce the physics of humanoid motion on a character mesh and create an AI that can move it accordingly. Yes it may resource intensive but people payed money to see Crysis's scale and graphics. I am sure some would love enemies that trip, block punches, pick up objects and throw at them.
I have to tell you something everything I wrote above is a lie.
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Enemy AI and self-preservation

Post by Starglider »

Sarevok wrote:Starglider as a total amateur to the field I was wondering what do you have to say about solving the biped animation problem. As you are undoubtedly aware humans in videogames don't walk. They are bounding boxes sliding on floors with cleverly timed animations to create illusion of walking. This approach falls flat when characters can't do something simple like open a door or pick up objects without a painstakingly created animation for it beforehand. What good is a physics engine when the principals characters ignore it except when they die and cheesy ragdoll effects play ?
Actually this is a relatively straightforward problem that really was just waiting for adequate amounts of computing power to become available. Middleware such as NaturalMotion's Euphoria engine (as seen in GTA4) is already doing a fairly decent neuromusculature simulation, and I expect that to be refined to near-perfection over the next ten years or so.
I am sure some would love enemies that trip, block punches, pick up objects and throw at them.
That requires a bit more planning but nothing too difficult; we had a robot that could do that kind of planning in the late 60s, though of course it required a mainframe computer and used wheels, not legs. All these sensory-motor challenges are ultimately susceptible to brute computational force (which is not to say the necessary engineering is trivial, only that it is reasonably straightforward for good programmers) - this is a major reason why robotics has been progressing nicely recently. Unfortunately the challenges of higher-level planning and problem solving are much harder and more dependent on algorithm breakthroughs, rather than more compute power.
User avatar
Commander 598
Jedi Knight
Posts: 767
Joined: 2006-06-07 08:16pm
Location: Northern Louisiana Swamp
Contact:

Re: Enemy AI and self-preservation

Post by Commander 598 »

I blame most of it on laziness of the dev team. The AI may easily be capable of running away at bad times, but for some reason they basically never will as one can see when playing TES4 Oblivion (The AI basically never shows fear unless it's a deer and will fight to death 98% of the time) and then playing Fallout 3 (The AI trying to run away is not uncommon). They use the same engine and I remember clearly that one could easily mod TES4 to make the AI a bit more fearful and set things such as the max distance they would flee too. In Fallout 3 they seem to have actually put meaningful values into both of those settings.

Level design may also prove to be somewhat of a hindrance to good AI. A linear FPS will simply not have anywhere for an AI to run too if it's capable of fleeing. In HL1 and perhaps 2, I distinctly recall that the AI would attempt to run away, but would only go a few feet around a corner. Increasing the maximum flee distance could improve the appearance of an AI that is actually fearing for it's life as well as perhaps creating certain tactical issues such as "the enemy that just ran away to hide has now discovered an open window in that tall building you were just in and picked up a long range weapon somewhere along the way".

In Operation Flashpoint, while the AI was capable of retreating to a fair distance under normal circumstances, I recall some instances of the AI running away so far to the point where I wouldn't be able to find it without a thorough search of the map. For example, I once set up a mission of me perched on a mountain with a sniper rifle firing on squad some distance away, they climbed up from the nearest "easy access" point up the mountain and attempted to flank me on my left but I nailed a few more of them and they gave it up and ran...and kept running... I expected them to try again, as they normally do, but they never came back. I suspect they went down the other side of the mountain but I couldn't see anyone. I suspect they may have gone into a town in that direction or hid in some woods near the location but I was too lazy to actually look for them and it would have required a lot of time as the maps in OFP are rather large and if anything they were probably waiting for me hiding behind some bush along the way...

On the subject of FC2, I have seen the AI run away and hide behind buildings sometimes, but it's fairly rare and what your using basically has no effect on the matter.
User avatar
DPDarkPrimus
Emperor's Hand
Posts: 18399
Joined: 2002-11-22 11:02pm
Location: Iowa
Contact:

Re: Enemy AI and self-preservation

Post by DPDarkPrimus »

Look at FEAR. The AI programming for FEAR wasn't, in actuality, much more complicated than most other FPS games, but they added nuances that made them appear a lot smarter than they actually were - increased probabilities of using the map's geometry to flank you, able to interact with environment to make cover, and yes, the ability to freak out and pull a retreat.
Mayabird is my girlfriend
Justice League:BotM:MM:SDnet City Watch:Cybertron's Finest
"Well then, science is bullshit. "
-revprez, with yet another brilliant rebuttal.
User avatar
Singular Intellect
Jedi Council Member
Posts: 2392
Joined: 2006-09-19 03:12pm
Location: Calgary, Alberta, Canada

Re: Enemy AI and self-preservation

Post by Singular Intellect »

Starglider wrote:As an expert in AI design, AI speed optimisation and a former professional game developer, I have to say 'not necessarily'. It is usually possible to make game AI both good and fast given enough time and expertise.
Perhaps a good example is 'detecting' a player within a certain distance on, say, a simple two dimensional plane; most people would probably assume the best option is a circular detection pattern for consistency and realism. But a square detection system is actually much less processor intensive, since it wouldn't rely on the square root function. And within certain limits, a player isn't exactly going to notice they trip a detection reaction slightly sooner if they happen to approach the AI unit at one of the corners the detection square.

I hope that made sense...:P
However, writing good AI is very hard. Writing fast AI is also very hard. Hardly anyone has the skillset and experience to make game AI both good and fast (the game industry's ridiculously fast staff turnover doesn't help here). Even when they do it isn't normally possible, because the game (and hence the AI) is usually getting changed around a lot right up to release date and that makes it hard to do proper optimisation.
In your experience Starglider, do you think that a master AI response system is better over equipping every AI unit with individual AI subroutines (or rather, every NPC calls upon the AI subroutine)? In other words, the game AI can handle every AI unit from a FPS concept, or a 'top down RTS' style of control.

I would think so, and that the 'FPS AI concept' would be limited to mere navigation and detecting the player, but not actual tactics or behavior. Essentially employing both, but leaning towards the RTS AI control idea.
"Now let us be clear, my friends. The fruits of our science that you receive and the many millions of benefits that justify them, are a gift. Be grateful. Or be silent." -Modified Quote
User avatar
Stark
Emperor's Hand
Posts: 36169
Joined: 2002-07-03 09:56pm
Location: Brisbane, Australia

Re: Enemy AI and self-preservation

Post by Stark »

I agree with Covenant; people aren't annoyed by a lack of 'artificial intelligence', simply that the scripted action trees in games are a) extraordinarily primitive and b) result in obviously retarded/non-human actions. In non-anthropomorphic games it's less glaring (like an RTS where the computer sends it's tanks somewhere retarded), but in FPS it's pretty terrible when an enemy decides that when hiding, he'll vault over his cover, get shot to shit, then instantly decide to vault back over and hide again but die.

Developing some magical efficient yet high quality AI isn't necessary in my opinion. Things that jar gamers (like the hilarious Beth back-forward melee combat) can be addressed by tweaking the underlying mechanics and changing the way the npcs behave, without resorting to serious AI development. To 'fake' the appearance of 'intelligence' or 'decisionmaking' is way easier than actually having it make decisions, especially in games with very limited options (such as 'go forwards, go back, stab).

Look at this thread - they're talking about examples of percieved human-like or 'sensible' behaviour. You don't need AI for this, an AI could just generate such responses itself. Remember how people thought FEAR had good AI because it was scripted, the levels were carefully designed to shepard the NPCs pathfinding and they were given quite limited but appropriate options?
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Enemy AI and self-preservation

Post by Starglider »

Bubble Boy wrote:Perhaps a good example is 'detecting' a player within a certain distance on, say, a simple two dimensional plane; most people would probably assume the best option is a circular detection pattern for consistency and realism. But a square detection system is actually much less processor intensive, since it wouldn't rely on the square root function.
That isn't a good example, since an accurate square root isn't required and a low-resolution lookup table will work just fine. Until quite recently basically all games did this for all trig and log functions, and even now they're still heavily used when numerical stability isn't a concern.
In your experience Starglider, do you think that a master AI response system is better over equipping every AI unit with individual AI subroutines (or rather, every NPC calls upon the AI subroutine)? In other words, the game AI can handle every AI unit from a FPS concept, or a 'top down RTS' style of control.
The best game AI uses both levels, but it's more work (except in something like an RTS where it's essential).

Something I've always wanted to see in game AI is an explicit model of the player's mental state, and direct optimisation of enemy tactics to maximise entertainment value (with 'suspension of disbelief' as a variable to prevent overdoing it), as opposed to simply trying to win and then toning down competence to balance the difficultly. Unfortunately AFAIK this has never been implemented beyond very simple dynamic difficultly schemes and static scripting - most likely because doing a good job would require a research project of the type games companies don't have the time or the money for.
User avatar
Covenant
Sith Marauder
Posts: 4451
Joined: 2006-04-11 07:43am

Re: Enemy AI and self-preservation

Post by Covenant »

Starglider wrote:Actually this is a relatively straightforward problem that really was just waiting for adequate amounts of computing power to become available. Middleware such as NaturalMotion's Euphoria engine (as seen in GTA4) is already doing a fairly decent neuromusculature simulation, and I expect that to be refined to near-perfection over the next ten years or so.
Hey man, don't be putting me out of a job.

Really though, the issue isn't animation, it's the way the stuff is coded. When I animate for non-game products I can use all sorts of handy doodads for helping to keep my characters moving properly, without the need for clunky procedural stuff. Ideally, things like Euphoria would handle the drudge work of foot location and blending animations while still using keyed animations for the targets of their 'behaviors'. I see elements of the Euphoria thing in the way Fallout 3 handles it's character animations, and they're just not as nice as a keyed piece, even if somewhat more handy on the fly.

What I think you're talking about when it comes to maximizing entertainment value is something best served via the game engine and not the AI. If someone has taken up the Sniper Rifle as their One True Gun, what would make it more fun for them--making them more alert or making them more dimwitted? You're better off setting targets for gameplay experience and using AI tweaks to nudge players back towards it, but even that can be more easily handled by throwing different things in front of the enemy and leaving the AI as-is. I think it would be damaging to the gameplay, except in a few very unique instances, to alter the AI's behavior with the intent of making it the most "fun" unless you define "fun" as "adequate difficulty."

It's just a slippery slope. Setting the game to easy because you're a 45 year old dad who just wants to have some fun and relax, and then having the game dynamically alter strategy to push you harder, is not good. Similarly, having the AI fail to challenge a player who wishes to be challenged will not be good either. It would be much easier if the player was able to give feedback of some sort and tell the game what it found fun--and generally this is manifested as the difficulty slider. I'm just being a bit contrary though, because now I'm worried that in 10 years my job in animation will be gone due to procedural bullshit.
User avatar
Ryan Thunder
Village Idiot
Posts: 4139
Joined: 2007-09-16 07:53pm
Location: Canada

Re: Enemy AI and self-preservation

Post by Ryan Thunder »

Sarevok wrote:[...]As you are undoubtedly aware humans in videogames don't walk. They are bounding boxes sliding on floors with cleverly timed animations to create illusion of walking.
Mechwarrior 3 seems to have solved that problem, IIRC.

But nobody ever did it again. :(
SDN Worlds 5: Sanctum
Medic
Sith Devotee
Posts: 2632
Joined: 2004-12-31 01:51pm
Location: Deep South

Re: Enemy AI and self-preservation

Post by Medic »

Starglider wrote:Something I've always wanted to see in game AI is an explicit model of the player's mental state, and direct optimisation of enemy tactics to maximise entertainment value (with 'suspension of disbelief' as a variable to prevent overdoing it), as opposed to simply trying to win and then toning down competence to balance the difficultly. Unfortunately AFAIK this has never been implemented beyond very simple dynamic difficultly schemes and static scripting - most likely because doing a good job would require a research project of the type games companies don't have the time or the money for.
You know that sounds like a hollow excuse as a layman because once you MAKE such an AI once, you can simply port it to all your FPS. Unlike a new game engine, it seems, this is a straightforward thing to accomplish.

But a layman I remain, so I have to ask: do programming languages or new graphics engines for newer games present any particular hindrance to porting a nice, efficient AI? Cause if you really only need to get it right once, then employee turnover rate or time and expense factors shouldn't be posited as obstacles. Periodically it could be expanded, tweaked, or completely overhauled too I'd imagine, as technology simply increased raw computing power available to the median consumer's typical gaming rig.

edit: if in fact it's a relatively straightforward affair to port AI, then that puts Infinity Ward in a dim light. The AI sucked in vanilla CoD1 and has remained virtually unchanged throughout, if I'm to judge having owned nearly every permutation besides the console-only CoD3 and the Big Red One. (which I really should -- I'm in that Division :lol:)
User avatar
Sarevok
The Fearless One
Posts: 10681
Joined: 2002-12-24 07:29am
Location: The Covenants last and final line of defense

Re: Enemy AI and self-preservation

Post by Sarevok »

But a layman I remain, so I have to ask: do programming languages or new graphics engines for newer games present any particular hindrance to porting a nice, efficient AI? Cause if you really only need to get it right once, then employee turnover rate or time and expense factors shouldn't be posited as obstacles. Periodically it could be expanded, tweaked, or completely overhauled too I'd imagine, as technology simply increased raw computing power available to the median consumer's typical gaming rig.
Once again I speak as an amateur and will have to defer to the professionals here but in my experience there is no one size fits all solution in gaming. Even "3D engines" are better written completely from scratch than "reuse" unless you want a Quake or Unreal clone. It is far faster sometimes than sifting through tons of poorly documented code with very little examples. AI is even more specialized than graphics. AI implementations fit very specific niches in specific games. The best you could do is provide APIs for general mathematical problems that arise in many games. For example the A* pathfinding algorithm or fast raytracing. Every game from RTS to FPS needs characters to move from point A to point B or see if there is LOS between two points. It would be nice to have a API routine coded by the industry experts to call up that I know will get the results much quicker than my hack job. But even then I am not sure you could come up with a general purpose solution even for such trivial applications. What if for example your game uses wacky jump physics and the pathfinding algorithm don't take it into account and gives you a more inefficient path than a human player would find ?
I have to tell you something everything I wrote above is a lie.
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Enemy AI and self-preservation

Post by Starglider »

Covenant wrote:
Starglider wrote:Actually this is a relatively straightforward problem that really was just waiting for adequate amounts of computing power to become available. Middleware such as NaturalMotion's Euphoria engine (as seen in GTA4) is already doing a fairly decent neuromusculature simulation, and I expect that to be refined to near-perfection over the next ten years or so.
Hey man, don't be putting me out of a job.
It won't. The best possible procedural animation / character AI system simply means that you'd be giving the game engine the same kind of instructions that directors give human actors. There will still be a need for animators, although to be honest it will be a significantly reduced need. But that's ok, the amount of content required per game has been constantly going up, so we need better automation just to keep on top of that while maintaining current staffing levels.
I see elements of the Euphoria thing in the way Fallout 3 handles it's character animations, and they're just not as nice as a keyed piece, even if somewhat more handy on the fly.
The technology is in its infancy, like realtime 3D engines in 1995. It'll get better, quickly.
What I think you're talking about when it comes to maximizing entertainment value is something best served via the game engine and not the AI. If someone has taken up the Sniper Rifle as their One True Gun, what would make it more fun for them--making them more alert or making them more dimwitted?
Depends how many of their shots hit, but probably more alert.
I think it would be damaging to the gameplay, except in a few very unique instances, to alter the AI's behavior with the intent of making it the most "fun" unless you define "fun" as "adequate difficulty."
The correct analogy is a human GM in a tabletop roleplaying game. I've done a lot of roleplaying in my time and certainly a good GM deliberately and actively tweaks the plot and the encounters to maximise the enjoyment of the players. Of course replicating this kind of understanding in a computer to a useful level is very hard. I didn't say it would be easy.
Setting the game to easy because you're a 45 year old dad who just wants to have some fun and relax, and then having the game dynamically alter strategy to push you harder, is not good. Similarly, having the AI fail to challenge a player who wishes to be challenged will not be good either.
I don't mean simple adaptive difficulty. That way lies Oblivion level scaling bullshit. Actually the kind of challenge the game presents the player with is probably more important than difficultly tweaking. Developers have been trying to make games that have 'multiple ways to solve each problem' for a while now but it usually isn't too convincing, and it takes a lot of additional effort to test and balance everything. Better AI could help a lot there.
SPC Brungardt wrote:
Starglider wrote:Unfortunately AFAIK this has never been implemented beyond very simple dynamic difficultly schemes and static scripting - most likely because doing a good job would require a research project of the type games companies don't have the time or the money for.
You know that sounds like a hollow excuse as a layman because once you MAKE such an AI once, you can simply port it to all your FPS. Unlike a new game engine, it seems, this is a straightforward thing to accomplish.
No, it's a very real problem. Designing good AI is very hard and worse it's much harder to predict if a particular approach is going to work or not than for 3D or physics engines. The later are generally based on very solid, well understood maths, while the former are far more of a shot in the dark. Porting AI isn't as easy as it sounds either; partly for inherent reasons and partly because the game industry isn't set up for it yet. It's a little hard to explain; back in the day everyone used their own custom 3D engines, then licensing of 3D engines became standard, then much later the 3D and physics engines got split out and licensing of physics engines (and rendering middleware) started to happen. There have been several attempts to make generic AI middleware, but none of them really worked, and I don't think the development landscape is ready for it just yet. Maybe in next console generation the hype will move from 'look we have physics!' to 'look we have AI!', but don't count on it.
But a layman I remain, so I have to ask: do programming languages or new graphics engines for newer games present any particular hindrance to porting a nice, efficient AI?
How much of a difference programming languages actually make to the difficultly of AI design is a debate that has raged for about 50 years in AI academia. Personally I'd say 'not much'.
Cause if you really only need to get it right once, then employee turnover rate or time and expense factors shouldn't be posited as obstacles.
No, these are huge problems for anything except the very largest publishers (e.g. EA), it's extremely difficult to convince execs to put capital into risky fundamental tech development projects rather than doing a bit more content for the next title that might bump it from B grade to an AAA title.
Periodically it could be expanded, tweaked, or completely overhauled too I'd imagine, as technology simply increased raw computing power available to the median consumer's typical gaming rig.
No existing, well-known AI technology is sufficiently flexible. Plus it's just too tempting to take the easy route and fake it with some scripting, heuristics and careful level design for each title.
Sarevok wrote:AI is even more specialized than graphics. AI implementations fit very specific niches in specific games.
Correct. All the more general, reusable stuff is still in the lab, or in most cases still on the drawing board.
Sarevok wrote:For example the A* pathfinding algorithm or fast raytracing.
Indeed, many many libraries already exist for this kind of thing.
What if for example your game uses wacky jump physics and the pathfinding algorithm don't take it into account and gives you a more inefficient path than a human player would find ?
Good example. What we really need is not just better AI in the actual game code. What we need is an AI system that is part of the development process, one which can analyse the needs of the game and write custom agent code automatically. A system that can give every game state-of-the-art AI without having to employ a whole team of top AI programmers. A system that can actively search for ways to break the game and automatically fix balance issues.

Fortunately I do know of one company that is working on technology like this. I'm the technical director. ;)

Seriously though, gaming is a nasty sector to do business in, so it's a fair way down our product development schedule.
User avatar
MKSheppard
Ruthless Genocidal Warmonger
Ruthless Genocidal Warmonger
Posts: 29842
Joined: 2002-07-06 06:34pm

Re: Enemy AI and self-preservation

Post by MKSheppard »

All you need to do to prevent a lot of stupidity like this:

Image

In this one, I simply climbed up on top of the elevator, garroted someone in the elevator, and lifted them up through the service hatch. Repeat x30 times, they wouldn't even figure out how to climb up to get me, even when they saw someone being garroted and lifted right in front of them

HL2 Massacre

That kind of "genius" from AI driven NPCs was acceptable in Mid-1993, when the top of the line computer was a Pentium 60, maximum memory was what, at most 8-16MB, and hard drives were at best 100~ MB. The graphics and sound engines needed a lot of system overhead, so there wasn't a lot of room for advanced AI.

However, since then, overall memory has just exploded; we've got video cards on the general market with 1 gigabyte of RAM for reasonable prices ($200 or so), and you now have 2 GB of RAM available (max you can get with Win XP). So what excuse is there for stupid AI like in the picture above?

It's just a matter now of bookkeeping to create the illusion of "smarter" AIs. For example, you could assign each discrete room and corridor in a game level with it's own byte (0 to 255 range) tracking the "death count" in that room.

Back in the days of a 640k memory limit and when we had to use such things like QEMM (remember that?) to load everything into expanded memory to get that mighty 620kb free we needed for Aces of the Pacific, etc; such things weren't possible since they ate too much memory, etc.

Now, we can do that; and script the AIs in our game to when a room reaches a certain "Death count", the AI's stop going in there, they take cover outside the room, and call in tactical teams to clear it with grenades, etc, instead of blundering in one by one.
"If scientists and inventors who develop disease cures and useful technologies don't get lifetime royalties, I'd like to know what fucking rationale you have for some guy getting lifetime royalties for writing an episode of Full House." - Mike Wong

"The present air situation in the Pacific is entirely the result of fighting a fifth rate air power." - U.S. Navy Memo - 24 July 1944
Medic
Sith Devotee
Posts: 2632
Joined: 2004-12-31 01:51pm
Location: Deep South

Re: Enemy AI and self-preservation

Post by Medic »

Well bugger. So if graphics and physics were like exploring the continents and the oceans then AI's like upping the ante to space exploration? At least, I think that's a decent analogy going by your description Starglider.
User avatar
Stark
Emperor's Hand
Posts: 36169
Joined: 2002-07-03 09:56pm
Location: Brisbane, Australia

Re: Enemy AI and self-preservation

Post by Stark »

You could say the same thing about 'writing' and 'plot'. It's just not as important as ZOMG TEH BLOOM. If it was a priority, it could be resolved even without top-to-bottom AI development integration (which I believe only GalCiv2 ever did, and that's only because Wardell is a nutbar AI enthusiast, and even he takes advantage of turn-basedness to spend extra time to get 'human-like' decision-making).

Personally I don't think in-game behaviour has anything to do with intelligence. It's the grand illusion of making the npcs do thing that aren't hopelessly stupid and responding to stimulus - but since a game is extremely limited in possibility, this doesn't require sophisticated decision-making. There's a giant gulf between terrible, illusion-shattering behaviour and AI-driven intelligent on-the-fly emergent behaviour, and I doubt it's worth the development time and resources to go that far. Like Shep says, it's perhaps pretty trivial to prevent (or seriously reduce) absurdly retarded behaviours, and beyond that you're looking at serious investments for much less visible gain... which is all that matters.
Post Reply