Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

MultiLayerNeuralNetwork

MultiLayerNeuralNetwork

NickGeorgia
NickGeorgia's GameDev Journal · · 1 min read
803 1
Here is my C# class for a Multilayer Neural Network (single hidden layer) with example. I haven't tested it much, but it seems to work. The hidden neuron activation functions are 1/(1+exp(-x)) and the output layer neurons are linear, x. You don't have to add a bias term, it will already include one to your input vector. Free for all to use just as long as you don't come back to me with problems hehe.

This differs from the perceptron because the outputs are not simple 0's and 1's. It can be any number. In the example, I train it with -x^2 and sin(x) functions within the interval [0,3.14159]

You might think of how it can be used in a game. For instance, you can train it to provide the correct outputs to a throttle or wheel turn in response to measurements from the road, velocity, etc. I plan to probably use it to train some sprites to move around in response to you shooting it (i.e. train it to be the evaluation function of a GA).

Discussion

Loading comments...