Coding Adventure: Simulating an Ecosystem

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:

This video was inspired by Primer's series on evolution. I highly recommend taking a look!
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.

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:

Music from
"Inspired", "Deadly Roulette", and "Le Grande Chase" by Kevin MacLeod ( )
Licence: CC BY ( )


  • Kaaz Mun
    Kaaz Mun23 orë më parë

    Those foxes were fucking RAVENOUS. Not even stopping for water as their bottomless voids for stomach had to be FILLED. A horrifying exercise in futility, to be sure.

  • Izzy R.
    Izzy R.Ditë më parë

    Why does my RequestMate always return false tho.

  • Bruh VineComp
    Bruh VineComp3 ditë më parë

    buny :3

  • C J
    C J6 ditë më parë

    Bruh at the end I was like why's the video of like 1 minute? And realised I saw a whole 6 min video!

  • Agustin Berguecio
    Agustin Berguecio6 ditë më parë

    I beg you please put this in the solar system project. that will make the planets soow alive and interesting!!! imagine goig to a planet, hunt de foxes and then the rabits population increases because they have no natural predator

  • RROL Ryland
    RROL Ryland8 ditë më parë

    What software do you use for this stuff

  • Walter Beckett
    Walter Beckett9 ditë më parë

    why you didn't open it in unity and export it?

  • DawnExplain
    DawnExplain9 ditë më parë

    1:26 Did anyone notice that after the male rabbit finished breeding he immediately turned around and began *looking for male rabbit* lol

  • Konnect House
    Konnect House9 ditë më parë

    I can't code if my baby keeps slowing me down

  • spoctral
    spoctral11 ditë më parë


  • sans lazybones
    sans lazybones11 ditë më parë

    I tried doing a simmilar thing in scratch but the plants would fill the screen, then the herbivore population will rise, consuming all the plants, making food impossiblr to find The herbivores would eventually due of hunger, and the carnivores too, as they have no more herbivores to eat

  • Pippy Pop's Self HarmMonica
    Pippy Pop's Self HarmMonica11 ditë më parë

    Even in the videogames the pain of rejection remains prevalent.

  • CuppaJoe1
    CuppaJoe112 ditë më parë

    Now add in humans lol

  • Slezy -
    Slezy -12 ditë më parë

    i need to be this good :)

  • The Foxxo
    The Foxxo12 ditë më parë

    Foxy goes Nom Nom

  • Hippienolic 2
    Hippienolic 213 ditë më parë

    This channel is a goldmine. Just watched your video about how computers remember and now this

  • Mighty Possum
    Mighty Possum13 ditë më parë

  • Slimer 87_
    Slimer 87_14 ditë më parë

    I think the foxes should have the same things as rabbits so the rabbits wont get extinct, like thirsty or hunt only when hungry

  • Winshin Yi
    Winshin Yi14 ditë më parë

    Hey can you upload this as a game please?

  • Christian Olson
    Christian Olson15 ditë më parë

    "Then they realized they made a terrible mistake and starved to death." Perfect.

  • bezalel avrhamy
    bezalel avrhamy15 ditë më parë

    finally. the key to getting a gf is revealed. red fur

  • Lord Drakostar
    Lord Drakostar15 ditë më parë

    Should have added a gene for how many bunnies are born, but at dhe cost of the modher being more hungry and thirsty whilst pregnant.

  • Jabran Saeed
    Jabran Saeed15 ditë më parë

    yo why cant they sleep bud?

  • thesysop
    thesysop16 ditë më parë

    ayyyy 69,420 likes

  • Peter Babicki
    Peter Babicki17 ditë më parë

    I remember a fox breaking into my grandads chicken hutch - it killed all the chickens and took one to eat. It seems like foxes are just bastards.

  • Hans Milling
    Hans Milling17 ditë më parë

    Great video, it’s fun with all your experiments. Reminds me when I started coding on my C64, trying all sorts of techniques, algorithms etc out.

  • Dave
    Dave17 ditë më parë

    What did you use to create this visual simulation. Could you share it and what you made?

  • Little Eden Valley Farm
    Little Eden Valley Farm17 ditë më parë

    Things to add in. Rabbits irl have burrows. If a rabbit is within 50 feet of a burrow it can escape a predator. This should add in a factor to help both the rabbits and foxes to live much longer together. I would add in a limit for the burrow since female rabbits are also very territorial.

  • Regin TheSmith
    Regin TheSmith18 ditë më parë

    He should finish the second part he was making. Part one was so interesting and cool. It looked like the second one was gonna be way better, so sad he stopped working on it.

  • LPS Foxstar
    LPS Foxstar19 ditë më parë

    Should do this again or continue this but give foxes thirst etc and add a bunch of animals, then see how you could stabilize the ecosystem and make it like a 45 min long video

  • Jack Herren
    Jack Herren19 ditë më parë

    This is the single most interesting thing I’ve watched in the past year

  • Anant Gamer
    Anant Gamer19 ditë më parë

    You can gift mojang: minecraft 1.18

  • Mark Merritt
    Mark Merritt19 ditë më parë

    Yay! So glad I found this!

  • Scott Klein
    Scott Klein19 ditë më parë

    The population of foxes and rabbits crashing is actually a very accurate outcome. Population numbers are very unstable and at “equilibrium” fluctuate around the number of individuals the environment can support. This effect is especially visible in predators - which is why animals like foxes are omnivores (they eat berries, eggs, and insects, among other things like rabbits). - source: have a degree in Ecology

  • Aranis Arora
    Aranis Arora19 ditë më parë

    so I'm red......? just a thought...

  • sgtrpcommand
    sgtrpcommand21 ditë më parë

    2:12 More desirable has red hair. Got it. Anyone have any red paint?

  • Blue Saber
    Blue Saber22 ditë më parë

    i really want a game kinda like this where you can simulate a ecosystem, give it natural selection, and creatures the ability to evolve, wouldnt need a lot of control or anything just kinda mess with genes a bit and see how it plays out, if something dies out you can restart or let it continue if there's other things there that can keep the world filled with life

  • Code Master
    Code Master22 ditë më parë

    Can you tell us how you make these videos? They are very interesting.

  • Bobby Teele
    Bobby Teele23 ditë më parë

    Hey can you please add more animals so its like a big ecosystem simulator but not where we have to think about some many of them

  • Sea Pupper
    Sea Pupper24 ditë më parë

    Please update this

  • Richard Osborn
    Richard Osborn27 ditë më parë

    This was incredibly interesting! Thanks.

  • Jesse Goonerage
    Jesse Goonerage28 ditë më parë

    "Currently that bunny's urge is stronger than his hunger or thirst" Same for me too.

  • Commander Clueless
    Commander Clueless28 ditë më parë

    "He's not likely to have much luck though on account of being the only rabbit in existence" frickin' OOF

  • HyperCircle
    HyperCircleMuaj më parë

    rabbits should have *some* holes they can hide in. also what others said about foxes should drink, be full after certain number of rabits.

  • DarkDrai
    DarkDraiMuaj më parë

    Make the map bigger if you're going to have such fast, murderous creatures. Your rabbits' defenses are useless against these foxes, unlike real rabbits and real foxes.

  • Tigercraft
    TigercraftMuaj më parë

    I wish this was a game!

  • Murthy Bhavaraju
    Murthy BhavarajuMuaj më parë

    Did you use GOAP for AI ?

  • Jeffrey morris
    Jeffrey morrisMuaj më parë

    "An urge to reproduce"

  • bshaun
    bshaunMuaj më parë

    My fur must not be red in real life 😕

  • Uri Rennert
    Uri RennertMuaj më parë

    I didn't think this video would be as interesting as it was 11/10 would watch again

  • German FLATLINE
    German FLATLINEMuaj më parë

    Could keep adding different animals and plants to help further balance the ecosystem

  • That One Sand Enthusiest
    That One Sand EnthusiestMuaj më parë

    Idea to give the rabbits a better chance, give the foxes thirst and food needs, now they need to spend time drinking and when they're full they will stop eating the rabbits.

  • Afer
    AferMuaj më parë

    OMG that buddy is so cuteeeee :DDDD

  • theduo bros
    theduo brosMuaj më parë

    Publish the simulation on play store. Put the link of simulation under this video if you have already.

  • BlvCown
    BlvCownMuaj më parë

    Maybe if you advance it further it will become making theory’s that their life is a simulation!

  • Bubbletankking
    BubbletankkingMuaj më parë

    As others have mentioned the predators needed to not hunt when full but as an extension to that I wonder what effect/trend there would be if stomach size was a stat open to the evolution mechanics similar to the rabbits' speed and such. I assume it would tend towards not wasting however much a single rabbit can provide but I wonder if there'd be any other trends on it. Perhaps getting as close to a single rabbit as possible to not overhunt the ecosystem ends up being favored in evolution (at least in this case)? Or maybe it just gets larger to out-store competitors? Something that isn't even coming to mind? I'm quite curious.

  • Calvin Benefield
    Calvin BenefieldMuaj më parë

    i just noticed the captions keep calling the genes jeans

  • aa bb
    aa bbMuaj më parë

    So how do they evolve according to their surroundings? It seems like the gene selection is completely random.

  • NetPeggle
    NetPeggleMuaj më parë

    Sebastian Lague would you mind sharing how you made the charts? :)

  • Samuel Hugo
    Samuel HugoMuaj më parë

    I hope you coded it so that siblings don't axidently mate or at least penalties when they do

  • Samuel Hugo

    Samuel Hugo

    12 orë më parë

    @BrianComics everything is related since we all originated from the same first micro organism, me and this plant next to me are related, we have a common ansestor very far back

  • BrianComics


    Ditë më parë

    Everyone is related since we all originated from the first group of humans.

  • Creator Productions
    Creator ProductionsMuaj më parë

    This is so cool! I would love to create a game where you don’t really affect the game but you can see the world change Islands being created Animals being hunting and extinc And maybe a update where you can actually create your own animals 👀

  • James Barclay
    James BarclayMuaj më parë

    Very interesting!

  • Yannick
    YannickMuaj më parë

    Conclusion: Foxes and rabbits don't cooperate...

  • Ajinkya Sanas
    Ajinkya SanasMuaj më parë

    Game like equilinox by thin matrix

  • •-•
    •-•Muaj më parë

    Moral of the story : hide from foxes live. Live = gud

  • kto to
    kto toMuaj më parë


  • Andrew Marines
    Andrew Marines2 muaj më parë

    Are you ever gonna update this?

  • Navneet GameDev Hindi
    Navneet GameDev Hindi2 muaj më parë


  • Govind Dwivedi
    Govind Dwivedi2 muaj më parë

    It is amazing!

  • Gustavo
    Gustavo2 muaj më parë

    Someone can please tell me if this use artifical intelligence? For example, the bunny search for his necessities by randomly walking in the world, or it uses some kind of AI?

  • Avijit Palit
    Avijit Palit2 muaj më parë

    Good. For long time I also wanted to create this type of simulation but with humans. What about emotion AI. Can you program it with emotion AI?

  • Waxillion
    Waxillion2 muaj më parë

    I would love to see you explore this a lot more. There are so many things to add and interesting discoveries to make! Really enjoying your adventures :)

  • Raushan Blake
    Raushan Blake2 muaj më parë

    So probably we all are a product of coding as well

  • Alan B. Wolfs
    Alan B. Wolfs2 muaj më parë

    I wish sometime we get a game based on ecosystemic mechanics. Minecraft world feels just way too dead As for the simulation as everyone has already said, foxes should also drink and eat when necessary As for other mechanics, I'd suggest including: -Grouping -Detectability (having the foxes an easier target if the bunny is red, for example) -Sleeping -Housing -Pregnancy (including it's weaknesses) -Foraging techniques (animals do actually have different behaviour towards different patches of food and there are actually formulas describing their decissions) Lots of variables indeed, but that's evolution; getting several variables to influence a beings life

  • Brianna Love
    Brianna Love2 muaj më parë

    Me seeing this is my rec: ooh, I wonder if this is similar to Primer! *Primer is mentioned within the first 10 seconds* :')

  • Nevir202
    Nevir2022 muaj më parë

    I'd say your issue with the populations not coexisting had to do with the fact that IRL, carnivores are much less voracious then herbivores. So foxes should be taking a little rest after meals.

  • Varqz
    Varqz2 muaj më parë

    2:50 when you see it you cant unsee it

  • Bruh momentus
    Bruh momentus2 muaj më parë

    Computer Science is a wonderful field

  • Sebb5
    Sebb52 muaj më parë

    I think you made the fox too strong that's why they couldn't co-exist. Thinking about it, humans are equvalent of the fox on earth, we're too strong to co-exist but we actively choose to not kill everything because then we also die.

  • SorrowAndSufferin
    SorrowAndSufferin2 muaj më parë

    *sigh* I so want to reproduce this myself, but I'm not well versed enough to...

  • 24k Lamb
    24k Lamb2 muaj më parë

    Funny how without predators the female bunnies were more picky but when you introduced the predators they were less picky. This is similar to life I'd think.

  • Reden Manalastas
    Reden Manalastas2 muaj më parë

    Hellow sir how to joining need me this video petreon

  • John Games and Draws Channel
    John Games and Draws Channel3 muaj më parë

    How do I download this?

  • Gabriel Marcondes
    Gabriel Marcondes3 muaj më parë

    please.. what is the song at 4:36 ?

  • Auferen
    Auferen3 muaj më parë

    Virgin brown bunny VS Chad red bunny

  • Auferen


    3 muaj më parë


  • Sanderdrack12
    Sanderdrack123 muaj më parë

    Showing code: NO Showing game scene: sure!

  • Genubath
    Genubath3 muaj më parë

    They should have a "cowardice" gene that effects how much they want to run away from the foxes as opposed to doing other things. The males should have desirability cost something and the females should have a promiscuity gene that affects how much they care about desirability.

  • Stephanzoes
    Stephanzoes3 muaj më parë

    The title should be: How to play god...

  • Lil Igloo
    Lil Igloo3 muaj më parë

    This is what’s happening to me right now :) hopping around like a goof being watched by a superior being

  • Adder
    Adder3 muaj më parë

    Anything like this available anyone knows of? I think it would be col to fuck about with

  • Adder


    3 muaj më parë

    Other than the remake from primers

  • umberto he
    umberto he3 muaj më parë

    so great

  • JAX
    JAX3 muaj më parë

    This was fun

  • Madara Uchiha
    Madara Uchiha3 muaj më parë

    What if you wanted to live life happier but God said unfortunately I wasn't gonna let him have such an easy life

  • FoxieHikari
    FoxieHikari3 muaj më parë

    Saw the thumbnail and had to click it. Glad to be your dominant species. Don’t run from me rabbits. EDIT: We’re not going extinct that easy...

  • JazzToTheTwo
    JazzToTheTwo3 muaj më parë

    You don't understand. I'm obsessed with the fox model

  • Wizardscroll Games
    Wizardscroll Games3 muaj më parë

    Foxes should get tired and hungry from chasing rabbits so they should prioritize the slower (younger) rabbits.

  • DiasCharu Madushan
    DiasCharu Madushan3 muaj më parë

    I love this kinda graphics

  • NorwegianLasanga
    NorwegianLasanga3 muaj më parë

    you should add that the foxes when they eat get alot less hunger because meat contains more energy than plants

  • Elation
    Elation3 muaj më parë

    Imagine a randomly generated world with dozens of ecosystems amongst plants and animals that are all sustainable being combined with a sandbox game that the player can adapt to affect ecosystems. This would be such a fun game.

  • Anime Addict
    Anime Addict3 muaj më parë

    Ive seen a few different videos like this where people do simulations and you can see the different stages pop up as they are mentioned and there's different graphs for the evolution paths/genes. I was just wondering what software you used for this?

  • Anime Addict

    Anime Addict

    3 muaj më parë

    Is there a precoded button you press to move through the different stages as you mention them?

Faqja Tjeter