• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
frogtag

Artificial Neural Networks

72 posts in this topic

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!
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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).
0

Share this post


Link to post
Share on other sites
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.

0

Share this post


Link to post
Share on other sites
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]
0

Share this post


Link to post
Share on other sites
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!
0

Share this post


Link to post
Share on other sites
[QUOTE]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![/QUOTE]

Explain how this is going to work.
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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!
0

Share this post


Link to post
Share on other sites
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...)
0

Share this post


Link to post
Share on other sites
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!
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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.

0

Share this post


Link to post
Share on other sites
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]
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
Let's say I want to learn the XOR function -- a classic example from the early days of ANN research. One method might be to use a multi-layer neural network which "learns" XOR. Fine. Here's another (this is an intentionally-simple example): I'll store a 2d array and say that my estimate of "a XOR b" is simply given by the value in the array, "array[a][b]." Then, here's my learning algorithm:

Given training input (a,b) and training output c, I'll perform the following update rule:

array[a][b] = gamma*c + (1 - gamma)*array[a][b]

where gamma is a real number between 0 and 1 which is my "learning rate." (I'm assuming "array" is an array of doubles or some other approximations of real numbers.)

This will learn XOR.

Why should I use a neural network instead of this?

;-)
0

Share this post


Link to post
Share on other sites
@danmar

No they don't. They cant model intuition, creativity and hunches. Which is the core of human biological thinking. They dont solve equations* nor can they prove theorems.

If as Sneftel suggests that ANNs in games are mostly used as classifiers (and the nonlinear nature of ANNs is not the key) then for most games Bayesian Networks would perform better, especially since game entities are trying to make decisions. With the added benefit that its reasoning is clear and you can go back and easily tune algo, game play etc based on results. kNNs too are probably sufficient (although SVM I feel is also overkill and probably poor since the training dataset probably would not be sufficient to produce best results).

Myself I am looking at ANNs for a problem where their function approximation and ability to capture interdependecies is useful, the blackbox nature of ANNs is ok since the data itself has no inherent meaning and is complex enough that any attempt using splines results in nonsense. I have used regression (as noted a simplest type of ANN) but it has not performed ideally. Of course there is a simper statistical technique I also plan to implement and test against to see which is better.

*An ANN is nothing but a directed graph connecting a bunch of functions with weighted nodes. They are an alchemical and blind way to approximate functions. I suspect I could build a 2 input 1 layer 3 output neural network with biological entities.

Using a mouse. I would have it classify colours using a series of tubes. I would show it a colour and use different sized cheeses and slight to mild shocks :( to correctly set the weights and implicitly, activation functions. Then initial choice of tube will set subsequent choice which chooses output :). It would also be able to classify new colour combos i did not train it weight.

Thus i would have trained the mouse to think like a human.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Daerax
@danmar

No they don't. They cant model intuition, creativity and hunches. Which is the core of human biological thinking. They dont solve equations* nor can they prove theorems.


I was talking about mechanics of it, the flow of information and the type of computation can be modeled after what is known about biological/chemical information processing of neurons inside the living brain. Many different "computations" can be simulated with the results closely matching biological measurements.

Blue Brain Project
http://bluebrain.epfl.ch/


I do actually agree with you, but I would phrase it differently. I'd say, intuition, creativity and such are indeed the core of human mind, which can not be simulated as it is not really understood, it's not defined properly nor it can be objectively examined or measured.

But intelligence and logic can, which I refer to as "thinking", so I would separate intelligence (thinking) from everything else as it is the only thing we _can actually judge and measure as an external observer - it is because intelligence/logic is deterministic, while everything else is chaotic, if not completely random.


Though, in some hypothetical theory ANN could simulate intuition and creativity too... if it could only spontaneously arise and evolve by itself, just like in the real world. But really, you would need to build and train fully talking AI to be able to ask about it. You can't just put partial artificial or biological network and hope to measure some numerical or voltage output to be identified as "intuition". This can only be done with logic circuits aka intelligence and deterministic algorithms.

Imagine we train some ANN to the point you can have conversation with it, and it tells you it has emotions and intuition, it can dream and it likes music, would you believe it?




Anyway, amazingly I was right about Quake bots, many of them do use neural networks, but the best part is that it's all perfectly documented and all the source code is available. Google "neural network quake bot".


Neural Bot, Quake 2:
http://homepages.paradise.net.nz/nickamy/neuralbot/nb_about.htm

The Quake III Arena Bot:
http://www.kbs.twi.tudelft.nl/docs/MSc/2001/Waveren_Jean-Paul_van/thesis.pdf

[Edited by - danmar on September 20, 2009 2:15:04 AM]
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Emergent
Let's say I want to learn the XOR function -- a classic example from the early days of ANN research. One method might be to use a multi-layer neural network which "learns" XOR. Fine. Here's another (this is an intentionally-simple example): I'll store a 2d array and say that my estimate of "a XOR b" is simply given by the value in the array, "array[a][b]." Then, here's my learning algorithm:

Given training input (a,b) and training output c, I'll perform the following update rule:

array[a][b] = gamma*c + (1 - gamma)*array[a][b]

where gamma is a real number between 0 and 1 which is my "learning rate." (I'm assuming "array" is an array of doubles or some other approximations of real numbers.)

This will learn XOR.

Why should I use a neural network instead of this?

;-)


In the real world you wouldn't use either method for such a trivial problem. Learning XOR is an Intro to AI class exercise for beginners.

Machine learning (via ANNs or otherwise) is applied where you are solving or approximating solutions to problems so complex that hand-coding a solution is either extremely difficult or impossible.

Like every other solution in the problem-solution space mapping, ANNs are good for some things and bad for others. There's no free lunch right? =)

http://www.no-free-lunch.org/
0

Share this post


Link to post
Share on other sites
@danmar

So, you do know that most ANNs are essentially just a bunch of Sigmoid Functions trained on their derivatives with some random searches to optimize the arrow weights yuh? There is nothing magical about trig, hyperbolic or logistic functions. The more modern methods are more statistically influenced and ever further away from so called 'neurons'.

A decision Tree could result in behaviour just as robust as that bot's. Maybe better cause you could look at result make sense of it and go back and modify training, pruning, entropy etc functions. Indeed the simplest AI to train and code yet yielding nice behaviour could be written in terms of decision trees or even a hierarchy of such. It would also be able to react to situations it didn't train on.

A step further, harder but clearer than an ANN but still allowing for hardcore learning and allowing for random behaviour would be a bayes net. A pretty simple one would be Tree Augmented Naive Bayes.
0

Share this post


Link to post
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
Sign in to follow this  
Followers 0