C++ Ants Simulation 2, Path optimization

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024
  • New version with better marker algorithm allowing path optimization
    New data model (x3 perf)
    Old video • C++ Ants Simulation 1,...
    Github github.com/joh...
    Music freepd.com/mus...

Комментарии • 481

  • @PezzzasWork
    @PezzzasWork  3 года назад +144

    Windows release, instructions in the ReadMe file
    github.com/johnBuffer/AntSimulator/releases/download/v2.1/AntsSimulator.zip

    • @xere1917
      @xere1917 3 года назад +5

      is it possible to add two types of ants with different behavior and start positions for a simulation like this?

    • @qualia765
      @qualia765 3 года назад +3

      very cool, i probably spent 2-3 hours just playing with this

    • @rxkshan
      @rxkshan 3 года назад

      Okay

    • @tsm688
      @tsm688 3 года назад

      is it possible to make a version of this which isn't purely fullscreen?

    • @rxkshan
      @rxkshan 3 года назад

      @@tsm688 possible

  • @THExRISER
    @THExRISER 3 года назад +758

    It's amazing how cool complex behavior can emerge out of very simple rules.

    • @betterfly7398
      @betterfly7398 3 года назад +2

      @MorTobXD Is the course on chaos theory?

    • @THExRISER
      @THExRISER 3 года назад +4

      @MorTobXD Well that's a shame, it sounded inteesting.

    • @nameismetatoo4591
      @nameismetatoo4591 3 года назад +23

      Not just behavior, but also life itself also emerges from simple rules:
      1) Eat
      2) Don't get eaten
      3) Reproduce.
      If you want to get really philosophical, you could argue that what ultimately drives this emergence of complexity is a simple energy gradient; hot sun + cold space = a flow of energy that can be exploited to rearrange molecules, i.e. life.

    • @gileee
      @gileee 3 года назад +1

      Just what I was thinking.
      Rule: Sebastian Lague puts out a video
      Result: RUclips gets flooded with copies
      jk jk

    • @foxolotl4389
      @foxolotl4389 3 года назад

      And its very interesting to see that they keep their rules in mind.

  • @Rickilicious
    @Rickilicious 3 года назад +627

    this is pretty dope. a lot of others have taken inspiration from your work, but the pathing on the ants here is top tier. The ants slowly optimizing the lines seems very organic and authentic too. Please keep extending this silly little project. Add a queen and larvae or opposing ant colonies or something. you slowly perfecting their behavior is very entertaining for me as a viewer.

    • @fakedoorsfordinner1677
      @fakedoorsfordinner1677 3 года назад +6

      Agree

    • @terrasolaris5104
      @terrasolaris5104 3 года назад +16

      RUclips needs more commentors like you. Agreed 👽

    • @antoninperbosc1532
      @antoninperbosc1532 3 года назад +7

      Whend looking at this video of this beautifull ants simulation this remember me dendrits in bio neural networks, fungus filament or blob system ...

    • @THEcrosby
      @THEcrosby 3 года назад +3

      Yeah what he said

  • @Jaun_
    @Jaun_ 3 года назад +201

    This could work for multiple spawn points too I’d imagine - would be interesting to see it the ants choose the more optimal spawn point

    • @littensy
      @littensy 3 года назад +39

      Where we dropping arthropods

    • @bigsmoke6414
      @bigsmoke6414 3 года назад +4

      Or the Option to RAID/eat rival Spawn points

    • @CMDRunematti
      @CMDRunematti 2 года назад +4

      couple billion spawns and you have a human brain made of ants (cant be looking like neurons only to me)

  • @EnergiaRocket
    @EnergiaRocket 3 года назад +69

    I saw "Thanks for watching" and was sad that my daily dose of beautiful patterns was over.
    Then I saw that the "Thanks for watching" was food too, and was happy again :D

    • @miner4236
      @miner4236 3 года назад +3

      Absolutely genius ending lol. Homemade video editing :D

  • @zarro110
    @zarro110 3 года назад +125

    I liked how at 1:30 the whole path swings back and forwards like a tentacle sucking up food

    • @zarro110
      @zarro110 3 года назад +18

      btw: can you do a maze (with multiple valid paths) and see if they optimize that? You would probably have to set the variable to stray from the path pretty high to make that work but it would be a fun experiment to see.

    • @Grgrqr
      @Grgrqr 3 года назад

      Or brain cells

    • @betterfly7398
      @betterfly7398 3 года назад +3

      @@zarro110 I don't know if you know but, there is literally an algorithm called ant colony optimization.

  • @du42bz
    @du42bz 3 года назад +54

    This is awesome
    Now imagine this but a 1 hour long version

  • @123TeeMee
    @123TeeMee 3 года назад +45

    I like that theres all sorts of ways this stuff can be extended. Maybe evolve colonies whose coefficients and stuff are defined by genes

  • @ITR
    @ITR 3 года назад +28

    It would be cool to see simulations of two separate colonies with separate markers, having them use their own colony's markers and move a way from the foreign ones.

  • @mr.norris3840
    @mr.norris3840 3 года назад +113

    Background music be like: *Yeah, this is an Avengers level threat*

  • @oakleaves3605
    @oakleaves3605 3 года назад +21

    We need this as a wallpaper, would love to have it on my wallpaper engine library

  • @alrineusaldore6764
    @alrineusaldore6764 3 года назад +9

    That ending when the ants ate the "thanks for watching" was so satisfying lol

  • @laurino.
    @laurino. 3 года назад +9

    I would like to see that the ants return even if they didn't get food, to follow others or just because they are too far from home and find nothing

    • @nibbletrinnal2289
      @nibbletrinnal2289 3 года назад +3

      This makes quite a bit of sense, actually. No use wandering forever in the opposite direction of the food so you may as well go back home and see if there're any existing paths to food

  • @collin2097
    @collin2097 3 года назад +15

    i think you should add a "infinite food" thing, which doesn't deplete, so that some wont have to constantly place more food whenever it depletes

    • @tabularasa0606
      @tabularasa0606 3 года назад +9

      Random food spawns! And random obstructions falling into place.

    • @HyperMAX9001
      @HyperMAX9001 2 года назад +2

      @@tabularasa0606 And hunger for the small creatures. If it goes full, they die.

    • @stoobidthing
      @stoobidthing 2 года назад +2

      @@HyperMAX9001 >"And hunger for the small creatures. If it goes full, they die."
      He implemented this in the newer versions but a little differently,
      If an ant goes too far from either its colony or food for too long it dies

  • @shadrsabirov6412
    @shadrsabirov6412 3 года назад +4

    -How do you spend your free time?
    -I watch ants walk

  • @shottysteve
    @shottysteve 2 года назад +2

    this makes me wonder how ants actually find their way back to the nest… really cool work, great job!

  • @xcreeperbombx61
    @xcreeperbombx61 3 года назад +4

    Suggestion: Enemy colonies/species
    Description: You have the option to look at the perpective of a ant colony. This will visually make the dots of the other colonies blue. Ants without food may follow the blue trails, while ants with food will avoid it. Two ants of different colonies when close to each other will "fight", which simply chooses a random ant to get removed. If the removed ant had food, there will be a food piece where it died.
    Added stuff: Dots have colony marker, different ant types, ant home marker, ants will "fight" with random winner
    -------------------------------------
    Suggestion: Regrowth
    Description: Empty space near food will have a chance of becoming food. There is also a super smaller chance that the empty space will do it without being near food
    Added stuff: Empty space will become food with a chance of N+(0.125-N/8)*F (N being a small number, F being food nearby, and the chance being in decimal form)
    ------------------------------------
    Suggestion: Reproduction
    Description: An amount of food at a colony nest will create an ant of that colony. Should work best with the Enemy colonies/species suggestion.
    Added stuff: The stuff is litterally said in one sentence for this suggestion, why do you need this section?

  • @ruffzi5786
    @ruffzi5786 3 года назад +2

    how to make it ????

  • @ants7219
    @ants7219 3 года назад +6

    I really hope you've seen sebastian lague's most recent video

  • @UmzGames
    @UmzGames 3 года назад +3

    There is nothing so satisfying like watching ants, or anything that simulates ants..

  • @nolanbie3664
    @nolanbie3664 3 года назад +2

    It’s so interesting to see how Nature imitates nature even in a simulation. That test near the end was honestly looking like a plasma ball. It’s so interesting because it’s still based on the idea of take the easiest path with the least resistance which almost everything in existence follows.

    • @nolanbie3664
      @nolanbie3664 3 года назад +2

      I’m way to high for this

  • @KaletheQuick
    @KaletheQuick 3 года назад +3

    This is super cool!
    Has anyone tried adding more pharamones? Tasks? or perhaps an enemy colony? Perhaps a 'death' pharamone that invites others to investigate, and a fighting pharamone. I love ants and my mind is racing! I'll check out the github :D

  • @hkar19
    @hkar19 3 года назад +1

    Let's say a random ant found a trail home. How does the ant know which way home? By looking which way is less intense of trail?

  • @willjohnson4579
    @willjohnson4579 3 года назад +4

    seeing you make a part 2 to this almost a year later makes me wanna pick up some old projects! I wonder, did you think your old code was bad?

  • @Sciencedoneright
    @Sciencedoneright 3 года назад +1

    Why don't you make a CrashHandler? It keeps crashing ;(

  • @underslash898
    @underslash898 3 года назад +4

    Just started watching you, but this is great content :)

  • @mateuszkolpa
    @mateuszkolpa 3 года назад +6

    Awesome work! :))

  • @MechanicalMooCow
    @MechanicalMooCow 3 года назад +1

    Now simulate flying ants

  • @ThylineTheGay
    @ThylineTheGay 3 года назад +1

    This makes me really want a factorio like game but with ants

  • @tattwashiwani3158
    @tattwashiwani3158 3 года назад +1

    I perceive the ants as humans exploring the conundrums of our universe 😍

  • @HPetch
    @HPetch 3 года назад +2

    Very cool! One thing that does kind of bug (heh) me is that the ants themselves aren't particularly realistic - most notably, they have infinite stamina - but trying to model that in a way that both performs reasonably well and actually generates interesting results is probably more trouble than it's worth.

  • @falacommeufalo
    @falacommeufalo 3 года назад +4

    Man, i love your videos!

  • @skipfred
    @skipfred 3 года назад +2

    Wow, I've seen a lot of ant simulators but what you've done here is probably the most organic and natural system I've seen. Great works really interesting and beautiful patterns

  • @duffman7674
    @duffman7674 3 года назад +1

    Now try using compute shaders and use millions of ants.

  • @tenbeat
    @tenbeat 3 года назад +1

    Digger ants would be an interesting mechanic.

  • @user_hat
    @user_hat 3 года назад +1

    how do I move ant spawn? also, you can't place ants

  • @RoboticusMusic
    @RoboticusMusic 3 года назад +1

    What does it mean for something to be food most fundamentally?

  • @SuboptimalEng
    @SuboptimalEng 3 года назад

    Who drew the mind flayer better?
    1. Will (from Stranger Things)
    2. Pezzza

  • @chris43123
    @chris43123 3 года назад +3

    I would love to see this a wallpaper engine background

  • @nazariimoroz6216
    @nazariimoroz6216 3 года назад +1

    Man, great work! Also, it's great that you posted the program but I'm begging you, please please please make a video tutorial of how you coded the simulator...

  • @docecho7372
    @docecho7372 3 года назад +1

    could you theoretically use these ants to solve a maze?

  • @Sleepy_Cattt
    @Sleepy_Cattt 3 года назад +1

    4:25 it's like one of those lightning ball things!

  • @fugh7098
    @fugh7098 3 года назад +1

    The ant should be back by the trace while it found the food. Why do ants continue to move randomly as they found the food?

    • @robertb6276
      @robertb6276 3 года назад

      This, after they find food they should turn 180+- a degree and follow their home path home.

  • @abderrahmanemekaoussi5377
    @abderrahmanemekaoussi5377 3 года назад +1

    How can i do this i only know some c++ 😅

  • @Dillbeet
    @Dillbeet 3 года назад +1

    This science is so rad

  • @TehPwnerer
    @TehPwnerer 2 года назад +1

    I have spent at least two or 300 hours just watching ants and how they behave and react to food sources and maybe it's the simplicity of your models that don't take into account any sort of real world geometry but they behave much differently at least the ones I've been observing

    • @andrewadkins8440
      @andrewadkins8440 2 года назад

      World be interested in hearing the differences or seeing a resource that encapsulates them in a digestible but specific package.
      I'm sure nature gave them every optimization they could.

    • @krccmsitp2884
      @krccmsitp2884 2 года назад

      I'm curious, what are the differences, how do they behave differently in nature?

  • @lukebrodersen1424
    @lukebrodersen1424 3 года назад +2

    Would be really cool to see if they’d find the optimal route in a maze.

  • @facundogomez3986
    @facundogomez3986 3 года назад +1

    Can you upload a simulation without the dots that lead home and food?

  • @nou4898
    @nou4898 3 года назад +2

    i like how the paths optimize into kinda streight lines

  • @rxkshan
    @rxkshan 3 года назад +1

    What you know about me?

  • @antoniohenrique6749
    @antoniohenrique6749 3 года назад +1

    Your C++ code is so good that i am still seeing ants on my screen even 10 minutes after watching the video

  • @pinaz993
    @pinaz993 3 года назад +1

    This makes me wonder if you could use a similar technique to implement pathfinding in a 3d environment, though it would only be good for a system that would have the opportunity to use the path over and over again.

  • @m0hity4sh8
    @m0hity4sh8 3 года назад +1

    when u cant draw nerves:

  • @marianaurel
    @marianaurel 3 года назад +1

    This is absolutely amazing. The way coding and visual animations were implemented are very impressing!! It's emotional to see other people achieving this kind of skills.

  • @blurblur3642
    @blurblur3642 2 года назад

    This is a amazing and beautiful simulation!
    And inspred by you, I make a simillar Ant Simulation in Unity but I am stucking in some troubles.
    My ants now can seach for food and build paths between home and foods. But they were not able to optimize the path. Because I am not sure how to "determine the ant's tendency to get out of the way", and I just set a random bool to determine weather should the ant follow the Pheromones or just wander each frame. Predictably it didn't work.
    May I know how you handle this? And thanks for your time to read this message!

  • @indy69420
    @indy69420 3 года назад

    I felt like Paul Rudd with the avengers music playing.

  • @TheSkepticSkwerl
    @TheSkepticSkwerl 2 года назад

    I don't know the algorithm. But I've seen these patterns in nature. 1. Those electric disks/plasma balls. 2. Brain neurons. It's interesting to watch.

  • @ewaldlatreider5127
    @ewaldlatreider5127 2 года назад +1

    Good job mr rooster

  • @WatOnsonn
    @WatOnsonn 3 года назад +1

    This should have so many more views. Amazing work

  • @Thecommet
    @Thecommet 3 года назад

    I see one ant that doesn't give a single fuck about pheromones. It just walks a straight line between food and home

  • @andrewevenson2657
    @andrewevenson2657 3 года назад

    I only have 1 question. Why is your video not destroyed by youtube compression? This seems like the exact kind of content that would look like a pixelated mess when compressed.

  • @thehandleiwantedwasntavailable
    @thehandleiwantedwasntavailable 3 года назад

    While beautiful to watch, I’m not sure ant behaviour is like this. Once your ant finds food, they go off on random paths again. Ants of course know the way back home, so they simply retrace their steps, and inform others of the path to food.

  • @davidbranton6511
    @davidbranton6511 3 года назад

    OK so I was thinking what if it was people walking in do you have maps generated from like the larger distances and making the points smaller maybe adding some kind of buildings and then if all good trying to maybe import a real basic kind of geographical map? Like trail maker? Kinda inspired by Harry Potter

  • @Milim-.-Nava
    @Milim-.-Nava 2 года назад

    What if you gave the ants the perfect path to something and then freed up more space around it. Would they begin to firm a less optimal path?

  • @furukura
    @furukura 3 года назад +1

    There's a psychic ant that goes directly between the hill and the food. Is that ant 0 issues?

    • @PezzzasWork
      @PezzzasWork  3 года назад

      Yes it was a initialization problem that has been fixed

    • @YayDee85
      @YayDee85 Год назад

      I noticed that single ant too. Happy to see I'm not the only one. ^^

  • @snowcatman
    @snowcatman 3 года назад

    wanting to learn how to code myself.. needing a mentor/coach. Would like to see a small hive to a large hive birth to death scale. Also, would like to see a 3d application with a time line look like the old vhs tapes. so you can preview whats going on in different ways. be interesting to see a trace view or a partial view. be interesting to see a closed world small and or large scale. With different objectives, obstacles and migrations and/or hive splits(new queen).

  • @TheFoxfirelight
    @TheFoxfirelight 2 года назад

    I wanna see this but in a maze with multiole spots of food (not a trail), that leads the simulated ants through the maze. (Of a sort. More likrle checkpoints)

  • @CThaunts
    @CThaunts 2 года назад

    This teaches us the ways of leadership too because this wouldn’t happen if one didn’t go to the food and bring it home

  • @scottcastle9119
    @scottcastle9119 2 года назад

    I've been watching these videos and wonder if its possible to create an AI that can learn itself, come up with strategy's, that would be fun to watch.

  • @greyaycock6222
    @greyaycock6222 3 года назад +1

    alpha poge

  • @TheRealNiktWazny
    @TheRealNiktWazny 2 года назад

    that's just like how neuron connections are made by body except in 3D instead of 2D

  • @JTheoryScience
    @JTheoryScience 3 года назад

    this reminds me of quantum computer error correction and optimization systems

  • @julian1000
    @julian1000 2 года назад

    I'd be so curious to see how this aligns with desire paths at universities or racing lines in F1

  • @bobsmithy3103
    @bobsmithy3103 3 года назад

    How many blocks are used as inputs for the ant's pathfinding?

  • @rxpmbeats7453
    @rxpmbeats7453 Год назад

    can u please show the basic requirments to create these types of simulations?

  • @YeshuaGod22
    @YeshuaGod22 3 года назад

    A real ant has a much more sophisticated sense of the location of home. Perhaps a line of code could be added to make the direction of a laden ant more likely to be directly toward the colony. Maybe another to favour outward movement when unladen.

  • @thingaboutit441
    @thingaboutit441 3 года назад

    Could there be a "danger hormone" where the ants would avoid? Then u could put some spiders or black holes or whtvr

  • @shleaumeau7740
    @shleaumeau7740 2 года назад

    Now what about predation and obstacles, and optimizing routes around danger?

  • @simonpeggboard4004
    @simonpeggboard4004 2 года назад

    optimal paths end up following nature like paths i.e. Leaf vein patterns, retinal images etc.

  • @eestaashottentotti2242
    @eestaashottentotti2242 2 года назад

    You are now following: Rants Simulation, underneath the video.

  • @kennethsideas84
    @kennethsideas84 3 года назад +1

    Pog

  • @RobboMcjobbo
    @RobboMcjobbo 2 года назад

    This really show how ants are extremely intelligent as a collective. They are the definition of "2 heads is better than 1".

  • @sipnayan451
    @sipnayan451 3 года назад

    love 'em or hate 'em, the fact that ants have been doing this type of strategy for centuries makes me amazed... and scared lel, imagine in the past where ants are as big as an average cellphone

  • @fcooett
    @fcooett 3 года назад

    bro put a random resistance to the floor so the ants speed depends on it. it'll create amazing path optimizations routes. this algorithm could be useful as heuristic optimizer

  • @FrostCraftedMC
    @FrostCraftedMC 2 года назад

    the way they form neural looking shapes makes me wonder if a similar method could be used for neural nets.

  • @Think666_
    @Think666_ 3 года назад

    Why does one ant make B-line straight to the goal and back on loop, and ignoring all pathing? 2nd sim.

  • @Hydrogenbobm
    @Hydrogenbobm 3 года назад

    Guy: erases rock
    The ants: but the how who did how rock get is small?

  • @Leo-ii4hy
    @Leo-ii4hy 3 года назад +2

    Looks organic 👍👍👍

  • @JSLing-vv5go
    @JSLing-vv5go 3 года назад

    Really curious what might happen with two or more large food sources.

  • @shleaumeau7740
    @shleaumeau7740 2 года назад

    Each ant has a freedom coefficient and this one’s set to AMERICA 🇺🇸

  • @NavySturmGewehr
    @NavySturmGewehr 3 года назад

    be interesting to compare simulation to the real behavior of ants.

  • @EvanG529
    @EvanG529 3 года назад

    I wonder if the simulation that looks like a plasma ball is actually a model for the currents in a plasma ball.

  • @jiyunsun
    @jiyunsun 3 года назад

    man could you not make an exe or an installer or something for people to play with????

  • @jay-tbl
    @jay-tbl 3 года назад

    Old ants should eventually die and new ones be born to cut down on the hundreds of lost ants

  • @thestarkye6604
    @thestarkye6604 3 года назад

    Okay but why does the paths remind me of the images of neurons that they showed in bio class at school

  • @ShunanoriNisinomiya
    @ShunanoriNisinomiya Год назад

    I love insects and when I was a kid I used to watch ants all the time. Thanks for the great video.

  • @kingcole55
    @kingcole55 3 года назад

    Is it common for ants to continue returning to the site of food after the food has been depleted? Maybe there should be a "no more food" pheromone?

  • @TheMrMeteor
    @TheMrMeteor 3 года назад

    maybe it'll help, but I think Ants release a pheromone or something when they're aware that there's no more to gather.

  • @EmmaElite
    @EmmaElite 3 года назад

    From a distance and sped up this reminds me of how electricity flows path of least resistance

  • @AynenMakino
    @AynenMakino 3 года назад

    What happens when you don't show the trails, only the ants, their home, the walls and the food?