PDA

View Full Version : AI in games



bradchalmers
01-01-2008, 06:23 PM
Hi all

Happy new year to everyone, first up I'm only posting here because after a conversation with a friend he suggested it is something that might be relevant to share with the IL2 community/developers.

I should first point out what this post isn't. It isn't something I think should be implemented in SOW:BOB because it would be difficult, however I've included it here because I think it has merit to be thought about in future games.

Over the past year I've been having conversations with a friend who is a scientist at an Australian research ogranisation, one of his side projects has to do with AI. Nothing amazing about that, execept he first wanted research how we understand. Why is this different? Because most AI projects deal solely with our behaviour, not with our understanding.

Now this got me thinking so I fired up IL2 and several other games and took notes on the AI behaviour. I started thinking about what AI is currently doing in games or more to the point what it isn't.

All games AI (not just IL2) bar none, try to mimick player behaviour. But the AI doesn't "understand" what a plane is. All it knows is it "behaves" a certain way if you are coordinates x,y,z.

So whats the difference you are asking well take ourselves, most of us only fly in a the sim world right?(I apologise now to any forum members who are pilots). However if had to get into a small plane today, whilst you may not be able to fly it safely, you would "understand" some of the concepts of you what you needed to do....just don't ask me to be a passenger with you :-)

This realisation opened up another can of worms, feedback. We understand things through feedback. But how would AI understand the game? Does it get feedback? If so, how? Take ourselves, when we play IL2 we get feedback from the controls, from the instruments, from the screen etc etc. How does the AI accept feedback? Does it accept feedback?

With this in mind I started googling, and looking at feedback into Neural Networks, mainly because this a programming technique used in some games today (Although it is very resource hungry). What I found is interesting, at present feedback ratio is roughly 1 to 1, that is there is only one input for every output. However again take us homo homo sapiens (well most of us...) our feedback factors are much much greater. You see where I'm going?

So at the moment I'm looking into Neural Networks accepting multiple feedback inputs, and see if this improves the Networks learning ability.

I am not a great programmer, but good enough I can muddle something together, atleast in psuedo code.

Also my friend, has been doing a few experiments in the lab along similiar lines, although he isn't interested in computer games he thinks they could be useful in testing some of his theories. I'm thinking of looking at an open source game and mucking with the AI of it, experimenting with it to see what happens if you give it feedback.

Now as you would imagine this is pretty resource hungry but I think with the advent of multicore processors this can be overcome.

I think Oleg is doing a great job of modelling a world. But it would be great if an AI pilot obtained feedback from this world and it began to understand the information.

Anyway this is all theoretical at the moment but gives us something to hope for and not just in simulations but also in Role Playing Games.

I'll let you know if I turn anything else up.

VW-IceFire
01-02-2008, 03:26 PM
Excellent post! If I may say you have a much more realistic understanding of what AI is doing, is capable of, and what the options are in the future but not in the present. Very few seem to approach the AI as actual AI (only in name)...I think the "understanding" of the average player is that the AI sees the world more or less as we do but thats not really the case. Admittedly its very hard to abstract to how the AI works unless you've researched AI or written AI as a programmer.

