Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


Artificial Neural Networks


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
72 replies to this topic

#1 frogtag   Members   -  Reputation: 120

Like
0Likes
Like

Posted 09 September 2009 - 06:01 AM

I've done some preliminary research into AI, specifically ANNs. But I don't really understand the practical uses of ANNs in game programming, in regards to its ability to potentially mimic human thinking. Okay, I get the concept that you can use it in character recognition, but that has utility potential, not say for instance how a NPC will react to a situation. Can anyone give me some more practical usages in terms of NPC AI and/or direct me to some tutorials? At the moment I don't see the point in an ANN unless your interest is purely ANN research!

Sponsor:

#2 owl   Banned   -  Reputation: 364

Like
0Likes
Like

Posted 09 September 2009 - 06:33 AM

Four Cool Ways to Use Neural Networks in Games

#3 venzon   Members   -  Reputation: 256

Like
0Likes
Like

Posted 09 September 2009 - 07:05 AM

Good question!

Do You Think Neural Networks Are Useful for Game AI?

#4 Sneftel   Senior Moderators   -  Reputation: 1781

Like
0Likes
Like

Posted 09 September 2009 - 07:15 AM

Quote:
Original post by frogtag
But I don't really understand the practical uses of ANNs in game programming, in regards to its ability to potentially mimic human thinking.!
That's because it doesn't have any. Don't be fooled by the word "neural". ANNs have precisely nothing to do with how brains work. They are one tool in a quite well-stocked toolbox of machine learning techniques, and one which is not appropriate for all (or even most) AI approaches.
Quote:
At the moment I don't see the point in an ANN unless your interest is purely ANN research!
Situations where ANNs really are the best tool for the job are uncommon, but they DO exist. Until one knows the alternatives, though, it's a bad idea to assume that ANNs are the way to go. SVM and kNN are both more likely to produce good classifier results, which is what most people (are trying to) use ANNs for.

#5 Emergent   Members   -  Reputation: 971

Like
0Likes
Like

Posted 09 September 2009 - 11:38 AM

Neural networks are function approximators that you train by doing nonconvex optimization. "Backpropagation" is just gradient descent. This should immediately set off some alarm bells in your head, because nonconvex problems generally can't be solved globally -- and certainly not this way! So why should we want to use neural networks?

Me, I'll just use a table. Maybe throw in some interpolation, or use a sum of basis functions (e.g., b-splines). At least then I get a whole lot of nice Hilbert Space machinery to play with.

What's more interesting than how you approximate functions is which functions you approximate. E.g., rather than trying to learn an input-output mapping, learn the Bellman Value Function (e.g., q-learning).

#6 Álvaro   Crossbones+   -  Reputation: 13628

Like
0Likes
Like

Posted 09 September 2009 - 01:43 PM

Quote:
Original post by Emergent
What's more interesting than how you approximate functions is which functions you approximate. E.g., rather than trying to learn an input-output mapping, learn the Bellman Value Function (e.g., q-learning).

Oh, yes. I recently perused a book on optimal control and I was fascinated by the part about value iteration. I think I'm going to try to use it in a couple of places where I have used PID controllers earlier.

I have never used an ANN with more than one neuron because they didn't seem like a good idea. But I've used logistic regression, which is sort of a single-neuron ANN.



#7 EJH   Members   -  Reputation: 314

Like
0Likes
Like

Posted 10 September 2009 - 04:14 AM

This comes up often. Need a forum sticky for it? =)

