Neural Nets
Hello,Every Body:
I have a project that is online rpg game. My responsibility is AI. I want to implement the AI in each enemy during the battle. I want each enemy can have self learning during the battle. So, I want to use finite state machine and neural nets technology to implememnt it. But I don''t know how to do. Although I have read several web site about this technology. But it just give me concept. I don''t really know how to apply them,can you help me,if possilbe,give me some example or code to describe how to do it,thx
Well a finite state machine is pretty simple...
Basically you just all of your fuctions have
if state==1
do this
if state==2
do this
if state==3
do this
Although its ussually better set up with classes and such.
As for Neural nets... I''m not entirely sure, hes what I''ve got about them.
Basically, you take all the data you can gleam from an event, and assuming you had X independent data results (from whatever)
you would plot that in X dimensional space. Then you can predict outcomes by comparing them to the nearest outcome in that space.
That may be completely off... I don''t really know.
but heres an example.
In voice dictation, to simulate learning, the record the pitch, tombre, vibrato, volume, and length and whatever else about each letter you make. Then it plots it in N-dimensional space. Then when you say something else, it plots that and finds the closest entry, and plots that letter from that entry.
Again, about neural nets I may be completely off... I''m interested in knowing if I''m at all correct.
Basically you just all of your fuctions have
if state==1
do this
if state==2
do this
if state==3
do this
Although its ussually better set up with classes and such.
As for Neural nets... I''m not entirely sure, hes what I''ve got about them.
Basically, you take all the data you can gleam from an event, and assuming you had X independent data results (from whatever)
you would plot that in X dimensional space. Then you can predict outcomes by comparing them to the nearest outcome in that space.
That may be completely off... I don''t really know.
but heres an example.
In voice dictation, to simulate learning, the record the pitch, tombre, vibrato, volume, and length and whatever else about each letter you make. Then it plots it in N-dimensional space. Then when you say something else, it plots that and finds the closest entry, and plots that letter from that entry.
Again, about neural nets I may be completely off... I''m interested in knowing if I''m at all correct.
Well, you''re right about the voice dictation. But what you have to realise is, that neural nets GENERALIZE, and they don''t provide a solution out of nothing. You have to train them with input and target data. Therefore I don''t think you can use them for overall tactics, unless you have some sample-data.
You could however use neural nets for targeting, economics and production systems etc...
About the technology, I have a DLL which can create *any* kind of neural net and train it. You can easily modify it to have multiple nets. I''ll be posting it somewhere soon.
Edo
Edo
Hi,
As edotorpedo said, NN''s (Neural Nets) need to be tought. To try and put it simply. You start off with a number of ''Neurodes'', effectively, these are just nodes in the network, that form the main structure. In between all of your Nodes, you have connections, with varying weights, and the Nodes can, if you want, have some bias also.
So what we do when we want to create a Neural Network is fisrt design the Network architecture, i.e. inputs, outputs, and hidden layers. So, we''ll use an example:
I made a game that used Neural Nets to play pong, so the inputs are: The x-coordinate of the ball.
The y-coordinate of the ball.
The direction of the ball.
We therefore have three inputs, the output is the desired x-coordinate of the bat. So we design the Network. (Incidentally, it doesn''t matter how the whole network is composed, it can take some fiddling to find a good one, but I''m led to believe that it should constrict as it goes from Input to Output).
so, the architechture may be:
x
x
x x
x
x
But each node needs to have a weighted connection to the other nodes, of course this can be zero, but it needs to be a fraction, either positive or negative, less than +/- 1. We randomly assign these values at first.
Now you need to make it learn, so what you do is give it a training set, with a set of input values, and their corresponding output values, then use some training algorithm, I used Back Propogation (which I can''t remember the algorithm for, and can''t be bothered to find my notes either, sorry).
This algorithm will pass through the network, and apply the inputs, and get the corresponding output. It will compare this with the expected output, and get an error value. It then updates the weights on each connection within the network in order to decrease the error, what we call ''reaching a lower point in weight-error space''.
So what you have after maybe one million epochs (learning iterations) is a network that can perform a certain function. So in my example, it could track the position of the ball on the screen. But try and make the same network sort three numbers, and it''d have no chance!!! That''s the thing, once you have a NN, it is specific to the task it has been trained in, and it interpolates fairly well, but if you try and extrapolate data from it, it tends not to do so well. But the thing is, I can save my network, and it does my required function, so next time I want to use it, I don''t have to train it again. Although, you could make it learn as it goes, but be careful! As you increase the size of the training data set, the amount of data that the NN is trying to correlate could possibly become more sparse, and the performance of the NN could degrade, that''s the problem I had with my pong game when the NN learnt from mistakes, it did well other than that.
By the way, that''s just an intro to Multi-Layer Perceptrons, a fairly common NN, but there are other types that may suit the application better, and of course, there are other learning algorithms. They can be quite complex to make a general, multi-purpose one.
I have a Neural Network Component that I''ve developed, it uses the above techniques, and allows you to generate any Network architecture, and training set in simple text file format. It''s done in Delphi.
As edotorpedo said, NN''s (Neural Nets) need to be tought. To try and put it simply. You start off with a number of ''Neurodes'', effectively, these are just nodes in the network, that form the main structure. In between all of your Nodes, you have connections, with varying weights, and the Nodes can, if you want, have some bias also.
So what we do when we want to create a Neural Network is fisrt design the Network architecture, i.e. inputs, outputs, and hidden layers. So, we''ll use an example:
I made a game that used Neural Nets to play pong, so the inputs are: The x-coordinate of the ball.
The y-coordinate of the ball.
The direction of the ball.
We therefore have three inputs, the output is the desired x-coordinate of the bat. So we design the Network. (Incidentally, it doesn''t matter how the whole network is composed, it can take some fiddling to find a good one, but I''m led to believe that it should constrict as it goes from Input to Output).
so, the architechture may be:
x
x
x x
x
x
But each node needs to have a weighted connection to the other nodes, of course this can be zero, but it needs to be a fraction, either positive or negative, less than +/- 1. We randomly assign these values at first.
Now you need to make it learn, so what you do is give it a training set, with a set of input values, and their corresponding output values, then use some training algorithm, I used Back Propogation (which I can''t remember the algorithm for, and can''t be bothered to find my notes either, sorry).
This algorithm will pass through the network, and apply the inputs, and get the corresponding output. It will compare this with the expected output, and get an error value. It then updates the weights on each connection within the network in order to decrease the error, what we call ''reaching a lower point in weight-error space''.
So what you have after maybe one million epochs (learning iterations) is a network that can perform a certain function. So in my example, it could track the position of the ball on the screen. But try and make the same network sort three numbers, and it''d have no chance!!! That''s the thing, once you have a NN, it is specific to the task it has been trained in, and it interpolates fairly well, but if you try and extrapolate data from it, it tends not to do so well. But the thing is, I can save my network, and it does my required function, so next time I want to use it, I don''t have to train it again. Although, you could make it learn as it goes, but be careful! As you increase the size of the training data set, the amount of data that the NN is trying to correlate could possibly become more sparse, and the performance of the NN could degrade, that''s the problem I had with my pong game when the NN learnt from mistakes, it did well other than that.
By the way, that''s just an intro to Multi-Layer Perceptrons, a fairly common NN, but there are other types that may suit the application better, and of course, there are other learning algorithms. They can be quite complex to make a general, multi-purpose one.
I have a Neural Network Component that I''ve developed, it uses the above techniques, and allows you to generate any Network architecture, and training set in simple text file format. It''s done in Delphi.
how big are your battles? do they have 5 guys, 50 guys, or 500 guy?
you need to go about thinking how ai effects situations.
the ai to control 5 guys is different than ai to control 50 guys or 500 guys... which is differnt from ai that controls 1 guy.
for the most part, you need several layers of ai. you need a strategic ai, that can examine all units, and you need tactical ai, or ai controled by individual units.
although i realize that you want to use a neural net, i dont think you know how yet, do a pong or something first.
but, if you want to make this game, dont use neural nets, unless you have ALOT of time to develop them properly.
a better bet is to use genetic algorithms. this way, you can have a base ai that you can actually play with, and it will get harder to beat each game.
-if its on a computer, its a finite state machine.
you need to go about thinking how ai effects situations.
the ai to control 5 guys is different than ai to control 50 guys or 500 guys... which is differnt from ai that controls 1 guy.
for the most part, you need several layers of ai. you need a strategic ai, that can examine all units, and you need tactical ai, or ai controled by individual units.
although i realize that you want to use a neural net, i dont think you know how yet, do a pong or something first.
but, if you want to make this game, dont use neural nets, unless you have ALOT of time to develop them properly.
a better bet is to use genetic algorithms. this way, you can have a base ai that you can actually play with, and it will get harder to beat each game.
-if its on a computer, its a finite state machine.
In my battle system, it has 1 to 5 enemies to fight with 1 to 5 user player....
In my situation, just FSM is suitable? I want make my AI more clever and can self learning wo? How can I do?If I don''t use neural nets?
Neural Nets are optimal neuro-fuzzy bayesian classifiers, no more, no less
Don''t assume you can plug them into any game just ''cos of the hype! Read some theory
Artificial Intelligence Depot - Maybe it''s not all about graphics...
Don''t assume you can plug them into any game just ''cos of the hype! Read some theory
Artificial Intelligence Depot - Maybe it''s not all about graphics...
Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement