Coding Adventure: Simulating an Ecosystem

2,245,210
744
Published 2019-06-10
In this coding adventure I attempt to simulate a simple ecosystem. Will the foxes and rabbits get along? Probably not...

If you'd like to support the creation of more programming videos like this, please consider becoming a patron here:
www.patreon.com/SebastianLague

This video was inspired by Primer's series on evolution. I highly recommend taking a look!
   • Simulating Natural Selection  
As many in the comments have said, if you enjoy this, you may want to check out equilinox, which is an entire game based around creating an ecosystem. It’s awesome.    • Equilinox Gameplay Demonstration  

Source code:
The source for this video is a total mess, which I don't really want to share!
I'm working on a second part though, and you can find the work-in-progress code for that here: github.com/SebLague/Ecosystem-2/tree/master

Music from filmmusic.io/:
"Inspired", "Deadly Roulette", and "Le Grande Chase" by Kevin MacLeod (incompetech.com/)
Licence: CC BY (creativecommons.org/licenses/by/4.0/)

All Comments (21)
  • @Vohasiiv
    Shouldn't the foxes also have thirst and only eat if they need to? It might be more stable if they have other things to think about than to kill everything in sight
  • @Sulfrix_
    4:14 "So i made something that hopefully looks at least a little bit like a fox" shows a beautiful low poly fox model
  • The foxes should hunt only when they are hungry, the foxes should also need to drink water as well.
  • @unity
    Great video Sebastian! Super interesting use of Unity! - Matt
  • @bira3232
    god: But unfortunately i wasn't gonna let him have such an easy life.
  • @jcfiggy
    1:15 Rabbit: “searching for mate” Later: “mating” Later: “SeArChInG fOr MaTe”
  • @mikaxms
    I think the foxes kill all of the rabbits, because of balancing issues. The foxes should reproduce slower and take longer before they are hungry, resulting in more rabbits per fox. The foxes also don't have any preditors, so the growth is only controlled by the survival meters. Also can the animals die of old age?
  • @preddy09
    In the quest for a perfect simulation the more variables you add, the more you realize there are more variables to add.
  • The concept you touch on at 6:16 is interesting, and there’s actually a similar situation in real-world ecology! In the wild, it’s common for prey animals to re-establish from areas called “refuges,”which predators can’t access easily. This usually occurs after predator populations decrease and is partly responsible for boom and bust reproductive cycles like the ones you saw in your simulation. If you want to play with this model more, you might wall off a couple of areas to foxes and see what that does.
  • @yugen7147
    The bunnies should have had a certain % chance to escape the fox; I think in the wild, most of the time a predator doesn't make the kill. The fox should also have a certain amount of energy - enough energy to only make like 5 attempts at killing a bunny. If it fails to do so in those many attempts, it should die off.
  • @stealthy1223
    Deploys foxed that can instantly kill a rabbit and never stop eating until everything is dead Ecosystem!
  • @QuestionMark43
    "Which I hope looks a little bit like a fox." Dude your modeling skills are pretty good no need to flex on us like that...😂
  • "H's not likely to have much luck though, on account of being the only rabbit in existence" LMAO
  • @samllyn
    "if she rejects him he'll add her to his mental list of unimpressed females and wont approach her again" good guy rabbit "until he's forgotten about it a little while later" typical guy rabbit
  • @Sausytime
    Reminds me of Thin Matrix's project Equilinox.
  • @Zholat
    So uh.. could you reduce my List of unimpressedFemales? My ForgetRejection Timer seems to have stopped working...
  • @MrJimbo925
    I know this is 3 years old now, but I really want a part 2 please.
  • @andreibalasa745
    All I want for Christmas is this man's knownledge in programming