Commercial games that use ANNs (pretty sure all use ANNs for NPC controllers, but I don't believe any learn in real-time during the game):

- Creatures
- Black and White
- Colin McRae Rally
- Forza Motorsport

Non-commercial, but publicly available games you can actually download and play that do machine learning during the game (both use variations of ANNs/NEAT):

- NERO:: train teams of robot soldiers in real-time
- Galactic Arms Race:: the game learns what type of weapons users prefer, then produces unique particle weapons based on learned user preferences

The main reason you don't see a huge number of ANN in games is that the majority of current game AI is simplistic enough to hand-write a state machine for. The purpose of machine learning methods is to solve problems that cannot reasonably be hand-coded (thus the complex car/track physics in Forza and Colin McRae are a good example of ANN application). Potentially, as game AI and physics becomes more complex machine learning application will increase.

Also, machine learning techniques are demonstrating the potential to automatically generate procedural game content suited to player preferences, which is bound to become popular because it increases replay value for relatively little time/effort compared to hand-made content.

[Edited by - EJH on September 10, 2009 2:14:05 PM]

#8 kryotech   Members   -  Reputation: 908

Like
0Likes
Like

Posted 16 September 2009 - 10:39 AM

Just to give you an example, my group is going to use an ANN in our new game. What it is supposed to do is categorize the player tactics and develop counters to them, and be able to recognize new tactics as well as old ones. The idea is that the AI keeps the player thinking of new tactics. Like lets say if we flanked the AI, and it worked, at least initially. So the next time this tactic is used (or while it is being used), the AI will counter the tactic, and hopefully, drive the player off. An ANN can be used to give a player a serious challenge, for those who want one. This is just an example to answer your question. Best of luck!

#9 ibebrett   Members   -  Reputation: 205

Like
0Likes
Like

Posted 16 September 2009 - 11:50 AM

Just to give you an example, my group is going to use an ANN in our new game. What it is supposed to do is categorize the player tactics and develop counters to them, and be able to recognize new tactics as well as old ones. The idea is that the AI keeps the player thinking of new tactics. Like lets say if we flanked the AI, and it worked, at least initially. So the next time this tactic is used (or while it is being used), the AI will counter the tactic, and hopefully, drive the player off. An ANN can be used to give a player a serious challenge, for those who want one. This is just an example to answer your question. Best of luck!


Explain how this is going to work.

#10 kryotech   Members   -  Reputation: 908

Like
0Likes
Like

Posted 16 September 2009 - 02:40 PM

ibebrett

We are still working out the details as of now. It's a really recent idea actually, and we just started prototyping it. We're still experimenting with it. My bad if this wasn't a good example.

#11 Álvaro   Crossbones+   -  Reputation: 13628

Like
0Likes
Like

Posted 17 September 2009 - 02:08 AM

Not to be negative, but I don't think kryotech's idea will work as described. It is possible in principle to use an ANN to "categorize the player tactics", although I would like to know what type of ANN they are planning to use, what kind of inputs it will have and what the outputs might look like. The part where the ANN will "develop counters" to those tactics sounds like some sort of fantasy.

People often have inflated expectations as to what ANNs can do, in part because early practitioners hyped them beyond the bounds of reason. I agree with this quote from A. K. Dewdney: "Although neural nets do solve a few toy problems, their powers of computation are so limited that I am surprised anyone takes them seriously as a general problem-solving tool." If anyone shows me how they can be used to solve real problems (e.g., if kryotech's group manages to get their idea working), I am willing to change my mind.

#12 LeChuckIsBack   Members   -  Reputation: 95

Like
0Likes
Like

Posted 17 September 2009 - 04:38 AM

There is a small but important practical use for ANN in games, that is speech recognition. Some of the latest games started to implement command input directly from human voice, quite funny to yell things in the mic if you ask me. There is a powerful SDK to easy implement it in a game but don't remember the name and it's not free.
"Be it enacted by the General Assembly of the State of Indiana: It has been found that the circular area is to the quadrant of the circumference, as the area of an equilateral triangle is to the square of one side. The diameter employed as a linear unit according to the present rule in computing the circle's area is entirely wrong."

#13 Emergent   Members   -  Reputation: 971

Like
0Likes
Like

Posted 17 September 2009 - 08:24 AM

Quote:
Original post by LeChuckIsBack
There is a small but important practical use for ANN in games, that is speech recognition. Some of the latest games started to implement command input directly from human voice, quite funny to yell things in the mic if you ask me. There is a powerful SDK to easy implement it in a game but don't remember the name and it's not free.


AFAIK, most modern speech recognition is based on hidden Markov models.

#14 kryotech   Members   -  Reputation: 908

Like
0Likes
Like

Posted 17 September 2009 - 09:45 AM

alvaro

No offense taken, cause as I had said earlier, it's really experimental, and we have just started looking into this idea. In fact, I really do appreciate your feedback on this, and if it is a hopeless idea, then we should stop pursuing it. Thanks for your feedback!

#15 Fiddler   Members   -  Reputation: 855

Like
0Likes
Like

Posted 17 September 2009 - 10:27 AM

I've worked with neural networks for classification and the main issue is that they require a *lot* of training for good results (and not to mention CPU power and memory).

@kryotech: as I see it, there are two parts to the problem.

1. Recognizing player tactics. You could experiment with a NN for this (the training would have to happen offline, before shipping your application).

2. Responding to the tactic. I would approach this using fuzzy logic techniques with factors determined through play-testing. You can allow some form of adaptability (if a specific AI response works, try using it again; if not, scrap it).

The important point is to give the *illusion* of intelligence, rather than trying to implement "real" intelligence. Compare Starcraft with Black & White: the first employs known and tested tactics, which are fun and challenging; the latter employs "advanced" learning techniques (1M lines of code!) which result in boring or even downright idiotic behavior.

It doesn't really matter *how* you implement this, as long as the player has fun. Don't fall into the trap of missing view of the goal(*): to make a fun game. Pull this off, and you'll likely have a commercial success at your hands.

(*) obviously, scientific/research applications are another matter entirely.

The reason why I am focusing on this point is because I have first hand experience of a NN gone wrong. The manager thought a NN was a good fit for the application. I had my doubts but didn't speak up. The NN proved impossible to train to the level we wanted and the application flopped. (For the record, a trivial state machine would have worked but the manager liked buzzwords and the rest is history...)

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]


#16 kryotech   Members   -  Reputation: 908

Like
0Likes
Like

Posted 17 September 2009 - 12:11 PM

Fiddler

Well, I guess I ended up gaining something from this forum. Thanks for your advice, that really does help us a lot. Thanks for giving us a sense of how our idea could work out. Best of luck!

#17 Daerax   Members   -  Reputation: 1207

Like
0Likes
Like

Posted 17 September 2009 - 06:03 PM

Its all in the name. Consider the names of the two most popularized ML techniques. Genetic Alogrithim based on evolution and Neural network based on the brain. Anyone who learns these techniques must be smart! I bet if I made a hare brained simple algorithm (linked list)- and gave it a fancy biology based name like Stochastic Mitochondrial Networks based on the Immune system everyone would write books on it.

Also this forum has no FAQ or stickied informant so every such repeat question on how to come up with an unbeatable A* using ANNs is deserved. Just saying.

#18 captain_crunch   Members   -  Reputation: 135

Like
0Likes
Like

Posted 17 September 2009 - 09:06 PM

Quote:
Original post by Daerax
I bet if I made a hare brained simple algorithm (linked list)- and gave it a fancy biology based name like Stochastic Mitochondrial Networks based on the Immune system everyone would write books on it.


No, you should name your algorithm after Albert Einstein. It's common knowledge that he was really smart.
So people will think: If I use his algorithm, my program will be really smart as well.



#19 EJH   Members   -  Reputation: 314

Like
0Likes
Like

Posted 18 September 2009 - 06:05 AM

Quote:
Original post by alvaroI agree with this quote from A. K. Dewdney: "Although neural nets do solve a few toy problems, their powers of computation are so limited that I am surprised anyone takes them seriously as a general problem-solving tool." If anyone shows me how they can be used to solve real problems (e.g., if kryotech's group manages to get their idea working), I am willing to change my mind.


That quote couldn't be more wrong. ANN applications abound in hard science, both research and commercial. One recent result that comes to mind is in sub-atomic particle physics:

T. Aaltonen et al., “Measurement of the top quark mass with dilepton events selected using neuroevolution at CDF,” Physical Review Letters, 2009

A simple google search would give you ANN applications in robotics and computer vision like:

http://www.nasa.gov/vision/universe/roboticexplorers/robots_like_people.html

Not to mention there is a post above with 4 popular commercial games that use ANNs. I'd say those qualify as "real problems". BTW, you might want to stop quoting that guy. His statement approaches "the world is flat" levels of wrongness. =)

[Edited by - EJH on September 18, 2009 4:05:45 PM]

#20 danmar   Banned   -  Reputation: 100

Like
0Likes
Like

Posted 19 September 2009 - 05:39 AM

Quote:
Original post by Sneftel
Quote:
Original post by frogtag
But I don't really understand the practical uses of ANNs in game programming, in regards to its ability to potentially mimic human thinking.!
That's because it doesn't have any. Don't be fooled by the word "neural". ANNs have precisely nothing to do with how brains work. They are one tool in a quite well-stocked toolbox of machine learning techniques, and one which is not appropriate for all (or even most) AI approaches.
Quote:
At the moment I don't see the point in an ANN unless your interest is purely ANN research!
Situations where ANNs really are the best tool for the job are uncommon, but they DO exist. Until one knows the alternatives, though, it's a bad idea to assume that ANNs are the way to go. SVM and kNN are both more likely to produce good classifier results, which is what most people (are trying to) use ANNs for.


Actually, many studies suggest ANN can be used quite well to model biological "thinking", as far as it can be actually tested. ANN can be trained to play chess, drive car, solve equations, recognize language or respond to visual patterns. In theory ANN could be trained to pass all the tests and in effect perfectly mimic human intelligence, even if only just to fool everyone by always providing adequate response according to previous training.

However, in theory, ANN could also learn to adapt and respond to situations it was not trained for, according to similarity of that situation to some other situation AI was trained for. So, in theory, ANN could be able to handle any logical problem of any kind, where a chance of success would depend on amount of training given for particular or similar situation. Just like with humans.

It's all about training, trial and error. Learning provides means to evolution of this microcosms, which may lead to specific adaptation, uniqueness or individuality. Quite interesting, that. Anyhow, computation is parallel so reaction time can be minimal even with very high input resolution, which is what gives biological brain a capability to process visual stimuli as high-resolution images in real-time.



I know some Quake bots are able to learn maps and adapt their play-style to particular level geometry, placement of weapons and power-ups, but also to consider human-player actions before making a final decision. I'm not know if any of them use anything like ANN to achieve this, but it seems as a good example where and how this can be done, similar to path-finding in racing games mentioned above.


In conclusion, the key words are "adaptivity via trial and error", so if you require such AI and don't plan to train it from zero, you will be needing to implement some kind of regular AI anyway. Though, once properly trained ANN might prove more efficient and smarter AI algorithm than regular, hard-coded one. The real trick is how to train it.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS