I started a Neural Network Tutorial series to show how I made the neural network in this video! Here is a link to part 1: ruclips.net/video/JXGogdI7RIE/видео.html
The bibites : digital life, it's by far the most advanced and it's also free. The creator quit his job and is working full time on the project now. You should check it out.
@@lunaticgr2925now we also have Simulife Hub, Biomaker CA, Cell Engine, Neuraquarium, and whatever Dylan Cope calls his simulation. Bit sad that most of their skill cap don't go far above "steer towards food" or "maximise sunlight"
I did a natural selection program with higher energy costs for faster speed and larger size. They ended up evolving to have negative speed so they only gained energy 😂
There are different Neural Network Training techniques, Supervised, Unsupervised and Reinforcement type. What you implemented here was reinforced technique which uses Genetic Algorithm to train the NN whereas Backpropogation is the algorithm used in Supervised learning. Good stuff btw hopefully this video blows up!
FINALLY. I’ve watched so many videos about neural networks, seen the dots connecting with lines, but never actually understood how they worked. Someone finally bothered to stop and tell me.
What a great video!! I predict your Channel is going to blow up soon. I actually coded a genetic algorithm (like you showed) for a biology essay. It was about cars learning to drive a race track and worked pretty similar. Keep your work up!
I love this!! I love evolution simulations. Ive built a few myself but never to this magnificent extent. You are implementing everything I would like to implement: neural networks and 3D graphics. Hope you can show us some more :)
Literally made something almost exactly like this, found this video when trying to solve a problem... it didnt help but was very interesting! Keep up these videos
Just had to rewatch this video. I first time watched this 1,5 years ago before I started writing my masters thesis on AI. Last week I got it granded and ended up getting grade of 4,5 (max is 5). This was one of the vids that reeled me into working with AI in Unity.
reminds me of one summer project i tried. the idea was to make a game where creatures evolve like that, I wanted to make it so the player to hunt/play in the game, causing creatures to evolve to the player presence, and also allow player to domesticate and farm them . was new at unity/programming and ended up making a snake thing that could crawl a bit. not exciting for a game, but I learned a lot. Still think a survival game where creatures evolve and adapt would be a fun game.
Wow, great video! I am looking into such simulations at the moment because I was also fascinated by the same videos by Sebastian Lague and Primer. And you did a really good job of explaining things in this video. Well done!
Very interesting video! You've got some magic coding and explaining skills good sir. A deadly combination. :) Would be interesting to train an Ai like that for a rts game but I guess it would take very long for the ai to mature
Can we just appreciate he made the oof sound as the death sound in the beginning? R.I.P. OOF SOUND 2006-2022. Also, maybe add a chat system so that they can talk to you and eventually grow up to learn English?
In my early 20s I made all kinds of AI evolution simulations like this in unity. But I always got stuck with back propagation. I never, *NEVER* thought of using death and reproduction as an alternative to backpropation, but once you said it it makes perfect sense. GAH
Hi i downloaded the project. What most important thing is that you populate the world with the most evolved creatures. Creature spawner needs to keep a list of ten most evolved creatures and populate the world with them so as to keep the evolution progressing forward. Please implement this feature and make a part 5 of this tutorial.
How does changing the weights and biases change the output... basically, whether or not a node is active or inactive, then it'll choose whether to go forwards or backwards? ?
The weights and biases control the "flow" of information through the network. If a weight is large, it means that the input it's connected to is very important and will have a strong influence on the output. If a weight is small or close to zero, then the input has less effect on the output. The biases help the network make better decisions by shifting the outputs of the activation function, allowing it to learn even when the input data isn't a perfect match to the expected results. Also In our case the output nodes are always technically active because I don't apply the activation function to the output layer. So instead there we have the 2 output nodes and if the first one is negative they will go left and if it is positive they will go right, Then the second output node works the same way but for forward and backwards.
I mean, I am a creationist, and anyone with common sense knows that evolution in this sense is impossible, but it is still fun to watch. (mostly because of the neural network)
Yeah I was planning on adding a web version of the sim to my non existent website in the next few weeks. I will probably put the code on github at some point too.
I've wanted to do that for like 15 years now. But spoiler alert: you can't do in on a home PC, even today. It's so computationally expensive (read: slow), you'd need a cluster computer (small supercomputer). (That's if you're evolving a neural net. If you're "cheating" and using statistics or other math, it's less expensive.)
There is actually a really cool RUclips channel/simulation called The Sapling and his evolution simulator actually has the ability to have creatures start off on land and eventually evolve to fly. Also, these networks are actually quite simple so the actual bottleneck of the program is the Unity stuff and not the networks themselves.
Great video, John! If you don't mind, may I ask you a few questions? You used Unity, so was every part of the code made with C#? If so, how did you manage to make neural networks with C#? And, if not, how did you integraded both languages into Unity? I'm asking this because I'm creating my own natural selection simulation, but it is becoming too complex for a browser app, so I'll be migrating it all to Unity (therefore changing all my code from JavaScript to C#). And since I'm changing it all, I feel like adding neural networks is a step I can take now. However, I've just recently started learning Machine Learning, and I only know of Python libraries and techniques to implement it. I hope you see this comment! :)
Hi Pedro! I did make the neural networks from scratch for this but the code was a huge mess and it also used an external library called Math.Net. Over the past week I made another neural network simulation to teach cars to drive around a track and I removed the need for that dependency. I have been cleaning up the neural network code as much as possible to make it easier to understand and also easier for other people to reuse this in other projects. I can add the code to git for you in a few days once it is working better. I will be making another video and tutorial about these updates soon too
@@JohnnyCodes Oh that's great to know! And yeah I would absolutely love that! I'm trying the best I can to gather info about this subject but there's still so much to learn 😅 I truly appreciate your response, I'll be looking forward these updates! :)
Very cool. I made something similar. But with prey, hunter and plant. Only hunter and prey DNA change. I decided against a size change as thought it would be too powerful. I just used basic states for the AI. Will post it on github soon.
You deserve so many more views. From you video Atleast I know that Unity and reinforcement learning can be used together. Did you have to design each neuron and the interconnection between the nodes. Before natural selection was used to train the weights? Or does unity provide a pre-made function to define the neural network structure.
I am actually planning on putting the neural network template on github as part of the neural network series I started posting today. I am planning on making the neural network template free on github but I am going to be adding the source code for the rest of my projects as a perk for Patreon members
They don't actually need to be connected to each node but that is one of the most common layers. When they are all connected like that it is called a Dense layer (You will see this term when using python libraries like pytorch or keras). When you string a bunch of these dense layers together like we did it is called a "fully connected feed forward network". People experiment with all different kinds of networks, for example the NEAT algorithm tries to figure out what connections each node should have (Using evolution of the actual network shape). There are also recurrent neural networks where previous outputs are looped back into the node as inputs, this gives networks a form of short term memory, also this would be called a recurrent network instead of a feed forward network in this case. Hope that helps clear things up a bit! Let me know if you have any other questions!
@John Sorrentino, I have been looking for a start point for a unity genetic algorithm with a NN built in to the critters. Do you have the source available?
Great stuff, and an even better explainer! Question: Do you only use asexual reproduction? Or can two parents have a child (i.e., with genetic crossover logic)? If you're still interested in the topic, the god tier of evolving neural nets is the "NEAT" algorithm -- Neuro-Evolution of Augmenting Topologies. It's been on my coding bucket list for a long, long time now.
Supervised ML can do a lot, faster. I think it would have been cool to have a day time limit and if they gained 0 food, then they would make some random changes. After 4 days with no food they die out completely. but due to random luck they could reproduce maybe once, which might help some not useful at the start gene's make their way into the future. the problem with genetic algorithms seems to be that eventually there is only one or two sets of genes left. Which means they loose their ability to adapt. It might be that way IRL too but
The scripts are on github from part 3 but I am actually planning on posting a quick unity setup tutorial tomorrow and I will also put the whole project on github. The reason I haven't done it yet is because of the Assets I used. But in tomorrows video I am not going to use any assets so I can share it.
You should make a bunch of neural networks that process different stuff from one another and some feed their outputs to others' inputs so that you'll efectively have a brain
Really though is it? I don't think it should be considered that. I mean part of machine learning is that we want to see them find ways to win. If this NN was more complex it would have been totally possible for them to learn to push off the edge intentionally, and to avoid the edge as well. The point of NN's is to have as many variables as possible without destroying your computer. Maybe its just the developer in me saying its a feature not a bug. But I think a game that does not have any room for emergent gameplay is unappealing and likely result in stale gameplay.
I started a Neural Network Tutorial series to show how I made the neural network in this video! Here is a link to part 1: ruclips.net/video/JXGogdI7RIE/видео.html
Have you considered swapping the ReLU activation function out for GELU? A bit more computationally intensive, but great to avoid vanishing gradients
thx
2:20 Shoutout to the guy that spawned underneath the map. Dude evolved his way to another plane of existence.
big brain
I've always loved natural selection simulators, it's too bad there isn't more of them.
Me too
The bibites : digital life, it's by far the most advanced and it's also free. The creator quit his job and is working full time on the project now. You should check it out.
I got you ruclips.net/video/Bfcg4tS8hpw/видео.html
@@lunaticgr2925now we also have Simulife Hub, Biomaker CA, Cell Engine, Neuraquarium, and whatever Dylan Cope calls his simulation. Bit sad that most of their skill cap don't go far above "steer towards food" or "maximise sunlight"
wdym
I did a natural selection program with higher energy costs for faster speed and larger size. They ended up evolving to have negative speed so they only gained energy 😂
Ahh, the good old "neural network finds a bug in your program for you" (also, what happened when you made it so the speed couldn't go below 0?)
lmao
I AM (REVERSE) SPEED
There are different Neural Network Training techniques, Supervised, Unsupervised and Reinforcement type. What you implemented here was reinforced technique which uses Genetic Algorithm to train the NN whereas Backpropogation is the algorithm used in Supervised learning.
Good stuff btw hopefully this video blows up!
this is amazing you truly deserve more recognition, keep it up:)
FINALLY. I’ve watched so many videos about neural networks, seen the dots connecting with lines, but never actually understood how they worked. Someone finally bothered to stop and tell me.
Me: jumps of a cliff
God: why did u jump off a cliff
Me: i wanted to learn
What a great video!! I predict your Channel is going to blow up soon.
I actually coded a genetic algorithm (like you showed) for a biology essay. It was about cars learning to drive a race track and worked pretty similar.
Keep your work up!
The quality of this video really caught me by surpise, It deserves more recognition!
You are very underrated. That was a very interesting video!
it cracks me up seeing you having fun during your explanations , its a very interesting project , thanks for sharing man!
I love this!! I love evolution simulations. Ive built a few myself but never to this magnificent extent. You are implementing everything I would like to implement: neural networks and 3D graphics. Hope you can show us some more :)
This video was super easy to understand, thanks a lot. I hope you grow a lot on RUclips!
Awesome!
I first found some videos from a project called Bitites and then found Primer. I immediately thought, what if you could combine those!
Literally made something almost exactly like this, found this video when trying to solve a problem... it didnt help but was very interesting! Keep up these videos
Haha same here
Just had to rewatch this video. I first time watched this 1,5 years ago before I started writing my masters thesis on AI. Last week I got it granded and ended up getting grade of 4,5 (max is 5). This was one of the vids that reeled me into working with AI in Unity.
I started playing with this idea last night, its super fun
reminds me of one summer project i tried. the idea was to make a game where creatures evolve like that, I wanted to make it so the player to hunt/play in the game, causing creatures to evolve to the player presence, and also allow player to domesticate and farm them .
was new at unity/programming and ended up making a snake thing that could crawl a bit. not exciting for a game, but I learned a lot.
Still think a survival game where creatures evolve and adapt would be a fun game.
Wow, great video! I am looking into such simulations at the moment because I was also fascinated by the same videos by Sebastian Lague and Primer. And you did a really good job of explaining things in this video. Well done!
Great video! Would love to see more!
Very interesting video! You've got some magic coding and explaining skills good sir.
A deadly combination. :)
Would be interesting to train an Ai like that for a rts game but I guess it would take very long for the ai to mature
It could mature fast using PPO and invalid action masking, Yannic Kilcher had a video on a paper about it (with microRTS)
i love u for teaching me about AI.
Can we just appreciate he made the oof sound as the death sound in the beginning? R.I.P. OOF SOUND 2006-2022. Also, maybe add a chat system so that they can talk to you and eventually grow up to learn English?
That’s really good.
Really great Video man
Thank you! I appreciate it!
Great video man keep it up.
Thanks, will do!
Nobody else on RUclips has explained Neural Networks as well as you have for newbies
I freaking love these experiments
In my early 20s I made all kinds of AI evolution simulations like this in unity. But I always got stuck with back propagation. I never, *NEVER* thought of using death and reproduction as an alternative to backpropation, but once you said it it makes perfect sense. GAH
wheres the auto jump cut software?
Hi i downloaded the project. What most important thing is that you populate the world with the most evolved creatures.
Creature spawner needs to keep a list of ten most evolved creatures and populate the world with them so as to keep the evolution progressing forward. Please implement this feature and make a part 5 of this tutorial.
2:47 made me laugh so hard that I almost swallowed my pizza.
Dude great video and work
Thanks! Glad you enjoyed it!
How does changing the weights and biases change the output... basically, whether or not a node is active or inactive, then it'll choose whether to go forwards or backwards? ?
The weights and biases control the "flow" of information through the network. If a weight is large, it means that the input it's connected to is very important and will have a strong influence on the output. If a weight is small or close to zero, then the input has less effect on the output.
The biases help the network make better decisions by shifting the outputs of the activation function, allowing it to learn even when the input data isn't a perfect match to the expected results.
Also In our case the output nodes are always technically active because I don't apply the activation function to the output layer. So instead there we have the 2 output nodes and if the first one is negative they will go left and if it is positive they will go right, Then the second output node works the same way but for forward and backwards.
I mean, I am a creationist, and anyone with common sense knows that evolution in this sense is impossible, but it is still fun to watch. (mostly because of the neural network)
this finally answered a big AI question I had! thx!
Super interesting, have you chosen to release the source code?
Yeah I was planning on adding a web version of the sim to my non existent website in the next few weeks. I will probably put the code on github at some point too.
@@JohnnyCodes Thanks!
good video, I have a challenge make AI wich its inputs are the pixels of its camera in unity
I've wanted to do that for like 15 years now. But spoiler alert: you can't do in on a home PC, even today. It's so computationally expensive (read: slow), you'd need a cluster computer (small supercomputer).
(That's if you're evolving a neural net. If you're "cheating" and using statistics or other math, it's less expensive.)
7 months later... still waiting on the video about automated jump cuts. :)
The creature spawner needs to keep track of the ten best creatures and spawn them periodically to keep the simulation going forward.
were you using ML-Agents?
No this was using a neural network I made from scratch. I have a 4 part version of this where I show how to make the code for it
@@JohnnyCodes aren't they both similar?
Interesting, i notice none of them turn into birds. Sure takes a lot of processing power & code to make natural selection work.
There is actually a really cool RUclips channel/simulation called The Sapling and his evolution simulator actually has the ability to have creatures start off on land and eventually evolve to fly.
Also, these networks are actually quite simple so the actual bottleneck of the program is the Unity stuff and not the networks themselves.
Great video, John! If you don't mind, may I ask you a few questions? You used Unity, so was every part of the code made with C#? If so, how did you manage to make neural networks with C#? And, if not, how did you integraded both languages into Unity? I'm asking this because I'm creating my own natural selection simulation, but it is becoming too complex for a browser app, so I'll be migrating it all to Unity (therefore changing all my code from JavaScript to C#). And since I'm changing it all, I feel like adding neural networks is a step I can take now. However, I've just recently started learning Machine Learning, and I only know of Python libraries and techniques to implement it.
I hope you see this comment! :)
Hi Pedro! I did make the neural networks from scratch for this but the code was a huge mess and it also used an external library called Math.Net. Over the past week I made another neural network simulation to teach cars to drive around a track and I removed the need for that dependency. I have been cleaning up the neural network code as much as possible to make it easier to understand and also easier for other people to reuse this in other projects. I can add the code to git for you in a few days once it is working better. I will be making another video and tutorial about these updates soon too
@@JohnnyCodes Oh that's great to know! And yeah I would absolutely love that! I'm trying the best I can to gather info about this subject but there's still so much to learn 😅
I truly appreciate your response, I'll be looking forward these updates! :)
if you like simulations, you should really see the bibites
Very cool. I made something similar. But with prey, hunter and plant. Only hunter and prey DNA change. I decided against a size change as thought it would be too powerful. I just used basic states for the AI. Will post it on github soon.
There is still an interest in your jump cut code as well as your larger unity project here. Lots from which to learn, kind sir.
You deserve so many more views.
From you video Atleast I know that Unity and reinforcement learning can be used together.
Did you have to design each neuron and the interconnection between the nodes. Before natural selection was used to train the weights?
Or does unity provide a pre-made function to define the neural network structure.
Forejumpcutting as a new plot device.. what will the jump-cutting video foreshadow??
Cool video, make some more
Is your code somewhere available?
I am actually planning on putting the neural network template on github as part of the neural network series I started posting today. I am planning on making the neural network template free on github but I am going to be adding the source code for the rest of my projects as a perk for Patreon members
Love the jokes, you got a new subscriber:D
For some reason I expected there to be more after the explanation of how to do movement.
Why does every node need to be connected with every other to the next layer?
They don't actually need to be connected to each node but that is one of the most common layers. When they are all connected like that it is called a Dense layer (You will see this term when using python libraries like pytorch or keras). When you string a bunch of these dense layers together like we did it is called a "fully connected feed forward network".
People experiment with all different kinds of networks, for example the NEAT algorithm tries to figure out what connections each node should have (Using evolution of the actual network shape). There are also recurrent neural networks where previous outputs are looped back into the node as inputs, this gives networks a form of short term memory, also this would be called a recurrent network instead of a feed forward network in this case.
Hope that helps clear things up a bit! Let me know if you have any other questions!
That's a really good video
@John Sorrentino, I have been looking for a start point for a unity genetic algorithm with a NN built in to the critters. Do you have the source available?
You could try Udemy course by Penny something or other.
@@xaviermagnus8310, I am guessing you mean, Dr Penny de Byl. I think I might just do that. Thanks.
@@offroadr Get it on sale, but yes. Udemy scheme is to have sales all the time.
i wanted to do something like this but a sims like game however i was only able to make really simple "Ball go to cube" game. Then i gave up.
Great stuff, and an even better explainer! Question: Do you only use asexual reproduction? Or can two parents have a child (i.e., with genetic crossover logic)?
If you're still interested in the topic, the god tier of evolving neural nets is the "NEAT" algorithm -- Neuro-Evolution of Augmenting Topologies. It's been on my coding bucket list for a long, long time now.
Isnt backpropagation what we call sleep? I think thats kinda missing in the Simulation :-)
Supervised ML can do a lot, faster. I think it would have been cool to have a day time limit and if they gained 0 food, then they would make some random changes. After 4 days with no food they die out completely. but due to random luck they could reproduce maybe once, which might help some not useful at the start gene's make their way into the future.
the problem with genetic algorithms seems to be that eventually there is only one or two sets of genes left. Which means they loose their ability to adapt. It might be that way IRL too but
Take the sim that you had them eat the smaller creatures and allow 3 small creatures to teamkill a large creature and drop a bunch of food.
Hey can you share a code
The scripts are on github from part 3 but I am actually planning on posting a quick unity setup tutorial tomorrow and I will also put the whole project on github. The reason I haven't done it yet is because of the Assets I used. But in tomorrows video I am not going to use any assets so I can share it.
make a sim where the souls of the dead can appear and teach descendencts
Make a count of how many times he said neural network
11 times is that a coincidence? I think not... Remember remember the 5th of November my friend
the jump cuts were perfectly fine until you pointed them out
You should make a bunch of neural networks that process different stuff from one another and some feed their outputs to others' inputs so that you'll efectively have a brain
1:43 that was a bug bro😂😂😂
Really though is it? I don't think it should be considered that. I mean part of machine learning is that we want to see them find ways to win. If this NN was more complex it would have been totally possible for them to learn to push off the edge intentionally, and to avoid the edge as well. The point of NN's is to have as many variables as possible without destroying your computer.
Maybe its just the developer in me saying its a feature not a bug. But I think a game that does not have any room for emergent gameplay is unappealing and likely result in stale gameplay.
HES A MONSTER HES UNDOING OUR WORK HES MAKING SIZE MATTER! NOOOOOOOOO!!!!
gg
.