The problem I see with a neural network, resource issue aside, is getting the AI to the point that its capable of providing a realistic opponent but not so capable as to utterly exceed the capabilities of the human player. Because in this case it really is all about us so we want AI that is good...but not too good. You could program that...an AI that is perfect within the game environment so every deflection shot is perfect (if you're a computer which is just a giant calculator then its relatively easy), every bomb drop is spot on, every control surface is moved precisely to the right amount to achieve the intended effect in the flight sim world.

The trick is to make the AI respond appropriately...feedback is essential for sure I agree...but you definitely need to maintain the illusion that its a "human" on the other end. I think the AI in combat flight simulators is the ultimate challenge as its a complex activity for a human nevermind the AI. And of course getting the AI to understand and function largely as we do is a huge challenge...I don't think anyone has cracked that one...certainly not for practical use in games.

Interesting post!

Codex1971
01-02-2008, 04:57 PM
It would be interesting to see what your mate comes up with. I've recently bought "Programming Game AI by Example" by Mat Buckland at a garage sale.

Haven't read through all of it but from what I have read it mainly deals with AI in a single or "Atomic" goal driven state, which I think is what IL-2 has now. The AI are out to achieve a single goal, ie. shoot the player down or bomb the target. The AI won't quit until it's done unless they're wounded, damaged or have no ammo. To model this does take a far bit of processing power.

I think what your leading to is AI that has "Composite" goals, which takes actions based in past experience, ie. There are too many enemy planes covering the target area, we'll attack the secondary target instead. The more experince the AI gains the more accurate they get but they'll also take into account "the odds of success" of a situation. This leads into the area of Fuzzy Logic which I would say needs way more CPU time.

Keep us posted this should be an interesting discussion.

bradchalmers
01-02-2008, 08:02 PM
Hey thanks for the replies.

I agree with regards to resources, thats why decent AI may not be around for a few years, but I dearly hope someone proves me wrong.

As for the AI being too good, that was something I worried about too. However I read up on some games that used ANN, Colin McRae Rally trained their AI but then they stopped it learning when it was in game...I need to investigate more.

Also I got to thinking about ways of making todays AI seem a little more human.

A while ago a friend wrote a simple program on the Commodore 64 (Ok we are talking years ago now!!!), what is interesting about was it was a trait generator to help him generate characters for an rpg game. It was simple, two columns of traits and each Non Player character would randomly be assigned a trait from each column.

Now the fun bit was there were only 12 traits in each column but 144 combinations (I think). This got me thinking if something simple like this could be implmented into AI for games, have a simple personality fucntion modify the behaviour of the standard AI code.

I'll give you an example: AI Pilot 1 (I'll call him Fred), gets traits Selfish/Arrogant. How this plays out in the game is Fred has a tendancy to steal his squadron mates kills. He is a good shot (accuracy of AI on Veteran level) but the downside is he ignores kills that are trying too hard to be shot down or if it is a deflection shot. He wants to become an Ace the quickest way possible.

Second example AI pilot 2 (I'll call him Bill) is Cruel/Cowardly, often tends to shoot at bailed out enemy pilots. But will turn a blind eye to helping Squadron mates if the action gets hairy (Simple he ignores radio orders to assist other pilots).

Now this isn't a Neural Net, hell it isn't even advanced programming but it is a simple way of giving the AI pilots a little bit of personality, without having to code detailed personalities for each character.

Suddenly without too much effort you've given the appearance of a personality (I know its only skin deep but hey its not like you are wanting them to host a dinner party in the Sims 2)

Now imagine human players teaming up with Bill and Fred you can hear the howls if you are assigning flight rosters...."Hey I don't want Bill as my wingman, he runs at the first sign of trouble". Also without realising you've created a reason to become Squadron Leader, so you don't get assigned with some deadbeat...ofcourse it could go the other way you could have a great wingman who always sticks with you, never lets you down. Then you would care what happens to him....if for no other reason than you might get assigned some deadbeat who has poor eyesight and a worse attitude.

Also imagine if you are on the opposing side, and you hear reports of a enemy pilot that machine guns parachutes. What would you think? Anger? Fear? Revenge? All this from a simple 2 dimension array.

This wouldn't be much of a stretch for SOW, and I'm certainly not suggesting holding up production of the game for it. Just something to think about in the future.

Lastly back on ANN, I've being doing a little bit of reading and they may not be the best solution, there is something new called Hierachical Temporal Memory which looks interesting, am going to check it out.

Outlaw---
01-03-2008, 05:44 AM
Originally posted by bradchalmers:
Hey thanks for the replies.

I agree with regards to resources, thats why decent AI may not be around for a few years, but I dearly hope someone proves me wrong.

As for the AI being too good, that was something I worried about too. However I read up on some games that used ANN, Colin McRae Rally trained their AI but then they stopped it learning when it was in game...I need to investigate more.

Also I got to thinking about ways of making todays AI seem a little more human.

A while ago a friend wrote a simple program on the Commodore 64 (Ok we are talking years ago now!!!), what is interesting about was it was a trait generator to help him generate characters for an rpg game. It was simple, two columns of traits and each Non Player character would randomly be assigned a trait from each column.

Now the fun bit was there were only 12 traits in each column but 144 combinations (I think). This got me thinking if something simple like this could be implmented into AI for games, have a simple personality fucntion modify the behaviour of the standard AI code.

I'll give you an example: AI Pilot 1 (I'll call him Fred), gets traits Selfish/Arrogant. How this plays out in the game is Fred has a tendancy to steal his squadron mates kills. He is a good shot (accuracy of AI on Veteran level) but the downside is he ignores kills that are trying too hard to be shot down or if it is a deflection shot. He wants to become an Ace the quickest way possible.

