Members-Only
Recent Talks & Demos are for members only
You must be an AI Tinkerers active member to view these talks and demos.
March 24, 2026
·
Montreal
Good Vibes and Bad Sheep: An Evolutionary Algorithm
See sheep evolve to find resources in a generated 3D world. Learn about neural networks, evolutionary algorithms, and LLM-assisted coding through this live demonstration.
Overview
An evolutionary algorithm where sheep learn to find food and water in an automatically generated 3D world.
This started as an experiment to see how quickly I could replicate my final year undergraduate computer science project (from 2017) using modern coding practices.
Video
Transcript
Generated 3 months ago
Summary
Generating a talk summary...
View full transcript
Speaker 0: 203 hundred 20 degrees, which is the exact, vision of natural sheep. You see a bunch a bunch of different, blocks appearing. What it's doing is actually sending a bunch of raycasts around, and it's getting information about what it can see in the surrounding area. So each time you see a cube, so here's green. That's the ground.
Speaker 0: Here's white on another sheep. Here, it looks white. It's actually light green on some of the plants, and you see this sort of blue here. And you can actually get all of that information. And what it's doing is if I just click that.
Speaker 0: So what it's doing is it's going into you can see, like, the input layer, on this network. Each of these sheep is running some little neural network, or coded from scratch, over the course of a weekend and going through 2 hidden, hidden layers. And then the output is just how much do you wanna go forward or backwards, how much do you wanna turn left and right. And the each time it's being run, there's a 120 sheep being run. And the ones that survive, the ones with the best weights, are then passing their weights or their their genetics, if you wanna think about it as an evolutionary algorithm.
Speaker 0: And those were the ones that survived. And so over many iterations, you've actually get sheep that do, a fairly good job of surviving. And I'll play that again just so we can see exactly how they're doing. So so far, this, I ran for 2 hours after setting everything up. So some of the sheep are are okay.
Speaker 0: Of course, each, generation you get, there's some sheep who have, somewhat randomness so those sheep don't always do very well. Sometimes they do better than their parents, but not always. So if I select 1,
Speaker 1: random. It's a bit that close there. Yeah. Then you can see, as well I'll pause it just because it's,
Speaker 0: random. Then you can see, as well, I'll pause it just because if that 1 dies, it's gonna have to mess everything up. So you can see it's got its handler level, its thirst level, its age, which is actually as its objective function as well.
Speaker 1: That's good. And
Speaker 0: you also have a list of everything I can see here. So how far everything is away and then also, like, a 3, I don't know, water or minus 1 is nothing and all sorts of these things. So, that's how it's running. I think I can also capture camera to this. And then I think if it works.
Speaker 0: It's a bit jittery because the, the inputs, obviously, they're not, like, smooth or anything. But, yeah, if it cuts out, that means the sheet is dying, unfortunately, so don't get too attached. But, yeah, that's more of it. If you wanted to see the, code as well, like like I said, as part of this experiment, I was trying to see how much these LLM assisted coding tools are done. So I tried to avoid coding myself as much as possible.
Speaker 0: In the end, that wasn't entirely feasible. I did have to step in and do a few changes. For example, the first iteration of the genetic algorithm. I don't know why. For some reason, it decided to clear all the weights before selecting the best ones.
Speaker 0: So it was kind of just choosing at random each time, and it took me a while to work out why it was taking so long to get any decent behavior. So things like that. And also in Unity, you have things like, collisions. Oh, yeah. That did actually died.
Speaker 0: You have, like, collisions. So it was you need to have collisions with the floor, obviously, but not with the water. And then the the water and all these different things that the algorithm or the, the airlines seem to struggle with. I have still been this was from a few months ago, so I've still been doing similar products in Unity since then, and it does seem to have improved in that time with newer models. But yes, let me know if you have any questions.
Speaker 0: That's pretty much
Links
Tech stack
Finding related talks...
Compose Email
Sending...
Email preview
Loading recent emails...