Coding Challenge #69: Evolutionary Steering Behaviors - Part 4

  Рет қаралды 39,350

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 69
@FabledNarrative
@FabledNarrative 6 жыл бұрын
@ 3:41 THIS is why you are my favorite programmer. You SHOW the hardship, but also the practice of overcoming the problem. Much love, man. : D
@likeyou3317
@likeyou3317 7 жыл бұрын
I did the clone version related to health and it's really rewarding. I can watch the mechanisms of nature on my pc for like 10 minutes and I ain't bored at all! Thanks a lot dan.
@nyscersul42
@nyscersul42 5 жыл бұрын
The random excitement dances are the best part!
@XoIoRouge
@XoIoRouge 6 жыл бұрын
How have you not been meme'd yet? You make such perfect gif memes I just need that Evolution Dance for a "YAY" meme to gif everwhere...
@asystat
@asystat 7 жыл бұрын
Dude you are a great educator. Keep it up!
@Mat2095
@Mat2095 7 жыл бұрын
About that magic number 5 (speed and eat-radius): The vehicles go 5 units per frame, but 5 is the radius, not the diameter, so the radius could be 2.5 and it still wouldn't jump over food if it was going perfectly straight. It isn't going perfectly straight, so having a bigger radius is actually good. Ideas: - a dying vehicle should spawn poison, not food. Eating your own species is gross, don't do that - one could give the clones some initial velocity, e.g. in the same or opposite direction as their parent
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Great points and great suggestions!
@bradleyshrader8102
@bradleyshrader8102 7 жыл бұрын
I don't know if anyone else has mentioned this, but this system creates a negative feedback loop that could end up killing all of the vehicles. If the perfect vehicle only consumes food, then they end up effectively concentrating the poison. Therefore, increasing vehicle success decreases vehicle success. i thought of a few solutions to this, one boring and some really cool ones IMO. 1. Boring solution: make poison randomly decay (possibly give it some half-life or spoilage timer) 2. Add a third entity which is an antidote to the poison and increases health (needs a perception and steering force) 3. (My favorite solution) Add a commensalistic vehicle to the environment that consumes poison (possibly allow it to be attracted to other vehicles as a type of pilot fish)
@brokenrobotgames2577
@brokenrobotgames2577 7 жыл бұрын
In real life....having children is a negative feedback loop. I only have so much money a month, I can afford x amount of groceries, groceries / occupants is a decreased value if I have a child. But according to this game, if an occupant dies, I get more food. I don't even get that in real life. I'd have to bury the child in a box that takes more food away from me. So in a way this is absurd now that you mention it. They eat their dead!
@bradleyshrader8102
@bradleyshrader8102 7 жыл бұрын
what you're talking about is entirely different from what I'm talking about. you're talking about the distribution of and competition for limited resources, which is a necessary component of evolution. the limited resources create a carrying capacity which limits how many organisms can exist in the environment. What im talking about is the negative feedback loop created which in a perfect world actually ensures that NO organisms can exist. think of its edge case: if poison is constantly added and only perfect vehicles exist, then by the nature of a perfect vehicle, poison is never removed. therefore the poison will eventually occupy every single pixel in the environment. thus this creates a universe where no organism can exist. considering your example, as the population grows the rate of consumption grows until it exactly meets the rate of production. If the rates are ever unequal competition steps in to balance them, so the trend is for the population to exactly equal the carrying capacity. so, obviously our arguments are entirely different.
@brokenrobotgames2577
@brokenrobotgames2577 7 жыл бұрын
I see. So there is something consuming food, therefore, unless there is something to eat/use poison, then eventually there is doom regardless of the DNA attributes inherited and passed from one to the next. Perhaps a resistance to the poison could be developed over time based on how many generations of offspring have been created. Then, if poison has a varying degree of potency as the resistance is increase, the effects are reduced, eventually becoming food itself. I mean, that is short of giving them the ability to become an intelligent species and start using it for rodent eradication. But I don't see that for the future of these little guys.
@Tracks777
@Tracks777 7 жыл бұрын
Great! Keep it up!
@brokenrobotgames2577
@brokenrobotgames2577 7 жыл бұрын
As Bradley mentioned, there is a bit of a negative feedback loop going on. I recommend an increasing tolerance to poison per generation of the .....whatever that thing is. Poison should vary in potency and if your resistance is higher than potency the poison becomes food. Limit the need for food. While now they are losing food quite quickly, there should be a point where a "food storage" begins to fill. If they go from almost dead to full in 3 pellets, then grab 3 more in quick succession, then they should be consumed as they are needed, not immediately. If there is food around and they are maxed on storage, eating poison should count against the reserve food storage allowing for them to clear the field of nuances that will eventually flood the screen making survival possible. Also, eating your own species being gross is a matter of morals limited to a scope of humans. Many species eat their wounded/dead as opposed to burying them. We have no idea what these things taste like, but apparently they are nutritious.
@caigner
@caigner 7 жыл бұрын
Hi Daniel! Great video style! I love it! :-) While watching I thought: Could you simulate car traffic (with crossings and highway links/ramps) with genetic programming and find out, whether a certain optimum speed would eliminate traffic jams at crossings/links/ramps?
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Oh, interesting idea!
@peterbonnema8913
@peterbonnema8913 6 жыл бұрын
I'm not that familiar with JS but in c++ there are copy constructors. The idea is that you pass in an instance of the same class and the resulting instance of the constructor is simply a copy. That way you don't need to fiddle with separate arguments in your ctor just to have it fullfill two purposes.
@badunius_code
@badunius_code 3 жыл бұрын
17:00 initialize them in uniform way then manually map them to the desired range
@WistrelChianti
@WistrelChianti 2 жыл бұрын
There's a random bonus of interesting to this which is seeing just how specifically awful the compression is on the vehicles. KZbin really doesn't like a lot of small lines moving about suddenly.
@SuperNicejohn
@SuperNicejohn 7 жыл бұрын
I'd only let them clone if their lifespan is larger than the average, which of course implies a "var lifetime" for each vehicle, that gets averaged. Also maybe having, say 10 food at all time. Idk though, but I really liked this four-part series! :)
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
These are great suggestions!
@danw-b6677
@danw-b6677 7 жыл бұрын
holy mother of youtube compression
@MatthewHolevinski
@MatthewHolevinski 7 жыл бұрын
inorite... youtube should fix their encoder to check, have i just blurred the shit out of everything, maybe i should run over this section for a few more passes and then continue on.
@GABRIELFILMSTUDIOS
@GABRIELFILMSTUDIOS 7 жыл бұрын
21:00 The poor compression algorithm!
@missingno7843
@missingno7843 7 жыл бұрын
Great great challenge, congratulations!
@sibiakkash4172
@sibiakkash4172 7 жыл бұрын
Man !! you are awesome. I wish i can code like you
@markvador6667
@markvador6667 7 жыл бұрын
Exciting concept and exciting tutorial ... awesome o_O
@phillipneal8194
@phillipneal8194 5 жыл бұрын
Great !!!
@keshavkumarOfficial
@keshavkumarOfficial 4 жыл бұрын
how we can use generative algorithm code in Architecture floor plan planning??
@sanchitverma2892
@sanchitverma2892 5 жыл бұрын
TheCodingTrain goes X rated for a day
@thezipcreator
@thezipcreator 7 жыл бұрын
This world's logic: [1]: *Drops ice cream* [2]: *Steps on ice cream* [2]: *Eats ice cream because it stepped on it*
@MonzennCarloMallari
@MonzennCarloMallari 7 жыл бұрын
The Zip Creator lol XD but to be fair it's more like running smack against a food or poison, which forces the vehicle to eat it.
@daniellebarker7205
@daniellebarker7205 6 жыл бұрын
drives car over sandwich eats sandwich because it drove over it
@badunius_code
@badunius_code 3 жыл бұрын
17:35 const shift = random(0, mr) const next = random(...) this.dna[x] = lerp(this.dna[x], next, shift)
@BlopGrop
@BlopGrop 7 жыл бұрын
This creature is above poison!
@ttvideo8104
@ttvideo8104 7 жыл бұрын
Nice!
@Protegit
@Protegit 7 жыл бұрын
Amazing...
@IotaBlack
@IotaBlack 7 жыл бұрын
I just pointed out the problem. Just to see I got solved next part.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Haha, my past self thanks you!
@henriksamsonsen87
@henriksamsonsen87 7 жыл бұрын
Hey, I have a question for *processing.* I am not the best at processing so please keep it simple :-) *How can you test if i shoot and object and it hits another object, but the object it hits is made from an array, how can i then spesifically destroy that object from the array?*
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Short answer, however, is take a look at my ArrayList tutorials with Processing. ArrayLists have a "remove()" function.
@henriksamsonsen87
@henriksamsonsen87 7 жыл бұрын
Ok, thanks!
@henriksamsonsen87
@henriksamsonsen87 7 жыл бұрын
forum.processing.org/two/discussion/22290/destroying-a-spesific-array-object
@msris108
@msris108 7 жыл бұрын
you inspire me!
@jsevila
@jsevila 7 жыл бұрын
So i think you missed defining the "mr" mutation rate variable and they are not mutating at all. You can see at the end of evolution that they are cloning the same thing over and over.
@CivilF11
@CivilF11 3 жыл бұрын
A) The cloning rate is extremely low. When being cloned, it's a 1% chance of a mutation happening. B) The changes when a mutation happens are very slight. For example, the radius perception can change from -10 to 10, but this also means it can choose changes close to zero. The weights themselves are changes within decimals, you will not reasonably see changes on the screen with that. I know this comment is four years too late, but oh well.
@amdreallyfast
@amdreallyfast 7 жыл бұрын
I had a bit of fun and made an "egg" instead of cloning immediately
@MrCmon113
@MrCmon113 6 жыл бұрын
That's a nice way of giving them a different position as well. I think I'll do something like that myself, thanks. : D
@joraforever9899
@joraforever9899 7 жыл бұрын
lol, this video isnt released yet
@toasty2438
@toasty2438 7 жыл бұрын
Patreoooon >_
@joraforever9899
@joraforever9899 7 жыл бұрын
actually i have found the link to this video in the part 3 of the series, also you can watch part 5, it is not released yet, but you can watch it if you click on video at the end
@toastyPredicament
@toastyPredicament 3 жыл бұрын
noted: do not drop powdered sugar into a monster
@jnfsmile
@jnfsmile 7 жыл бұрын
Why not run clone 1% of the time, instead of putting that probability into the function itself and running it all the time?
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Interesting suggestion, thank you!
@sirdondaniel
@sirdondaniel 7 жыл бұрын
Could't u just add a new Child when someone dies and also add new food/poison when someone eats it?
@mario1ua
@mario1ua 5 жыл бұрын
They should have an option to eat one another, muahahaha!
@jjppmm29
@jjppmm29 7 жыл бұрын
would have probably put DNA into its own object with a mutate function using mutation weights where mutation weights are their own structure 🤔
@Mrqwertar
@Mrqwertar 7 жыл бұрын
Right now: 333k subs, 333 likes, 3 dislikes What a moment!
@Protegit
@Protegit 7 жыл бұрын
So... if these vehicles suddenly became concius... you'd be a god for them :O
@beaverjoe9171
@beaverjoe9171 6 жыл бұрын
Hardest part.......
@lukaasg3476
@lukaasg3476 7 жыл бұрын
hello, try make a terraria game.
@psyneur9182
@psyneur9182 7 жыл бұрын
I can barely watch this with how long and convoluted your code is. You could use continue in side for loops, you could use this.dna = dna || [random(-2, 2), random(-2, 2), random(0, 100), random(0, 100)]. But the concepts are entertaining and keeps me coming back. It would just be nice if you showed off some newer strategies for javascript coding.
@LPCelllule
@LPCelllule 7 жыл бұрын
in real life humans are different in the way they need foods, maybe you can put the variation of health over time in the DNA so veicules that need less food survive longer
@DasAntiNaziBroetchen
@DasAntiNaziBroetchen 4 жыл бұрын
That would create the obvious result: All vehicles will end up needing less food.
Coding Challenge #69: Evolutionary Steering Behaviors - Part 5 (Bonus)
3:42
Coding Challenge #69: Evolutionary Steering Behaviors - Part 1
23:58
The Coding Train
Рет қаралды 105 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Coding Challenge #68: Breadth-First Search Part 1
21:19
The Coding Train
Рет қаралды 111 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 820 М.
Where Does Bad Code Come From?
42:21
Molly Rocket
Рет қаралды 214 М.
Coding Challenge #35.5: TSP with Genetic Algorithm and Crossover
23:09
The Coding Train
Рет қаралды 80 М.
Coding Challenge #59: Steering Behaviors
30:56
The Coding Train
Рет қаралды 189 М.
I Spent 100 Hours Inside The Pyramids!
21:43
MrBeast
Рет қаралды 62 МЛН
Hacking a weird TV censoring device
20:59
Ben Eater
Рет қаралды 3,4 МЛН
I built my own 16-Bit CPU in Excel
15:45
Inkbox
Рет қаралды 1,7 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.