Тёмный

Unity Setup Tutorial! Evolution Simulator with Neural Networks (Part 4) 

John Sorrentino
Подписаться 2,9 тыс.
Просмотров 4,3 тыс.
50% 1

This video is for anyone that wants to try to recreate the Evolution simulator and make their own version of it.
Other Parts:
1: • Ultimate Neural Networ...
2: • Coding A Neural Networ...
3: • Training A Neural Netw...
Script Files: github.com/john-sorrentino/Ne...

Наука

Опубликовано:

 

23 май 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 44   
@IlseMulAuthor
@IlseMulAuthor Год назад
Thanks for this tutorial series. I'm certainly going to try it out. I would keep the videos separate, but make a playlist of them. An extra video with the addition of enemies would certainly be good!
@ProperSnake
@ProperSnake Год назад
yesssss an all together one would be amazing
@cleberfeitosa7954
@cleberfeitosa7954 11 месяцев назад
This is a fantastic series! Ty so much! And please do the full version! It would certainly amazing to watch!!!
@Q_Bits
@Q_Bits Год назад
Thank you! Been waiting for this! This series has been fantastic!
@cmatrix6720
@cmatrix6720 10 месяцев назад
This is an amazing series!!! 🤩
@may-the-ma-be-with-u
@may-the-ma-be-with-u 9 месяцев назад
this is maybe the best nn basic explanation i seen
@natebrett9782
@natebrett9782 11 месяцев назад
Hi, I have followed the past 3 videos and this one. I would defiantly love it if you re-did the series as a whole video, taking us step by step though everything. I have not quite been able to work out how the inputs and outputs link to the network. I'm also unclear how the first creatures generate there original network weights and biases. I'm going to download the files now and see if I can work it out from there, but would love a new fresh video built out of these 4.
@JohnnyCodes
@JohnnyCodes 11 месяцев назад
Yeah I rewatched the series after the 4th video and I was kindof dissapointed at how disconnected everything felt. I thought it would be helpful taking screenshots of the code and talking about it but I actually liked the version where I was just screen recording and going through the steps of actually making it. So I would like to do a full version like that soon
@Tim242
@Tim242 Год назад
Please leave a note in the first videos that to set it up you should watch part 4. It was imposibe to folow along and I did not know until I was here that this was where the explanation was on how to do this.
@Unity_Tutorial_Games
@Unity_Tutorial_Games Год назад
good.. cool... all the best
@HeerderRatten
@HeerderRatten Год назад
Thanks!
@vilmerlundin4775
@vilmerlundin4775 Год назад
recently created a similar simulator in javaFx, nice work
@visheshl
@visheshl 4 месяца назад
Can you make a fifth video with a fitness function where the longest living creature is the most fit. And the spawner selects ten best fit creatures and spawns them?
@samuelgilr
@samuelgilr 8 месяцев назад
thank you so much for this!
@JohnnyCodes
@JohnnyCodes 8 месяцев назад
No problem! I am glad you enjoyed it. I was actually just thinking that I should make that combined version that I mentioned where instead of it being 4 parts it would just be one well structured video. Was there anything missing in these videos that you think would be a good addition to the full one?
@samuelgilr
@samuelgilr 8 месяцев назад
I think that adding a predator would make the simulation more interesting, another agent that has the same necessities as the original creature but eats its prey instead of the regular food you already have, idk if that's something you could add to the NN but I think it would be pretty cool @@JohnnyCodes
@hitlab
@hitlab 8 месяцев назад
Can you tell me where you cover back propagation?
@akk2766
@akk2766 3 месяца назад
Yes - I'm all for the suggestion (7:53) to create a consolidated video! And since you've asked, I'm really not a fan of stitching video up so that you don't have any umm's and ahh's - but this then makes it seem so robotic in nature. To me, it's actually very distracting to watch when there's so many obvious visual jumps in the video. A few hmm's and ahh's is not bad - it just shows you are human. Removing those and you are removing the human essence - IMHO.
@philly2548
@philly2548 6 месяцев назад
I'm stumped. I tried this and I ran into the same issue as he did initially with them not reproducing...i checked the "is trigger on 3D 'Food' Sphere. But it will not eat and reproduce
@akk2766
@akk2766 3 месяца назад
It took a long while (~2-3 minutes) before my creature started to reproduce and for the children to survive long enough for them to reproduce. It might depend on PC performance - but I could be wrong...
@kpr2
@kpr2 7 месяцев назад
Hi, John! I enjoyed this series & just stopped by to poke at you & see if you were indeed intending to revisit it? I think it would be great to have a more cohesive view of everything & am also curious if you'd mind explaining how one would go about saving the NN training data so that it's not starting from scratch every go. Thanks much for all the information! I now have a herd of deer that... well, mostly run in circles and die, but some manage it in the end hahaha.
@JohnnyCodes
@JohnnyCodes 7 месяцев назад
Hi! I am glad you enjoyed it. Thanks for the poke I probably need it lol. I actually wrote myself a schedule for the beginning of next year and right now I actually have working on the NN tutorial from 1/7 - 1/28. I am not normally a schedule person but I have been pulling myself in a lot of different directions lately but if I manage to stick to the schedule then I should be able to post a better version with even more information by the end of January! For saving the networks I think I ended up using a free asset called quick save on the unity asset store. I think it basically turns any object into a json file and then can also read it back out of the file and turn it into a object again. So I would just pass in the entire network or sometimes the entire creature object if you have other parameters you need to save besides the network and it should be able to load it back in. I will hopefully either add this to the updated video or make a separate video about it too
@kpr2
@kpr2 7 месяцев назад
Thanks for the info @@JohnnyCodes! I'll give the quick save a shot as it sounds like a super simple solution. I completely understand how it is to be pulled in a million directions at once (spinning in crazed circles myself here of late trying to do three dozen different things, haha). If and when you can get back to this, I'll certainly be looking forward to it, but don't pressure yourself overly. Thanks again & rock on!
@visheshl
@visheshl 4 месяца назад
The creature spawner should copy the brain of the ten best creatures and then spawn the ten best creatures, otherwise the game doesn't progress further. Can you please implement saving and spawning creatures? I'm having a hard time doing it. Please implement save brain to text file and load brain from text file to spawn
@akotoy
@akotoy Год назад
Hey man can you explain how i would save the brain of the players for like a racing game?
@JohnnyCodes
@JohnnyCodes Год назад
Sure! I actually just got asked the same question at around the same time you asked it (Should probably add this to a video at some point) but basically I added a plugin and two functions to the neural network script. The plugin is free on the unity asset store and is called quick save (assetstore.unity.com/packages/tools/integration/quick-save-107676) At the top of the script you need to add this: using CI.QuickSave; Then I made these 2 functions: public void Save() { QuickSaveWriter.Create("jumping-v1-Round-" + roundNum) .Write("Car-"+ carId, layers) .Commit(); } public void LoadRound(int roundToLoad) { QuickSaveReader.Create("jumping-v1-Round-" + roundToLoad ) .Read("Car-"+ carId, (r) => { layers = r; }); } Then you can call the save function whenever you want and it will save it to a file, since the evolution sim isn't round based maybe you can call them days instead of rounds. Just make sure to make the string the exact same when you want to save and load a specific session. You call the LoadRound on the creature instances neural network script and as you can see it is currently set up to save and load all the networks layers onto the instance of the script it gets called on. I believe you can save and load any object using quick save so if you also wanted to save the entire creature I think you could do that too with some modifications, but I haven't tried that yet. Hope this helps! Let me know if you have any other questions!
@navidyaghmaei
@navidyaghmaei 4 месяца назад
Hi, your videos were awesome 😎 and helped me a lot🙏. Have you ever seen "the bibits channel", he is doing also a neural evolution simulation and was using the neat algorithm(still a neural network). It was especially created for natural selection(this type of simulation). Would you be interested in doing a tutorial for that, it would be very interesting and work very good with the simulation?
@grimmethymcbones8336
@grimmethymcbones8336 7 месяцев назад
Do you have anything on saving and loading specific models so I can use them again later?
@JohnnyCodes
@JohnnyCodes 7 месяцев назад
I remember using a asset on the unity asset store called quick save that can write classes/objects to file and then load them back in. I remember I could pass in the network class or I could just pass in the entire creature class to save a creature to file.
@grimmethymcbones8336
@grimmethymcbones8336 7 месяцев назад
Makes sense, I've seen the asset before in my browsing. @@JohnnyCodes
@akotoy
@akotoy Год назад
is it possible for you to explain how to get the ai cars to learn well, i have fully completed everything but after turn one or two none learn to do anything else. any suggestions?
@JohnnyCodes
@JohnnyCodes Год назад
Yeah, I was actually thinking of doing a code breakdown and unity setup for the cars next like I just did for the Evolution simulator. But until I get that recorded, there are 2 possible things that come to mind. First is to make sure you are copying the brains of some of the best cars to the rest of the cars and then mutating the other cars. The second is to look out for if you are already doing that, is to make sure you don't mutate your best cars (The ones you copy the network from). Only mutate the ones that get copied too. Otherwise, it will be hard for them to learn since their progress gets overwritten by randomness. I usually save the top 10-20% of the best cars and copy from those to get more variation in the copies (You can only save 1 best car and they will still learn but then the rest are going to be very similar to that one and it will be harder for different strategies to emerge). Will try to clean up the code for the self driving cars today and hopefully record the video for it soon
@akotoy
@akotoy Год назад
@@JohnnyCodes I was trying to wrap my head around what you said on the second one but im kinda confused, Sorry😅 But, I was saving the only one best car and see how that could limit strategies. a lot of the time they will just slam into the wall first generation and never learn from that. So i think i see what you mean a little but for how to fix it im confused. Thanks so much for all your support! Your the most I have ever talked to a RU-vidr and it helps a lot, thanks!
@argmentum22
@argmentum22 3 месяца назад
remake in parts please with maybe a mix of all together, I would prefer to see the whole process though - making basic creatures and then adding the AI on top - im not a big fan of downloading and gluing things together as I feel I dont really learn anything.
@argmentum22
@argmentum22 3 месяца назад
yep , after a week of trying to debug code botched together from parts 1.2 and 3 and from copying {not copy pasting}chunks from the git hub I still have problems.. my jagged array deosn't seem to work properly so I used the pre-streamlined version which doesnt crash but doesnt generate outputs - so I treied hard coding movement to at least make sure the controller was working , forwards command works but teh rotate jitters back to the original point and i really am not sure why.. .... so to answer yes please from scratch - #basic environment , #spawners and movement controllers, #basic AI including 1st run scrambled neurons, #mutation and breeding. at each point having something we can press play on so that we know it works up to that point.
@argmentum22
@argmentum22 3 месяца назад
all that was missing was the if from the else if in the forward loop - missed it for so long..
@Daedron
@Daedron Год назад
I tried to follow along with this tutorial series, and in part 3 everything fell apart. By the time I got to the 5 minute mark I was beyond frustrated and I gave up on trying to follow along. I decided to just download the source code instead to see where my confusion spawned from. Looking at the source code, there is a VAST amount of information there that you never even touched on. I would recommend you follow your own tutorial to see if it produces the results you would want without having any other information.
@JohnnyCodes
@JohnnyCodes Год назад
Thank you for this feedback, I went through the tutorial as you suggested and reviewed all the code that was explained and all the code that wasn't. I found that the main parts of the code that I didn't include were the variables at the top of the Creature.cs function and the variables at the top of the Movement.cs function. I also didn't show the components being initialized in the Creature and Movement script as well. Here is the document that I highlighted while going through the tutorial: docs.google.com/document/d/e/2PACX-1vRANyyasVzZRI757mCZmPSV1kEBpR5xL4YieONzt-rQZDjS0dETtWg4689XS7cZ0pusvTYez5TRem5w/pub The Green sections are parts of the code that were covered in the tutorial, the yellow parts weren't covered but not needed and the code will still work well without them, and the red parts weren't mentioned but probably should have been. So I believe that most of the important parts of the code were shown but I do think that in part 3 it was very confusing because I switched between the creature script and the NN script while barely mentioning the switching happened. I think if I do combine this into one tutorial I will make sure to do the following: - Mention the variables at the top of the files and what I have them defaulting too - Showing me initializing the components in the awake functions - Show which file each function belongs to at the top of the screen and also show more context for where it should go in each file. Thanks again for the feedback, do you think that doing these things would help you and other people follow along with the videos better or is there something else you think I can do as well?
@Daedron
@Daedron Год назад
​@@JohnnyCodes Thank you for looking into it! I think these suggestions you made should be perfect. The only thing I could suggest that might be useful is a saving/loading system since you mentioned that capability in the first episode? Thank you for making this series, and I look forward to any more cool tutorials from you in the future.
@HeerderRatten
@HeerderRatten Год назад
Could you please make a video in which you explain how I can copy the NN and load it again for the next generation? I am despairing. Writing NN to a Json file works, but loading it back as NN doesn't work for me. Thank you for your videos, you do a damn good job!
@JohnnyCodes
@JohnnyCodes Год назад
Sure I can do that, are you using unity and C# for it like I did?
@JohnnyCodes
@JohnnyCodes Год назад
I made this reply to someone else a few weeks ago about it, but if you already saw that and it doesn't help I will probably make a video for it either way: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-isanrfpebTs.html&lc=UgzGRxHHgdLfA7NLg2d4AaABAg.9r2bcOCUsTB9r3DXMHDuZy
@HeerderRatten
@HeerderRatten Год назад
@@JohnnyCodes It's amazing how fast you answer ^^ Yes, I saw @wShorts43's question and read your answer. However, I haven't tried it yet. I tried it without plugin. Simply save the data in a Json file. I think the mistake I made is to write the objects (Layer-values) one after the other into a JSON file instead of storing them in a list. If I have an object in the json it works as soon as I have 2 or more there is an error. I need to implement saving the Layer-values as a list. I'll do that tomorrow, I'll reply as soon as I've done it. A video of you would be very nice. Especially one like Part 4 (this video) for the Car AI. I thank you for your efforts you make a grate job! And yes I use Unity and C#
@halloen1
@halloen1 11 месяцев назад
Can you maybe make a tutorial about learning an ai to walk in 2d step by step please? Or can you make a video about enemies (ai) that can fight each other? with guns or something so they have to learn how to dodge the bullets and aim correctly to get better? It would be really fun. Code Bullet have alot of really fun ai stuff, it would be really good if you made a tutorial of any of that stuff too.
Далее
AI Cars Learn To Drive!
6:56
Просмотров 13 тыс.
5 Years of Making Games in Unity!
13:27
Просмотров 2,3 млн
skibidi toilet 76 (part 1)
03:10
Просмотров 15 млн
小天使和小丑离家出走#short #angel #clown
00:36
How I created an evolving neural network ecosystem
10:09
Evolution Simulator with Neural Networks in Unity!
8:03
A.I. Learns to play Flappy Bird
7:46
Просмотров 14 млн
Coding Adventure: Clouds
12:50
Просмотров 1,2 млн
I Made a Neural Network with just Redstone!
17:23
Просмотров 720 тыс.
AI Learns to Speedrun Mario
8:07
Просмотров 692 тыс.
A new way to generate worlds (stitched WFC)
10:51
Просмотров 514 тыс.
Сравнили apple и xiaomi!
0:21
Просмотров 41 тыс.