Evolution Simulator with Neural Networks in Unity!

  Рет қаралды 79,223

John Sorrentino

John Sorrentino

Күн бұрын

Пікірлер: 105
@JohnnyCodes
@JohnnyCodes 2 жыл бұрын
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: kzbin.info/www/bejne/gImqoJqafpyFf6c
@dotenvdev
@dotenvdev Жыл бұрын
Have you considered swapping the ReLU activation function out for GELU? A bit more computationally intensive, but great to avoid vanishing gradients
@lucutes2936
@lucutes2936 4 ай бұрын
thx
@SBroproductions
@SBroproductions 3 жыл бұрын
2:20 Shoutout to the guy that spawned underneath the map. Dude evolved his way to another plane of existence.
@lucutes2936
@lucutes2936 4 ай бұрын
big brain
@modernmarrow1411
@modernmarrow1411 3 жыл бұрын
I've always loved natural selection simulators, it's too bad there isn't more of them.
@zebradobby9679
@zebradobby9679 2 жыл бұрын
Me too
@lunaticgr2925
@lunaticgr2925 2 жыл бұрын
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.
@Vav97
@Vav97 Жыл бұрын
I got you kzbin.info/www/bejne/eJfGmGeqiJ2bptk
@revimfadli4666
@revimfadli4666 Жыл бұрын
​@@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"
@lucutes2936
@lucutes2936 4 ай бұрын
wdym
@kingbling7571
@kingbling7571 3 жыл бұрын
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!
@TheDroidsb
@TheDroidsb 3 жыл бұрын
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 😂
@nikkiofthevalley
@nikkiofthevalley 3 жыл бұрын
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?)
@Mr-Raptor
@Mr-Raptor Жыл бұрын
lmao
@nikolozgilles
@nikolozgilles Жыл бұрын
I AM (REVERSE) SPEED
@page8472
@page8472 3 жыл бұрын
this is amazing you truly deserve more recognition, keep it up:)
@julianon161
@julianon161 3 жыл бұрын
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!
@frozenzenberry4101
@frozenzenberry4101 3 жыл бұрын
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.
@shoom7103
@shoom7103 3 жыл бұрын
You are very underrated. That was a very interesting video!
@teambellavsteamalice
@teambellavsteamalice 3 жыл бұрын
Awesome! I first found some videos from a project called Bitites and then found Primer. I immediately thought, what if you could combine those!
@matsukuia7140
@matsukuia7140 3 жыл бұрын
The quality of this video really caught me by surpise, It deserves more recognition!
@alejandrorosales2863
@alejandrorosales2863 3 жыл бұрын
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 :)
@AbstaartKardman
@AbstaartKardman Жыл бұрын
it cracks me up seeing you having fun during your explanations , its a very interesting project , thanks for sharing man!
@meryyy0388
@meryyy0388 3 жыл бұрын
This video was super easy to understand, thanks a lot. I hope you grow a lot on KZbin!
@ebrahimmomin7518
@ebrahimmomin7518 3 жыл бұрын
Me: jumps of a cliff God: why did u jump off a cliff Me: i wanted to learn
@TamaraMakesGames
@TamaraMakesGames 2 жыл бұрын
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!
@arv_is
@arv_is 3 жыл бұрын
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
@AirNeat
@AirNeat 2 жыл бұрын
Haha same here
@xendelaar
@xendelaar 3 жыл бұрын
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
@revimfadli4666
@revimfadli4666 Жыл бұрын
It could mature fast using PPO and invalid action masking, Yannic Kilcher had a video on a paper about it (with microRTS)
@TeamUnpro
@TeamUnpro 2 жыл бұрын
I started playing with this idea last night, its super fun
@oatcube3961
@oatcube3961 Жыл бұрын
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.
@adamlarsson7122
@adamlarsson7122 3 жыл бұрын
Great video! Would love to see more!
@anomalocaris540
@anomalocaris540 Жыл бұрын
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.
@erinleighlynch9400
@erinleighlynch9400 Жыл бұрын
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? ?
@JohnnyCodes
@JohnnyCodes Жыл бұрын
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.
@DiegoPaulo2023
@DiegoPaulo2023 2 жыл бұрын
Really great Video man
@JohnnyCodes
@JohnnyCodes 2 жыл бұрын
Thank you! I appreciate it!
@DigitomProductions
@DigitomProductions 3 жыл бұрын
Great video man keep it up.
@JohnnyCodes
@JohnnyCodes 3 жыл бұрын
Thanks, will do!
@TacticalAnt420
@TacticalAnt420 3 жыл бұрын
That’s really good.
@thomasrebicki8834
@thomasrebicki8834 3 жыл бұрын
i love u for teaching me about AI.
@c00lkitty
@c00lkitty 2 жыл бұрын
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?
@TheCurlyCoder
@TheCurlyCoder 2 жыл бұрын
2:47 made me laugh so hard that I almost swallowed my pizza.
@visheshl
@visheshl 11 ай бұрын
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.
@audditygvhgvhv8778
@audditygvhgvhv8778 3 жыл бұрын
wheres the auto jump cut software?
@discipulus.1
@discipulus.1 3 жыл бұрын
I freaking love these experiments
@CalebHansonOfficial
@CalebHansonOfficial Жыл бұрын
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
@manavgala2361
@manavgala2361 3 жыл бұрын
Nobody else on KZbin has explained Neural Networks as well as you have for newbies
@finnwendt9540
@finnwendt9540 Жыл бұрын
Why does every node need to be connected with every other to the next layer?
@JohnnyCodes
@JohnnyCodes Жыл бұрын
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!
@kiachi470
@kiachi470 3 жыл бұрын
Dude great video and work
@JohnnyCodes
@JohnnyCodes 3 жыл бұрын
Thanks! Glad you enjoyed it!
@BadChess56
@BadChess56 Жыл бұрын
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)
@neilfosteronly
@neilfosteronly 2 жыл бұрын
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.
@billross9656
@billross9656 3 жыл бұрын
Forejumpcutting as a new plot device.. what will the jump-cutting video foreshadow??
@angelodeus8423
@angelodeus8423 3 жыл бұрын
good video, I have a challenge make AI wich its inputs are the pixels of its camera in unity
@IgnisKhan
@IgnisKhan 2 жыл бұрын
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.)
@neoblackcyptron
@neoblackcyptron 3 жыл бұрын
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.
@jaydee4397
@jaydee4397 3 жыл бұрын
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.
@visheshl
@visheshl 11 ай бұрын
The creature spawner needs to keep track of the ten best creatures and spawn them periodically to keep the simulation going forward.
@atcer51
@atcer51 Жыл бұрын
this finally answered a big AI question I had! thx!
@ziggyzoggin
@ziggyzoggin 3 жыл бұрын
if you like simulations, you should really see the bibites
@thestoneworks
@thestoneworks Жыл бұрын
Interesting, i notice none of them turn into birds. Sure takes a lot of processing power & code to make natural selection work.
@JohnnyCodes
@JohnnyCodes Жыл бұрын
There is actually a really cool KZbin 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.
@lucutes2936
@lucutes2936 4 ай бұрын
were you using ML-Agents?
@JohnnyCodes
@JohnnyCodes 4 ай бұрын
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
@lucutes2936
@lucutes2936 4 ай бұрын
@@JohnnyCodes aren't they both similar?
@christophermoore7676
@christophermoore7676 3 жыл бұрын
Super interesting, have you chosen to release the source code?
@JohnnyCodes
@JohnnyCodes 3 жыл бұрын
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.
@christophermoore7676
@christophermoore7676 3 жыл бұрын
@@JohnnyCodes Thanks!
@donbeckham
@donbeckham 3 жыл бұрын
7 months later... still waiting on the video about automated jump cuts. :)
@pobierac2183
@pobierac2183 2 жыл бұрын
Is your code somewhere available?
@JohnnyCodes
@JohnnyCodes 2 жыл бұрын
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
@madankd
@madankd Жыл бұрын
Hey can you share a code
@JohnnyCodes
@JohnnyCodes Жыл бұрын
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.
@MatthewKanwisher
@MatthewKanwisher 3 жыл бұрын
Cool video, make some more
@offroadr
@offroadr 3 жыл бұрын
@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?
@xaviermagnus8310
@xaviermagnus8310 3 жыл бұрын
You could try Udemy course by Penny something or other.
@offroadr
@offroadr 3 жыл бұрын
@@xaviermagnus8310, I am guessing you mean, Dr Penny de Byl. I think I might just do that. Thanks.
@xaviermagnus8310
@xaviermagnus8310 3 жыл бұрын
@@offroadr Get it on sale, but yes. Udemy scheme is to have sales all the time.
@AlekMunroe01
@AlekMunroe01 Жыл бұрын
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.
@GIRGHGH
@GIRGHGH 3 жыл бұрын
For some reason I expected there to be more after the explanation of how to do movement.
@pedroheck3667
@pedroheck3667 3 жыл бұрын
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! :)
@JohnnyCodes
@JohnnyCodes 3 жыл бұрын
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
@pedroheck3667
@pedroheck3667 3 жыл бұрын
@@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! :)
@definitelygamedev5821
@definitelygamedev5821 3 жыл бұрын
That's a really good video
@ITomocska
@ITomocska 3 жыл бұрын
Love the jokes, you got a new subscriber:D
@IgnisKhan
@IgnisKhan 2 жыл бұрын
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.
@darudeSandstorm.
@darudeSandstorm. 3 жыл бұрын
Isnt backpropagation what we call sleep? I think thats kinda missing in the Simulation :-)
@DuxGalt
@DuxGalt 2 жыл бұрын
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
@laskey2175
@laskey2175 3 жыл бұрын
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.
@Coffeemancer
@Coffeemancer 3 жыл бұрын
make a sim where the souls of the dead can appear and teach descendencts
@TartarusHimself
@TartarusHimself 2 жыл бұрын
the jump cuts were perfectly fine until you pointed them out
@gamedev_byhobby8872
@gamedev_byhobby8872 Жыл бұрын
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
@eemasd
@eemasd 3 жыл бұрын
Make a count of how many times he said neural network
@JohnnyCodes
@JohnnyCodes 3 жыл бұрын
11 times is that a coincidence? I think not... Remember remember the 5th of November my friend
@palingram
@palingram 3 жыл бұрын
1:43 that was a bug bro😂😂😂
@DuxGalt
@DuxGalt 2 жыл бұрын
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.
@henrythearcticwolf4709
@henrythearcticwolf4709 Жыл бұрын
HES A MONSTER HES UNDOING OUR WORK HES MAKING SIZE MATTER! NOOOOOOOOO!!!!
@Neuer_Alias_erstellen
@Neuer_Alias_erstellen 3 жыл бұрын
gg
@fkxfkx
@fkxfkx 3 жыл бұрын
.
How I created an evolving neural network ecosystem
10:09
The Bibites: Digital Life
Рет қаралды 337 М.
Simulating Natural Selection
10:00
Primer
Рет қаралды 14 МЛН
진짜✅ 아님 가짜❌???
0:21
승비니 Seungbini
Рет қаралды 10 МЛН
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
Simulating Evolution: Extreme Temperatures
13:30
EightLittleBears
Рет қаралды 65 М.
Coding A Neural Network FROM SCRATCH! (Part 2)
17:58
John Sorrentino
Рет қаралды 15 М.
Evolving Genetic Neural Network Optimizes Poly Bridge Problems
9:59
I Trapped this AI Bot in a Parkour Simulation
10:47
cozmouz
Рет қаралды 126 М.
I programmed some creatures. They Evolved.
56:10
davidrandallmiller
Рет қаралды 4,3 МЛН
What are Neural Networks || How AIs think
12:14
Code Bullet
Рет қаралды 617 М.
I Built a Neural Network from Scratch
9:15
Green Code
Рет қаралды 524 М.
Who can make the best lifeforms? Artificial Life Tournament - Selection Round
27:28
The Bibites: Digital Life
Рет қаралды 497 М.
How One Programmer Created Gaming's Most Complex Ecosystem
28:29
ThatGuyGlen
Рет қаралды 1,7 МЛН