Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

AI for SE


Homicidal Monkey
 Share

Recommended Posts

(AI = Artificial Intelligence)
well, its almost time to make a decision as for what form of Artificial Intelligence to use in SE and there are two ways that I know how to process it.

Logic-Based System:
A logic-based system uses just checks for determining what to do. Nothing special other than that.

Neural-Network System:
A Neural Network system simulates a brain and can modify how it behaves to benefit itself.

I have had experience writing both so difficulty isn't an issue.
Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Neural networking will have it's flaws though.

Running a neural network for an active game using on average of ~5-20 people on at a time each on their own map with ~3-6 npc's per map would cause ALOT of lag and un-needed CPU usage.

I vote logic.
Link to comment
Share on other sites

@Umbra!:

> Neural networking will have it's flaws though.
>
> Running a neural network for an active game using on average of ~5-20 people on at a time each on their own map with ~3-6 npc's per map would cause ALOT of lag and un-needed CPU usage.
>
> I vote logic.

it actually depends on the number of neurons used. I was thinking along the lines of at most 10 neurons total and having the entire npc system function as a single entity.
Link to comment
Share on other sites

@Zetta:

> it actually depends on the number of neurons used. I was thinking along the lines of at most 10 neurons total and having the entire npc system function as a single entity.

Hmm. Yeah that could work.

My knowledge on neural networks is limited, but I do know that they are very taxing and it's rare to use them in all but the most complex games.

Maybe an option for either?
Link to comment
Share on other sites

Would it be possible for you to code both in?

This way the person making the game could chose between which style he wanted the monster to be?

Also HM, Have you made it possible to allow monsters to use spells?
Link to comment
Share on other sites

NN may require more computation though.

@Zyvo:

> Would it be possible for you to code both in?
>
> This way the person making the game could chose between which style he wanted the monster to be?
>
> Also HM, Have you made it possible to allow monsters to use spells?

If I remember correctly, the NPC's AI is an imported Java Class, so you can write your own AI for it.
Link to comment
Share on other sites

@Zetta:

> (AI = Artificial Intelligence)
> well, its almost time to make a decision as for what form of Artificial Intelligence to use in SE and there are two ways that I know how to process it.
>
> Logic-Based System:
> A logic-based system uses just checks for determining what to do. Nothing special other than that.
>
> Neural-Network System:
> A Neural Network system simulates a brain and can modify how it behaves to benefit itself.
>
> I have had experience writing both so difficulty isn't an issue.

Option 3\. Defy nature. Create life.
Synthetic life.
Create… AI.
Link to comment
Share on other sites

Before I cast my vote I'd like to address my thoughts on the subject thoroughly.

Logic vs Learning:

To understand the difference between the two we ought to take a basic scenario and place two NPCs there in to compare the behaviors of each.  The setting is a map with an aria for "Indoors" and an aria of "out doors" and a weather variable of raining or not raining.  The NPCs must stay dry in the rain and both have the means of doing this by going in doors or it may suffer a consequence.  In our scenario the consequence is a chance of catching a cold, and then the possibility of termination.

Logic, a system of checks and actions, is preprogrammed to search out the indoor aria when it rains.  It's automatic and very fast, meaning it has almost no chance of getting dangerously wet.  A Neural brain must learn to do this same behavior, via random trials and error, with enough efficiency to survive at a competitive rate with the logical NPC.  The only problem with this it that it takes time to learn even this basic answer.

Depending on the size and strength of the neural NPC it can be any where from twice as, to ten times as slow as the Logic NPC. This means that the Neural NPC may die off as much as ten times more than the Logical NPC.  Clearly in this simplistic environment the Logical NPC would be the Logical choice because it's simple brain is all that's needed for the task. 

But live, even in a simplistic digital world is more complex than that scenario, isn't it?

Lets give the two NPCs two more options other than simply going in side.  First we'll add an Umbrella, second we'll add a rain coat.  With these two items well also modify the weather from two states, to five states.  Clear, over cast, drizzling, raining and storm. 

With each option the brain must become more complex in both it's construction and it's function.  Logic now has a LOT on it's plate.  It must in effect have an answer to every possible combination of weather, arias, and items built in.  In order to find the answer it must first proses all the information one scenario check at a time, and it must do this each time the conditions change.  Suddenly all of this processing has slowed down the Logical brain.  It may not be a problem for one NPC per game, but in game you will have hundreds running about logically deducing if they should take their umbrellas out or leave them at home.

Neural NPC, faced with the same problems, at first has no idea how to react.  In stead of processing what it ought to do it picks some thing at random and tries it.  If it works and the NPC remains dry the Neural connection grows and it will most likely repeat the same action again with out resorting to  a random test.  How ever if the NPC becomes wet it will weaken the Neural connection and try another random action.  While this takes time and, at the start just as much if not MORE processing power than the Logical NPC over time the pathways of the strong Neural brain will make a decision in any given situation almost instant.

So what does this mean for a game that some one will want to play?  While the weather may be an interesting innovation in a game most of us will agree we'd rather fight the NPCs than watch them put sun shine yellow rain coats on. So lets run our Logical and our Neural NPCs through a little fight.  Both will hunt for you to try and hurt you, and both will have advantages and disadvantages for a game, depending on the game setting and theme.

Once more we'll start with Logic.  From the moment it spawns Logic starts to search out a player for the simple task of killing him/her.  Starting on it's one tile it scans the tiles around it.  First it scans one then two, then three in front, then two to each side, and finally one in the back.  The order in which it scans can be randomized, but the effect in the end will be the same.  Should it find a player in one of it's searched tiles it will move towards this tile.  If it finds a player next to it by a search it will automatically attack said player. 
The plus side to this is it's a very simple search and destroy program.  It does not take much to process the information and it can be done very quickly.  The down side is once a player has figured out it's patterns of attack it will not be very difficult to over come.  In other words it's a good NPC mindless zombie for game grinding.

The Learning NPC by contrast must learn how to hunt.  It starts out with the same basic set of rules as the Logical NPC, but it executes them in a different way.  Killing, like staying dry, must be some thing it has to practice at.  But in addition to killing it can handle much more.  It is a creature that can also run away and hide depending on it's situation.  If you are much stronger than the NPC it can turn tail and run, but if you are weaker it will eat you up.  Adding further still it could modify it's behavior by reason of more than one player or NPC.  If it detects other NPCs like it it may become more aggressive.  How ever if it's out numbered it will most assuredly flee.
The Pros for an NPC that can learn and modify it's behavior is a more interesting and varied environment in the game.  The cons for this more intelligent NPC is that  it may take much more time to kill them and in the end, with an "older" NPC, you could even find your self in trouble you were not prepared for.  This kind of NPC would not be appropriate for games where your items come primarily from NPC Drops.

Logic is a good NPC to set up for very simple and basic scenarios.  It makes good gate guards, automated hunters, and any thing else with a low number grind task.  it's quick, and it's efficient.
Neural NPCs have a learning curve and in the beginning of the curve may not be very effective in any given task, but they become quicker and smarter for every action they preform.  They are good shop NPCs, pets, and wild animals.

A word on hybrid NPCs:

An NPC that uses both logic AND neural networks would more accurately simulate a real brain.  (According to my understanding.)  Every thing would first pas through a set of logic gates before hitting the neural network.  The logic gates would act as a sort of "instinct" layer.  If some thing hurts the NPC it would instantly move to a different tile, then the information would process in the Neural network where the incident would be "remembered".  The down side is this is a very complex system and not really viable for an MMO at this point time for Eclipse.  (Unless HM is as awesome as we all know he is!)

If we can have BOTH AI systems then that is my vote.  Other wise I'd have to go with Logic on the grounds that in the long run it can be used for more than just NPCs.
Link to comment
Share on other sites

@TT:

> Before I cast my vote I'd like to address my thoughts on the subject thoroughly.
>
> Logic vs Learning:
>
> To understand the difference between the two we ought to take a basic scenario and place two NPCs there in to compare the behaviors of each.  The setting is a map with an aria for "Indoors" and an aria of "out doors" and a weather variable of raining or not raining.  The NPCs must stay dry in the rain and both have the means of doing this by going in doors or it may suffer a consequence.  In our scenario the consequence is a chance of catching a cold, and then the possibility of termination.
>
> Logic, a system of checks and actions, is preprogrammed to search out the indoor aria when it rains.  It's automatic and very fast, meaning it has almost no chance of getting dangerously wet.  A Neural brain must learn to do this same behavior, via random trials and error, with enough efficiency to survive at a competitive rate with the logical NPC.  The only problem with this it that it takes time to learn even this basic answer.
>
> Depending on the size and strength of the neural NPC it can be any where from twice as, to ten times as slow as the Logic NPC. This means that the Neural NPC may die off as much as ten times more than the Logical NPC.  Clearly in this simplistic environment the Logical NPC would be the Logical choice because it's simple brain is all that's needed for the task. 
>
> But live, even in a simplistic digital world is more complex than that scenario, isn't it?
>
> Lets give the two NPCs two more options other than simply going in side.  First we'll add an Umbrella, second we'll add a rain coat.  With these two items well also modify the weather from two states, to five states.  Clear, over cast, drizzling, raining and storm. 
>
> With each option the brain must become more complex in both it's construction and it's function.  Logic now has a LOT on it's plate.  It must in effect have an answer to every possible combination of weather, arias, and items built in.  In order to find the answer it must first proses all the information one scenario check at a time, and it must do this each time the conditions change.  Suddenly all of this processing has slowed down the Logical brain.  It may not be a problem for one NPC per game, but in game you will have hundreds running about logically deducing if they should take their umbrellas out or leave them at home.
>
> Neural NPC, faced with the same problems, at first has no idea how to react.  In stead of processing what it ought to do it picks some thing at random and tries it.  If it works and the NPC remains dry the Neural connection grows and it will most likely repeat the same action again with out resorting to  a random test.  How ever if the NPC becomes wet it will weaken the Neural connection and try another random action.  While this takes time and, at the start just as much if not MORE processing power than the Logical NPC over time the pathways of the strong Neural brain will make a decision in any given situation almost instant.
>
> So what does this mean for a game that some one will want to play?  While the weather may be an interesting innovation in a game most of us will agree we'd rather fight the NPCs than watch them put sun shine yellow rain coats on. So lets run our Logical and our Neural NPCs through a little fight.  Both will hunt for you to try and hurt you, and both will have advantages and disadvantages for a game, depending on the game setting and theme.
>
> Once more we'll start with Logic.  From the moment it spawns Logic starts to search out a player for the simple task of killing him/her.  Starting on it's one tile it scans the tiles around it.  First it scans one then two, then three in front, then two to each side, and finally one in the back.  The order in which it scans can be randomized, but the effect in the end will be the same.  Should it find a player in one of it's searched tiles it will move towards this tile.  If it finds a player next to it by a search it will automatically attack said player. 
> The plus side to this is it's a very simple search and destroy program.  It does not take much to process the information and it can be done very quickly.  The down side is once a player has figured out it's patterns of attack it will not be very difficult to over come.  In other words it's a good NPC mindless zombie for game grinding.
>
> The Learning NPC by contrast must learn how to hunt.  It starts out with the same basic set of rules as the Logical NPC, but it executes them in a different way.  Killing, like staying dry, must be some thing it has to practice at.  But in addition to killing it can handle much more.  It is a creature that can also run away and hide depending on it's situation.  If you are much stronger than the NPC it can turn tail and run, but if you are weaker it will eat you up.  Adding further still it could modify it's behavior by reason of more than one player or NPC.  If it detects other NPCs like it it may become more aggressive.  How ever if it's out numbered it will most assuredly flee.
> The Pros for an NPC that can learn and modify it's behavior is a more interesting and varied environment in the game.  The cons for this more intelligent NPC is that  it may take much more time to kill them and in the end, with an "older" NPC, you could even find your self in trouble you were not prepared for.  This kind of NPC would not be appropriate for games where your items come primarily from NPC Drops.
>
> Logic is a good NPC to set up for very simple and basic scenarios.  It makes good gate guards, automated hunters, and any thing else with a low number grind task.  it's quick, and it's efficient.
> Neural NPCs have a learning curve and in the beginning of the curve may not be very effective in any given task, but they become quicker and smarter for every action they preform.  They are good shop NPCs, pets, and wild animals.
>
> A word on hybrid NPCs:
>
> An NPC that uses both logic AND neural networks would more accurately simulate a real brain.  (According to my understanding.)  Every thing would first pas through a set of logic gates before hitting the neural network.  The logic gates would act as a sort of "instinct" layer.  If some thing hurts the NPC it would instantly move to a different tile, then the information would process in the Neural network where the incident would be "remembered".  The down side is this is a very complex system and not really viable for an MMO at this point time for Eclipse.  (Unless HM is as awesome as we all know he is!)
>
> If we can have BOTH AI systems then that is my vote.  Other wise I'd have to go with Logic on the grounds that in the long run it can be used for more than just NPCs.

Interesting thoughts there, TT. I know most people won't even take time to read that, but i did. :P
Link to comment
Share on other sites

Thank you INH, I appreciate it.  With AI added to the list of things we could have I think it's a matter we should look forward to.  Some thing that should take a few moments of our thought and consideration.  AI, after all, is more than just a way to add neat features to the game.  It's a way to advance game making for the masses over all. 

I'll have to consider heavily the implications of having AI in any possible future games I make.  AI could be used to extend the plot heavily if used with the right NPCs.

I just wish others were as interested as HM and I were in this subject.
Link to comment
Share on other sites

I was actually leaning towards using a "hybrid model".
About 6 months ago, I programed a neural network that was extremely generic. It built thousands of neurons (unconnected). Each neuron path represented a specific action and result. So when a particular action fired a neural event, it would pass through each level of neurons, filtering it to the ones that held results. It was at that point that the strongest connection chose the best move.

I will most likely not use thousands of neurons, possibly only 10 to determine simple things such as:
-When should I fight?
-When should I run?
-When should I stalk?

Ill probably have a few pre-trained archtypes to set npc's behaviour to so they will be more logic driven, but a small neural network would exist for AI perfection.
Link to comment
Share on other sites

Well I havent been able to bee on much lately but this is very interesting.

I also agree that a hybrid model is the best route…
Besides, I beleive the choice is AI or no AI... like... I cant have my stupid slime use the same exact AI system as a city guard.

I think, based on their purpose, some NPCs will require more of a logic based AI and some others would need a NN style system.

Take the slime... a slime should only "think" 'need food, player is food, attack player." The slime shoudlnt care about risking death because it only knows its need to eat food.

Now look at a city guard. They should be able to have some event or trigger happen. Lets say we have two waring races. Logically we could say, there is the opposition so we attack, but with a neural network we can analyze the situation. We can say, there is one of them, two of us, lets attack, or OMG there are 30 of them, run script to lock the gates and/or call all guards.

I think i have a very basic understanding of how they work "behind the scenes" but in the end i think NN or some hybrid is best.

When it comes to the logic checks and neurons, will there be some system to see how they work and edit them or add more?
Link to comment
Share on other sites

Yeah like there should be some instinctual behaviors to set an NPCs general "class" if I could use the term. Like more passive prey-type animals will be more willing to run than to fight when a threat is detected. But although a young doe will run or freeze when it detects a threat, a buck deer in it's prime might take a defensive posture or even charge if the threat is close enough.

One thing I like about the game Mabinogi is the combat is very interesting because the creature AI is interesting. They seem to act somewhat naturally of their own volition; foxes will keep their distance but stay near you, and if they see an opening they might attack then run away, but usually they will just watch you but stay away. The animals don't know how to deal with arrows though, except for getting mad and rushing you if they survive the first shot!

But the creatures seem to be able to evaluate their strengths to their perceived threats and act accordingly. When I was weaker foxes would be more willing to openly attack me, but now they never do unless I give them an opening, and wolves are similar although they are still more aggressive since they are strong (but they circle me much more than they used to; they used to just maul me ASAP!).
Link to comment
Share on other sites

@Anna:

> Yeah like there should be some instinctual behaviors to set an NPCs general "class" if I could use the term. Like more passive prey-type animals will be more willing to run than to fight when a threat is detected. But although a young doe will run or freeze when it detects a threat, a buck deer in it's prime might take a defensive posture or even charge if the threat is close enough.
>
> One thing I like about the game Mabinogi is the combat is very interesting because the creature AI is interesting. They seem to act somewhat naturally of their own volition; foxes will keep their distance but stay near you, and if they see an opening they might attack then run away, but usually they will just watch you but stay away. The animals don't know how to deal with arrows though, except for getting mad and rushing you if they survive the first shot!
>
> But the creatures seem to be able to evaluate their strengths to their perceived threats and act accordingly. When I was weaker foxes would be more willing to openly attack me, but now they never do unless I give them an opening, and wolves are similar although they are still more aggressive since they are strong (but they circle me much more than they used to; they used to just maul me ASAP!).

Yeah, i'm pretty sure the AI of Mabi is a simple Hybrid system like TT was talking about. Abit very simple.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...