• Create Account

# Artificial Intuition

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.

57 replies to this topic

### #21ahw  Members   -  Reputation: 263

Like
Likes
Like

Posted 31 July 2000 - 09:48 AM

Well, I won''t be the guy summwrizing, I just can''t stop talking
On the other hand, NN stands for Neural Network. It''s one of the trends of Artificial Intelligence programming.
I never tried it, but I did Biology and a Neuron is a very simple cell that, depending on its input will emit a different message. Input come from others neurons of course, and originally from the electrical impulses of perceptor organs (eye, ears, etc).
The real thing I don''t really know how to formulate in terms of computer is the complexity of the "inside" of a neuron. The thing that make the neuron emit a message or another (actually, it''s all electrical impulses, or not).

The idea is to have lots of neurons connected to each other, and generating some sort of clever result...

But if someone had ONE just ONE example, I would be sooo grateful (not code, just the concept. Some neurons, what they do, how they connect, and why I wouldn''t use a classic branching system instead).

youpla :-P

### #22dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 31 July 2000 - 11:44 AM

I agree, I would love to find a tutorial on the net that explained it properly. I think though to explain vectors is; forget the word vector... Just treat it like a magic box (for the time being... but you shouldn''t forever ) which you supply an input and optain an output.

Template thing: If you have certain template NN''s that you could apply to a situation. These NN''s would have some based Input and Output vectors that were already supplied (for the task at hand) and would then most likely be able to handle such tasks without having to learn the whole process again

-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)

### #23egerlach  Members   -  Reputation: 122

Like
Likes
Like

Posted 31 July 2000 - 12:08 PM

Okay, I'm reading this thread, and I'm noticing a lot of confusion regarding artificial neural networks (I say artificial because we all have one in our heads, desu ne). I consider ANNs to be sort of my spécialité, so here goes:

First, some ANN specific terminology.

Neuron: The basic unit of an ANN. Recieves inputs on one side, and has one output (which may go to one or more neurons)
Synapse: The connection between two neurons
Layer: An array of neurons

The single neuron has n inputs, each of which is connected via a synapse to the output of another neuron. Each of these connections carries a weight. So, the first step in computing a neuron is to determine the net input to the neuron (neti) from the input vector (v) and the weight vector (w). This is computed using the dot product, such that neti = v.w (A note: usually the weights for an entire network are contained in a large matrix, and then one row of this matrix is used, but I'm only dealing with the single neuron here)

The second step is to calculate the activation of a neuronby passing the net input through an activation function ( a(x) ). However, usually this is the linear function (I've only seen one example where it is not), such that a(neti) = neti.

Then, the activation of the neuron is passed through an output function to determine the output of the neuron. There are roughly a dozen or so commonly used output functions, but I'm only going to mention one: the binary function. Define a threshold t, and the function is:
o(x) = 1 if x > t
o(x) = 0 if x < t
In other words, the neuron fires if the activiation is greater than t.

Now one neuron is pretty useless on its own, so to make computations more useful we generally group them into layers, and then stack the layers together, with each neuron in one layer connecting to every neuron in the next, forming a network. The following picture gives you an idea of the most common structure:

To use an ANN, first you have to train it. This is the most variable process in the network, and learning algorithms is still a relatively new field of research. I'm going to talk about the Backpropagation learning algorithm for a Fedd-forward ANN (FFANN, such as the picture above). This involves a lot of math and stuff, so I'm just going to give the basic jist of it. Initially, the network is random. So for any given input you get a random output. To train a FFANN well you must first devise a series of input/output pairs, that is, given a certain input, what should the output be. Then, you feed one input in and see what the network spits out. It'll probably be wrong. If it is, you calculate the error of the network (icky math here) and then backpropagate that error through the network, changing the weights of the connections. Then you try another input, and another, and repeat the process until the network is "good enough", i.e. a low error (0.01% or so).

Then, you should be able to give the network any input (even ones it hasn't seen before), and it should be able to give you a "good" output.

To review the example above, it takes five inputs, and then processes it down to 2 outputs by calculating the output values of all the neurons, eventually getting something on the output layer.

Now, I'd like to stress that the format I've put up there is by no means the best one for intuition. In fact it would suck. There's a lot of research going around about ANNs and creativity, and not much of it seems to be going anywhere. I'm about to start some research into three-dimensional arrays of matricies, as opposed to the traditional layers method.

But don't give up hope! If you want a network to suggest ideas for an AI, you could devise an evaluation formula to evaluate the sucess of any given idea the network had. You could then implement that as the determining factor in the training process. As you can probably see, training is really important. That's where the hard stuff is.

*Phew* Any questions? (Yes, there will be a test next week on this material)

Eric

Edited by - egerlach on July 31, 2000 7:17:00 PM

### #24dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 31 July 2000 - 12:34 PM

Wow... cool tute... Thanx egerlach for that... I always wanted someone to definitively explain it . My brain is numb now so I have no questions

-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)

### #25Ratsia  Members   -  Reputation: 122

Like
Likes
Like

Posted 31 July 2000 - 06:40 PM

egerlach : Why do you use separate activation and output functions? Couldn''t you just combine them into a single function?
Expecially if you use tanh or something similar as activation/output function.

When I read your post I wondered why did you say that activation function is usually linear but then I noticed that you had that output function too and it made more sense. In every case I have seen there has only been activation function, and naturally it has been almost always nonlinear (there wouldn''t be any reason to use multilayer networks with linear activation functions).

What kind of 3D approach are you going to take? A couple of 2D-layers and 2D input vector? It''s common method to use NNs with images.

-Ratsia

### #26Cadet Random  Members   -  Reputation: 122

Like
Likes
Like

Posted 31 July 2000 - 10:12 PM

quote:
Original post by dwarfsoft
I think though to explain vectors is; forget the word vector... Just treat it like a magic box

A vector is an ordered set (ie, array) of numbers, nothing more.

One of their popular uses is in visual programming, using a 2 or 3 element vector to represent a point or direction in 2D or 3D space.

But a vector, in the original mathematical sense, is just an ordered set of numbers

What I was meaning when I said "appropriate input/output vectors" was encoding the required info of the game state into a sequence (ie, ordered set) of numbers - these numbers would be the values on the input column of neurons. And the output is encoding the "intuititive decisions" of the system into a sequence of numbers - these would appear on the output column of neurons.

Egerlach is quite likely right when he says that this is bad for intuition - I possibly alluded to this when discussing getting training pairs...

Sam
Space Cadet''s DJ Random, Thinker, and Geek at heart.

### #27Cadet Random  Members   -  Reputation: 122

Like
Likes
Like

Posted 31 July 2000 - 10:15 PM

quote:
Original post by dwarfsoft
I think though to explain vectors is; forget the word vector... Just treat it like a magic box

A vector is an ordered set (ie, array) of numbers, nothing more.

One of their popular uses is in visual programming, using a 2 or 3 element vector to represent a point or direction in 2D or 3D space.

But a vector, in the original mathematical sense, is just an ordered set of numbers

What I was meaning when I said "appropriate input/output vectors" was encoding the required info of the game state into a sequence (ie, ordered set) of numbers - these numbers would be the values on the input column of neurons. And the output is encoding the "intuititive decisions" of the system into a sequence of numbers - these would appear on the output column of neurons.

Egerlach is quite likely right when he says that this is bad for intuition - I possibly alluded to this when discussing getting training pairs...

Sam
Space Cadet''s DJ Random, Thinker, and Geek at heart.

### #28dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 31 July 2000 - 10:45 PM

Woah! Am I seeing double . Anywho... I do understand vectors, I was just shortening my understanding of NN, which I was then informed was wrong... yay! I learn something new every day! Which is more than I do in my SQL lectures or Math lectures... Joy, sets as if we haven''t ever done predigate calculus before

But anyway, Now that we are all agreed that NN''s are gonna suck for what we were discussing its use for (I hope we all agreed right?) what can we use instead? As someone who just learned that he was wrong should always do... my long dark jacket fans out behind me as I disappear back into the shadows...

(I''m not joking about the jacket... I do this often, with a long black coat that allows me to sneak around in the shadows . Unfortunately it is not quite Matrix style material, but it IS effective )

-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)

### #29Paul Cunningham  Members   -  Reputation: 122

Like
Likes
Like

Posted 31 July 2000 - 11:35 PM

I''ve read it twice now and it''s still sinking in. I think i''ll skip the exam for now Time to read it again

I love Game Design and it loves me back.

Our Goal is "Fun"!

### #30dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 31 July 2000 - 11:51 PM

I printed it out, so that it is there at the most crucial times... Maths and SQL lectures

-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)

### #31ahw  Members   -  Reputation: 263

Like
Likes
Like

Posted 01 August 2000 - 12:35 AM

ROFL

I am that bad at explaining my thoughts ?
Then I am sure it''s not my brain I''ll try to recreate if I ever get far enough into AI

But I agree on one point, if NN don''t seem appropriate what do we use ?
I had to ideas in mind : a script language that the computer would be able to write (some sort of assembly then ?)
And something to analyse causes and their effects (a sort of ... Z notation ? regular expressions ? still trying to find a good idea on that )

youpla :-P

### #32dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 01 August 2000 - 12:46 AM

LMAO! You're not that bad at explaining your ideas, but after being drilled with all that SQL and math stuff in lectures, my sponge is already full . I thought your NN desc. was the best I have read (and I have actually read some ). BTW. I would just like to state this as I am doing Databases@uni:I AM A PROGRAMMER... I AM DEFINITELY NOT HERE TO DO YOUR DAMN DATA ENTRY! I remember reading something like that in the Hacker FAQ .

What I would like to see is variable scripting, or dynamic scripting. Self modifying of course... It is the ONLY way that you can have learning and therefore probably the ONLY way to get Artificial Intuition to work. I would like to see any other suggestions of solutions. We could always just database it (which is like the dynamic scripting except you store the new data seperate from the script - but I class them as one in the same).

I think I rant now

-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet

Edited by - dwarfsoft on August 1, 2000 7:47:14 AM

### #33egerlach  Members   -  Reputation: 122

Like
Likes
Like

Posted 01 August 2000 - 07:20 AM

quote:
Original post by dwarfsoft
Which is more than I do in my SQL lectures or Math lectures... Joy, sets as if we haven't ever done predigate calculus before

Heh, you had to talk about calculus, didn't you (even if only predicate calc). I just possibly put the last nail in the coffin of my calculus mark... (final exam)

So, in light of that, I have to make myself feel smart. So I'm going to talk about something I actually understand (to some degree).

I think, contrary to popular belief, ANNs might be just what you're looking for for intuition. Just not the design I talked about in my earlier post. Feed-forward networks do one thing, but they do it really well: approximating functions. Now, remember that this is any function, not just those f(x) = x^2 crap you talk about in calc (aaah! Calc! *has relapse*). Any mapping of one set to another is a function.

But if we pick another design and another learning algorithm, we can get an ANN that, with a little feedback from an evaluation function looks at strategies it used in the game, and then learns to pick useful ones. If we implement noise in the network, then the choices it makes will be modified randomly. I think that this idea could work really well with a little fine tuning.

The biggest problems are:
1) encoding the situation that the AI has to respond to as a series of binary or real numbers (0..1)
2) having an output layer that is able to describe the strategy to be used
3) making a function that is able to evaluate the strategies chosen, and assign them an effectiveness.

