JavaScript EditorFree JavaScript Editor     Ajax Editor 



Main Page
  Previous Section Next Section

Artificial Neural Networks

Neural networks are one of those things that you keep hearing about but never seem to show up. Well, I can tell you for a fact that in the past 3–5 years, we've made leaps and bounds in the area of artificial neural networks. Not because there has been any major breakthrough, but because people are taking an interest in them, experimenting with them, and using them. In fact, there are a number of games that use extremely advanced neural networks: Creatures, Dogz, Fin Fin, and others.

A neural network is a model of the human brain. The brain consists of 10–100 billion brain cells. Each of these cells can both process and send information. Figure 12.30 is a model of a human brain cell or neuron.

Figure 12.30. A basic neuron.

graphics/12fig30.gif

There are three main parts to a neuron: the soma, the axon, and dendrites. The soma is the main cell body and performs the processing, while the axon transmits the signals to the dendrites, which then pass the signals to other neurons.

Each neuron has a fairly simple function: to process input and fire or not fire. Firing means sending an electrochemical signal. Neurons have a number of inputs, a single output (which may be distributed), and some rule for processing the inputs and generating an output. The rules for processing are extremely complex, but suffice it to say that a summation of signals occurs and the results of this summation cause the neuron to fire.

Well, that's great, but how can you use this to make games appear to think? Well, instead of trying to create something as bold as thought or consciousness, maybe you can start by modeling simple memory, pattern recognition, and learning with some computer models. Our brains are very good at these tasks, while computers are very bad. It's intriguing to explore the biological computers we have in our heads and see if we can take some ideas from them.

This is exactly what artificial neural networks (or simply neural networks) do. They're simple models that can process information in parallel, just like our brains. Let's take a look at the most basic kinds of artificial neurons or neurodes.

The first artificial neural networks were created in 1943 by McCulloch and Pitts, two electrical engineers who wanted to model electronic hardware after the human brain. They came up with what they called a neurode, as shown on the left side of Figure 12.31. Today the form of the neurode hasn't changed much, as shown on the right side of Figure 12.31.

Figure 12.31. Basic artificial neurons.

graphics/12fig31.gif

A neurode consists of a number of inputs, X(i), that are scaled by weights, w(i), summed up, and then processed by an activation function. This activation function may be a simple threshold, as in the McCulloch-Pitts (MP) model, or a more complex step, linear, or exponential function. In the case of the MP model, the sum is compared to a threshold value. If the sum is greater than a threshold theta, the neurode fires. Otherwise it doesn't. Mathematically, we have the following:

McCulloch-Pitts Neurode Summation Function

Output graphics/12equ06.gif

General Neurode with Bias

Output graphics/12equ02.gif

To see how a basic neurode works, assume that you have two inputs, X1, and X2, that can take on the binary values 0 and 1. Then set your threshold at 2 and w1=1 and w2=1. The summation function looks like this:

graphics/12equ03.gif


Compare the result to the threshold theta of 2. If Y is greater than or equal to 2, the neurode fires and outputs a 1.0. Otherwise, it outputs a 0. Table 12.3 is a truth table that shows what this single-neurode network does.

Table 12.3. Truth Table for Single Neurode Network
X1 X2 Sum Y Final Output
0 0 0 0
0 1 1 0
1 0 1 0
1 1 2 1

If you stare at this for a moment, you'll realize it's an AND circuit. Cool, huh? So a simple little neurode can perform an AND operation. In fact, with neurodes you can build any logic circuit you want. For example, Figure 12.32 shows an AND, an OR, and an XOR.

Figure 12.32. Basic logic circuits.

graphics/12fig32.gif

Real neural networks are much more complex, of course. They can have multiple layers, complex activation functions, and hundreds or thousands of neurodes. But now at least you understand their fundamental building blocks. Neural networks are bringing a new level of competition and AI to games that you've never seen before. Soon games will be able to make decisions and learn!

This is an important area of interest, but I have to watch my page count so I don't have time to cover it properly here. However, the ARTICLES\NETWARE\ directory on the CD contains an article on neural networks that will give you a more solid foundation on the topic. It covers all the various types of networks, shows you learning algorithms, and illustrates just what they can do. You'll find all the source code, an executable, and both an MS Word .DOC version and an Adobe Acrobat .PDF version of the text.

      Previous Section Next Section
    



    JavaScript EditorAjax Editor     JavaScript Editor