Second example AI pilot 2 (I'll call him Bill) is Cruel/Cowardly, often tends to shoot at bailed out enemy pilots. But will turn a blind eye to helping Squadron mates if the action gets hairy (Simple he ignores radio orders to assist other pilots).

Now this isn't a Neural Net, hell it isn't even advanced programming but it is a simple way of giving the AI pilots a little bit of personality, without having to code detailed personalities for each character.

Suddenly without too much effort you've given the appearance of a personality (I know its only skin deep but hey its not like you are wanting them to host a dinner party in the Sims 2)

Now imagine human players teaming up with Bill and Fred you can hear the howls if you are assigning flight rosters...."Hey I don't want Bill as my wingman, he runs at the first sign of trouble". Also without realising you've created a reason to become Squadron Leader, so you don't get assigned with some deadbeat...ofcourse it could go the other way you could have a great wingman who always sticks with you, never lets you down. Then you would care what happens to him....if for no other reason than you might get assigned some deadbeat who has poor eyesight and a worse attitude.

Also imagine if you are on the opposing side, and you hear reports of a enemy pilot that machine guns parachutes. What would you think? Anger? Fear? Revenge? All this from a simple 2 dimension array.

This wouldn't be much of a stretch for SOW, and I'm certainly not suggesting holding up production of the game for it. Just something to think about in the future.

Lastly back on ANN, I've being doing a little bit of reading and they may not be the best solution, there is something new called Hierachical Temporal Memory which looks interesting, am going to check it out.

I've done a lot of production work with commercially available self training neural networks and I don't see any advantage to using them in a game engine. The networks are completely dependent on the input sets they were trained on and I can't imagine an input set small enough to be efficient and large enough to be all encompassing enough to produce good results.

I have done some work with traffic simulators using logic similar to yours above. Each vehicle was assigned a set of performance attributes and each driver was assigned a set of "habits" and physical limits. The cars are easy to define with attributes like max. acceleration/deceleration, lateral g, physical size, and sensitivities on all inputs. The driver's habits included attributes like following distance (in seconds), percentage chance that they would stop paying attention to surroundings, amount of time they would not pay attention once attention was lost, percentage of vehicles's performance the driver will use, amount of error in inputs (this paired up with input sensitivity of the vehicle which often lead to over-correction), and error percentages for all attributes (ie some drivers nailed their following distance while some would be off).

From what I've read, BOB WOV uses something similar to the above along with state tracking for each pilot. They had some issues with changing states but they have improved it significantly. IL-2 also has some issues with states as evidenced by the fact that once pilots enter the "rtb and land" mode they will pay no attention to bandits or friendly calls for assistance.

With a fairly small set of attributes it's not too difficult to come up with a robust and varied AI behavior without the use of complicated technologies such as neural networks. Even better, it's all been done before so there is no real technological leap. It's simply a matter of CPU resources and developer time to fine tune the behavior.

--Outlaw.

Skoshi Tiger
01-03-2008, 06:22 AM
What? I thought they had already implemented the Ar$ehole personality into the AI allready!

They shoulder shoot, vulch, disobey orders and totally ignore Human players when they are in trouble. All they're interested in is building up their score! http://forums.ubi.com/groupee_common/emoticons/icon_wink.gif

No but really, what were dealing with in the game isn't Artificial Intelegence as a computer scientist would classify it( sorry in advance to the AI programmers in IL2 and Bob I guess they'ld understand where I'm comming from), Its more of a 'simulated intelegence' that has nothing to do the AI learning or 'understanding'.

If it was We'ld end up with game full of simulated Adolph Gallands and
Werner Molders or they'ld learn from their mistakes and understand that violence is not the answer and the war would be over after the first mission!!!!

I think our PC's will be having enough trouble Handling Bob when it's released, let alone trying to incorporate sophisticated AI. Also most of the 'real' AI programming is still research into our understanding of how intellegence works. I don't think it's at a state where it ready to be bunged into a flight sim at $80 a copy.
.
...
....
.....
Buz! Click! Checksum ERROR line 4A6F:A78C
Garbage Collection initiated.
Reboot Simulated Personality.







Originally posted by bradchalmers:
Hey thanks for the replies.

I agree with regards to resources, thats why decent AI may not be around for a few years, but I dearly hope someone proves me wrong.

As for the AI being too good, that was something I worried about too. However I read up on some games that used ANN, Colin McRae Rally trained their AI but then they stopped it learning when it was in game...I need to investigate more.

Also I got to thinking about ways of making todays AI seem a little more human.

A while ago a friend wrote a simple program on the Commodore 64 (Ok we are talking years ago now!!!), what is interesting about was it was a trait generator to help him generate characters for an rpg game. It was simple, two columns of traits and each Non Player character would randomly be assigned a trait from each column.

Now the fun bit was there were only 12 traits in each column but 144 combinations (I think). This got me thinking if something simple like this could be implmented into AI for games, have a simple personality fucntion modify the behaviour of the standard AI code.

I'll give you an example: AI Pilot 1 (I'll call him Fred), gets traits Selfish/Arrogant. How this plays out in the game is Fred has a tendancy to steal his squadron mates kills. He is a good shot (accuracy of AI on Veteran level) but the downside is he ignores kills that are trying too hard to be shot down or if it is a deflection shot. He wants to become an Ace the quickest way possible.

Second example AI pilot 2 (I'll call him Bill) is Cruel/Cowardly, often tends to shoot at bailed out enemy pilots. But will turn a blind eye to helping Squadron mates if the action gets hairy (Simple he ignores radio orders to assist other pilots).

Now this isn't a Neural Net, hell it isn't even advanced programming but it is a simple way of giving the AI pilots a little bit of personality, without having to code detailed personalities for each character.

Suddenly without too much effort you've given the appearance of a personality (I know its only skin deep but hey its not like you are wanting them to host a dinner party in the Sims 2)

Now imagine human players teaming up with Bill and Fred you can hear the howls if you are assigning flight rosters...."Hey I don't want Bill as my wingman, he runs at the first sign of trouble". Also without realising you've created a reason to become Squadron Leader, so you don't get assigned with some deadbeat...ofcourse it could go the other way you could have a great wingman who always sticks with you, never lets you down. Then you would care what happens to him....if for no other reason than you might get assigned some deadbeat who has poor eyesight and a worse attitude.

Also imagine if you are on the opposing side, and you hear reports of a enemy pilot that machine guns parachutes. What would you think? Anger? Fear? Revenge? All this from a simple 2 dimension array.

This wouldn't be much of a stretch for SOW, and I'm certainly not suggesting holding up production of the game for it. Just something to think about in the future.

Lastly back on ANN, I've being doing a little bit of reading and they may not be the best solution, there is something new called Hierachical Temporal Memory which looks interesting, am going to check it out.

Luke5skywalker4
01-03-2008, 12:18 PM
The A.I. needs to "understand" that they can't do plane aerobatics when their flight controls are damaged http://forums.ubi.com/groupee_common/emoticons/icon_smile.gif. They always ram right into the ground doing some crazy move and I'm sure other people have encountered this as well.

bradchalmers
01-03-2008, 06:42 PM
I agree with you Outlaw, this has all been done before....and none of it has worked, not even close. So perhaps we need to look at the problem in a different way?

You've hit the nail on the head, Neural Networks even with large samples only succeed at mimicking behaviour, they don't understand the behaviour they are mimicking and without understanding there cannot be intelligence. The more I think about it the more I think a new approach to this whole problem needs to looked into.

Outlaw---
01-04-2008, 05:03 AM
Originally posted by bradchalmers:
I agree with you Outlaw, this has all been done before....and none of it has worked, not even close. So perhaps we need to look at the problem in a different way?

It worked very nicely in the traffic simulator and it's not bad in BoB WOV. By, "...it's been done before...", I didn't necessarily mean that it's been done in the applications you are aware of.

A fine tuned decision tree along with variable per AI unit attributes CAN produce reasonable (remembering that reasonable is defined by the attributes) behavior.

Note that I'm talking about fairly high level decisions here such as "should I attack", "should I RTB", "should I climb first", and "what should I attack". States for a flight sim could include the following, "scanning for targets", "attacking enemy air target but wary", "totally fixated and unaware", "RTB but wary", "totally fixated on RTB", "landing", "oh God I'm on fire", "attacking bogey and attempting positive ID", "attacking enemy ground target", etc. with each state having certain criteria that, once met, cause a reevaluation of state.

--Outlaw.

Capt.LoneRanger
01-04-2008, 10:46 PM
The question is, why is it so difficult to apply a decent AI to some games or if it is remains a simple question of priorities from the producers.

No AI will ever be complete or human, but the best AI I experienced so far was in UnrealTournament. Except the latest part UT3, which spares out a lot of important options because it was adopted to and from consoles, you could modify a great range of parameters for each bot in the game.

Agressiveness, Maneuverability, Awareness, Speed of Aim, Accuracity, etc. You could even specify what weapons they prefered.
Especially in teamgames, these bots acted together and much more important: They learned! You could sometimes gain an advantage by using a flank attack or sneak into the base by using a hidden shortcut, but the next time you tried this, you had a bot waiting to take you out, so you had to come up with something new.

This was in the original UT-game from 1999, so I just can't believe those who still insist something like this is impossible, yet.

VW-IceFire
01-04-2008, 11:57 PM
Originally posted by Capt.LoneRanger:
The question is, why is it so difficult to apply a decent AI to some games or if it is remains a simple question of priorities from the producers.

No AI will ever be complete or human, but the best AI I experienced so far was in UnrealTournament. Except the latest part UT3, which spares out a lot of important options because it was adopted to and from consoles, you could modify a great range of parameters for each bot in the game.

Agressiveness, Maneuverability, Awareness, Speed of Aim, Accuracity, etc. You could even specify what weapons they prefered.
Especially in teamgames, these bots acted together and much more important: They learned! You could sometimes gain an advantage by using a flank attack or sneak into the base by using a hidden shortcut, but the next time you tried this, you had a bot waiting to take you out, so you had to come up with something new.

This was in the original UT-game from 1999, so I just can't believe those who still insist something like this is impossible, yet.
But really that AI was deadly simple because the game mechanics were allot more simple as well. That AI just had to move, point (in a direction), shoot, jump, and otherwise use the mechanics of the in-game weapons. And all done "on foot" (although the low gravity mode involved significant time spend not standing on something) so the complexities of how thats supposed to go are allot less. Plus that AI never used cover or had any group tactics of significant value that I remember seeing. Some of the FPS's incorporate that now as well.

IL-2 AI has allot more work to do like flying the plane, manging the engine settings, firing weapons, leading fire, engaging in limited team tactics (wingman/leader/flight, etc.), avoiding terrain, dealing with damage. I do think the IL-2 AI could be tweaked for largely visual impact so they looked a little more competent but its just not going to be easy to make them allot better.

Capt.LoneRanger
01-05-2008, 10:34 AM
Originally posted by VW-IceFire:
<BLOCKQUOTE class="ip-ubbcode-quote"><div class="ip-ubbcode-quote-title">quote:</div><div class="ip-ubbcode-quote-content">Originally posted by Capt.LoneRanger:
The question is, why is it so difficult to apply a decent AI to some games or if it is remains a simple question of priorities from the producers.

No AI will ever be complete or human, but the best AI I experienced so far was in UnrealTournament. Except the latest part UT3, which spares out a lot of important options because it was adopted to and from consoles, you could modify a great range of parameters for each bot in the game.

Agressiveness, Maneuverability, Awareness, Speed of Aim, Accuracity, etc. You could even specify what weapons they prefered.
Especially in teamgames, these bots acted together and much more important: They learned! You could sometimes gain an advantage by using a flank attack or sneak into the base by using a hidden shortcut, but the next time you tried this, you had a bot waiting to take you out, so you had to come up with something new.

This was in the original UT-game from 1999, so I just can't believe those who still insist something like this is impossible, yet.
But really that AI was deadly simple because the game mechanics were allot more simple as well. That AI just had to move, point (in a direction), shoot, jump, and otherwise use the mechanics of the in-game weapons. And all done "on foot" (although the low gravity mode involved significant time spend not standing on something) so the complexities of how thats supposed to go are allot less. Plus that AI never used cover or had any group tactics of significant value that I remember seeing. Some of the FPS's incorporate that now as well.

IL-2 AI has allot more work to do like flying the plane, manging the engine settings, firing weapons, leading fire, engaging in limited team tactics (wingman/leader/flight, etc.), avoiding terrain, dealing with damage. I do think the IL-2 AI could be tweaked for largely visual impact so they looked a little more competent but its just not going to be easy to make them allot better. </div></BLOCKQUOTE>

You think so? Okay UT-Bots don't usually run in formations, but they do react to weapon effects (increase distances against Flak-Cannons and Miniguns or when fighting with long range-weapons, etc.) and they surely teamwork and even more: They interact if you use the command-menues. And especially on higher skillsettings the bots get not only faster or aim better, but they use tactics, rushing, defending, flanking, camping, they control redeemers, use shortcuts, they even switch the ball on "BombRun" to use it as a healing-device. More than that, they can even easily adopt other playing-principles, like using cover (e.g. "Infiltration"-Realism-Mod for UT) or play ball (Deathball).
More than that, they can even fly spacefighters in a fully three-dimensional environment. Sure the flight-modell is still much simplified, but it IS the same AI doing all this and they teamwork and interact without crashing into each other all the time.

VW-IceFire
01-05-2008, 08:15 PM
I thought they didn't introduce the space ship combat until UT2004.