As far as network design goes, a more "chaotic" network would be better for this idea (BTW, this is along the lines of what I'm going to try to do with the 3d matrix), that is, less of the "clear defined layers passing data from one to the next" and more "higgldy-piggldy". The learning algorithm would have to be based on a function that determines the effectiveness of a strategy after gameplay ends.

Just some ideas.

Eric

Edited by - egerlach on August 1, 2000 2:21:08 PM

### #34ahw  Members   -  Reputation: 263

Like
Likes
Like

Posted 01 August 2000 - 08:48 AM

egerlach, since you seem to master ANN, could you gently put up an EXAMPLE of why on earth you would use ANN. Something like, "OK, so far you used this method and you had that, but now take ANN, give them those functions, and lo and behold, you get the same thing, but you can get even better results." I dunno, an example of the kind of inputs I would put in, and the meaning of the final output would be nice.

I DO understand NN, as I said, it''s just the same than Real Life ™ ones (No way? Yes, I swear ! ). The thing is that I don''t visualise a situation where, "hey wait, THAT''s a situation for our Neural Network !".

youpla :-P

dwarfsoft : are you talking about MY explanation of NN ? Wow, if you are thanks So I still stand a chance to make a good lecturer.

### #35egerlach  Members   -  Reputation: 122

Like
Likes
Like

Posted 01 August 2000 - 10:01 AM

quote:
Original post by ahw

egerlach, since you seem to master ANN, could you gently put up an EXAMPLE of why on earth you would use ANN. Something like, "OK, so far you used this method and you had that, but now take ANN, give them those functions, and lo and behold, you get the same thing, but you can get even better results." I dunno, an example of the kind of inputs I would put in, and the meaning of the final output would be nice.

I DO understand NN, as I said, it''s just the same than Real Life ™ ones (No way? Yes, I swear ! ). The thing is that I don''t visualise a situation where, "hey wait, THAT''s a situation for our Neural Network !".

Master? Definitly not. Adept? Some would say yes. I''ve done a couple little things with Backpropagation and one big project. I''m just beginning to dabble into some of the other... wierder things, after reading a lot.

Okay, some examples:

My friend did a really cool project where he got a network to "drive a car". The inputs were the road, with ones being the lines on the side, sort of like this:
00100000100 - input #100010000010 - input #200001000001 - input #3
So in every succesive time cycle, in this case the car was drifting to the left. The 2 outputs from the network were an amount to turn the steering wheel left or right, and gas/brake.

I read about a network that was trained at... uh... Carnegie-Mellon (I think) to recongise human faces, and distinguish male from female. It had something like an 80% sucess rate, if I recall correctly. The input was a greyscale bitmap of the face, and the output was something that indicated if it was male or female, with a neutral answer for "not a face".

The first example isn''t great, you should be able to write a simple program to do the same thing. If you can write me a program to do the second though, I''d be really impressed.

ANNs are useful for analysing complex situations, and devising solutions similar to ones its already found out about. Ergo, I think they''d be great for helping to build a semi-intuitive system.

Now, whilst walking around today I came up with a great idea (I seem to come up with the best ideas while walking. Why? I donno). If an AI were somehow able to evaluate its position in term of attacking strength, defense strength, resources, whatever terms you can define, you could use that as the input to an ANN of some type, and get out the other end the general properties of the strategy to take (i.e. percent attack, percent defend, percent build, percent develop, stuff like that). Then that data could get passed into a fuzzy database, or dynamic scripting system, and that would determine the actual actions to be taken.

What does the AMM do in this example, you may ask. It determines whether the response to an attack will be defend or attack, for instance. I''m not sure about any details, but what do people think of this?

Eric

P.S. Can you tell I like ANNs a lot? ^_^

### #36ahw  Members   -  Reputation: 263

Like
Likes
Like

Posted 01 August 2000 - 10:43 AM

I just browsed through my leaving cert. Biology lectures, and noticed only one nice example that could be related to the way neurons work : women periods. But it''s not really helpful nor on topic. though it''s a very nicely balanced system I must say.

But I am still wondering if another system wouldn''t work.

As I said somewhere, the idea is to take a massive amount of data and see rules in it, patterns, and eventually try to create rules ourselves by using mathematical tools such as deduction.

The reasong I was suggesting a assembly like script language is mainly because it would be easier for the machine to write (well ... I guess ).
Oh, BTW, dwarfsoft, don''t give up on Databases just yet, at the end they talk about data analysis, data mining, even BSP ! I know, I didn''t listen. But I had to learn all that for the finals. So there is some use to Databases as well !!!

BTW, do you know what SQL stands for ?
Suicide is QewL.

youpla :-P

### #37ahw  Members   -  Reputation: 263

Like
Likes
Like

Posted 01 August 2000 - 12:44 PM

Well, egerlach. It happens that I have ideas for having a "global" situation. I would to use this for a "commander" AI, that would decide of an overall strategy (in a RTS).
BAsically, you use the concept of "Influence map" (there is an article about it on gameai.com).

You have several representations of the map as arrays, bitmaps, fields...

Imagine this example :

you have one "control" bitmap : you divide the map into tiles that represent the amount of control by each side. The example would be shades of red for the enemy, shades of blue for us, and purple for mixed. Then all units buildings emit a "halo" of control around them.
Then you could have a field of vectors (a flow map ?) where all units would be represented with their movement vectors.
Now mix the two, and you would see the heat propagate, according to the flow map, you could kinda predict massive offensive ...

Just take the control bitmap thingie. By looking at the bitmap you can see :
conflict zones : everything in purple means that there are units from both sides involved, the width of the zone indicates the size of the conflict.
offensives : a big red cloud.
if you have a time related bitmap, where the intensity of the control value decrease slowly with time rather than just disappear, you get trails behind moving units, you would even have very bright trails for roads (especially for harvesters uits that always go to the same area...).

I think you get the idea.
Basically you try to find defining characteristics and store them as something easy to cross with other characteristics. (flow map and control bitmap here)
But this doesn''t really help for patterns of events, nor for non-map-position related stuff.

The way I see it, you need ingame analysis (intuition routines, and fast reasoning based on classic algorithms), and debriefing analysis (much more detailed, this phase will create new "intuitions" that can be used later) that doesn''t occur during the game sequence, which means we don''t have to worry about CPU .

Maybe this gives you some ideas.

oh egerlach, the face recognition is really easy,you know. You just need some filters that will emphasis pilosity, bone structure (males have a bigger jaw and chin), Adam apple (the bump on your throat, you know), hair length (very lame criterion, but hey). Then just mix the results. Some young girls do have a bit of hair on the upper lips, some males would have very fine jaw, the Adam''s apple is a bit hard to see on a photo, depending on the light... hehe, doesn''t it sound much easier suddendly ?

youpla :-P

### #38egerlach  Members   -  Reputation: 122

Like
Likes
Like

Posted 02 August 2000 - 08:57 AM

ahw, I think that control bitmap/flow map idea is really neat, although I''m pretty sure I''m just ignorant to the game AI realm. I''m not a game AI buff, per say, I''m into more "academic" AI... and then gaming on top of that .

The reason I like ANNs is their ability to deal well with new situations that don''t fit any of the concepts they know about. Which is why I''m going to be stupidly stubborn about them being in someway useful here. Now, an ANN couldn''t do it on its own for sure. But I think it would fit well into that "intuition routines" part of your "ingame analysis", providing an intuitive direction for strategising. Of course, then you''d need traditional (or non-traditional) techniques to help with the input and/or expand on the output.

Well, yes, you can do image ananlysis... must admit I don''t know much about that... but what kind of accuracy do you get from it? I wouldn''t be that surprised if it beats the AI... but...well do you know?

Eric

### #39ahw  Members   -  Reputation: 263

Like
Likes
Like

Posted 03 August 2000 - 03:55 AM

Well, game AI is really just AI twisted to the need of gameplay I guess.
At least, I have been convincing my lecturers every year of this, and they consistently gave me good marks, even though in France most "academic" teachers think game programming is more about playing games than anything ... and if you are a wannabe game programmer it''s equally hard to understand what Maths and Databases, and Softare Engineering and the likes can give to you ... anyway, you''ll see soon enough I guess.

As for bitmaps, s I said, they are a nice way to represent things for a human mainly. I don''t think the machine gives a damn about it.
As well, a bitmap would match, as I described, the map on which the game is played (assuming RTS again).
But it would still leave us with quite a bunch of data to look at.

At the end of the game, you should have things like :
Unit 1 detects Unit 36. (you can the ask unit 36 identity and stats) Units 36 fire Unit 1. Unit 1 destroyed by Unit 36. Unit 2 collecting. Unit 36 moves. Unit 2 destroyed by unit 36. And so on ...
by looking at unit 36, you see it was an enemy, and it wiped out your two little harvesters (1 and 2) after a single shot ! ... now they''ll know when to run and when to collect.
A simple analysis in game would be that a unit of same type as unit 1 and 2 should avoid enemy units of same type than uint 36.
A complex analysis (made during debriefing) would show that harvesters units got crushed by most enemy units, thus you should make them avoid all enemy units. Units that had allies nearby survived ? Then harvesters should be guarded by nearby units if possible. Enemy infantry never hit a harvester ? Then ignore them.
Of course the difficulty is to build those statements I just made...

We have ANN, so let''s give a nice example of a simple scenario please. And let''s look to other solutions. Any ideas ? Maybe a scripted language ? I really like this idea, as computer generated programs that you give to units, would also give us a nice possibility of using genetics ... new generations of tanks would get cross breed of old tanks programs, and try new random version .. why not ?

though I don''t like the idea of giving in to the "trendy AI" stuff. I''d like to see a first draw, maybe using good old branching. I''ll have to write that down to see what it would look like...

youpla :-P

### #40pax  Members   -  Reputation: 122

Like
Likes
Like

Posted 03 August 2000 - 05:01 AM

For an ANN, why not use info about a unit or character and info about yourself, output would be your stance toward that unit. Depending on the domain information, this could be a fairly small (and therefore fast) net that can be used for each unit/char. Take the output for each unit and feed that into another net to get the general mood of the situation out of another net. Use your stance toward each unit and the general mood to plan what you will do: Command other units; Attack outright; Retreat; Negotiate; Ignore; etc...

How does that sound?

Pax

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