Hello everyone, welcome to another one of my blogs! Today, we will look at artificial inteligence, and to be more precise, neural networks. Lets get right in! So, what exactly is a neural network? Well, its a network of neurons, in this case we will simulate them.. thats why its artificial inteligence. Whats a good example of such neuron network? For example your brain is. So, how does it exactly work? Well, there is commonly 1 neuron, that connected to alot of others for the input, and also connected to lots of others for the outputs. What can we do with like 1 neuron tho? Well, we can train it, and use it for various things. In real life, you can commonly input some frequency, that makes the neuron feel good or bad(cause pain), and we can use this to signal the neuron if the decision was good. For example, lets make a neuron, which will only store 2 things, which will be the score if it chooses the correct, and the incorrect option.. however we can store this with just one value, and if its positive than it will likely choose the first, if negative then the second. So, the value will intially be zero, and intially we have to make the neuron choose randomly, for our algorythm to work. This is also called neuron mutation. So lets make a simple simulation, like this: Intial value: 0 Generations: 5 Correct(option >0): 2(40%) Incorrect(option <=0): 3(60%) After value: 5 (the > 0 was always correct option) So, the answers were now completely random. Now, lets use the already existing data, so the value 5 inside the "neuron": Intial value: 5 Generations: 10 Correct: 9 (90%) Incorrect: 1(10%) After value: 15 So, why was it 9 and 1 instead of 10 and 0? Well, I still kept the mutation value on about 30%, so it was still a bit random. All this is nice, but how is this useful in any way? Well, this is not very useful, just guessing between two values, but lets try to make a network that could run game like doom, shall we? We can make a simple network, each controlling one control of the player. One, that will control the movement, and one that will control the camera turn and shooting. So lets do it! First of all, we have to make some sort of punishment for it. Here, we can simply punish both of the neurons for damage/death, and reward them for every kill. What will be our input? Well since doom is technically 2D, but from the shooting itself just 1D game, we can essentially just catch all the visible enemies, and let the neuron know, if its for example to the left. Neuron 1: Input: direction, distance from enemies Output: movement on 2 axis. Neuron 2: Input: how many points to axis is the closest enemy Output: shoot[y/n] and move the camera by certain angle Now that we would have that, we need to get to the actual training. This will result in propably several days, before the neurons get any smart, but still preety cool thing to try! That would be about it for today, see you soon everyone!