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...
Windows release, instructions in the ReadMe file
github.com/johnBuffer/AntSimulator/releases/download/v2.1/AntsSimulator.zip
is it possible to add two types of ants with different behavior and start positions for a simulation like this?
very cool, i probably spent 2-3 hours just playing with this
Okay
is it possible to make a version of this which isn't purely fullscreen?
@@tsm688 possible
It's amazing how cool complex behavior can emerge out of very simple rules.
@MorTobXD Is the course on chaos theory?
@MorTobXD Well that's a shame, it sounded inteesting.
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.
Just what I was thinking.
Rule: Sebastian Lague puts out a video
Result: RUclips gets flooded with copies
jk jk
And its very interesting to see that they keep their rules in mind.
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.
Agree
RUclips needs more commentors like you. Agreed 👽
Whend looking at this video of this beautifull ants simulation this remember me dendrits in bio neural networks, fungus filament or blob system ...
Yeah what he said
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
Where we dropping arthropods
Or the Option to RAID/eat rival Spawn points
couple billion spawns and you have a human brain made of ants (cant be looking like neurons only to me)
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
Absolutely genius ending lol. Homemade video editing :D
I liked how at 1:30 the whole path swings back and forwards like a tentacle sucking up food
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.
Or brain cells
@@zarro110 I don't know if you know but, there is literally an algorithm called ant colony optimization.
This is awesome
Now imagine this but a 1 hour long version
I like that theres all sorts of ways this stuff can be extended. Maybe evolve colonies whose coefficients and stuff are defined by genes
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.
Background music be like: *Yeah, this is an Avengers level threat*
No, these are the antvengers!
No
@@rxkshan Yes
@@mr.norris3840 no
@@rxkshan Yes
We need this as a wallpaper, would love to have it on my wallpaper engine library
That ending when the ants ate the "thanks for watching" was so satisfying lol
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
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
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
Random food spawns! And random obstructions falling into place.
@@tabularasa0606 And hunger for the small creatures. If it goes full, they die.
@@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
-How do you spend your free time?
-I watch ants walk
this makes me wonder how ants actually find their way back to the nest… really cool work, great job!
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?
how to make it ????
I really hope you've seen sebastian lague's most recent video
There is nothing so satisfying like watching ants, or anything that simulates ants..
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.
I’m way to high for this
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
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?
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?
Why don't you make a CrashHandler? It keeps crashing ;(
Just started watching you, but this is great content :)
Awesome work! :))
Now simulate flying ants
This makes me really want a factorio like game but with ants
I perceive the ants as humans exploring the conundrums of our universe 😍
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.
Man, i love your videos!
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
Now try using compute shaders and use millions of ants.
Digger ants would be an interesting mechanic.
how do I move ant spawn? also, you can't place ants
What does it mean for something to be food most fundamentally?
Who drew the mind flayer better?
1. Will (from Stranger Things)
2. Pezzza
I would love to see this a wallpaper engine background
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...
could you theoretically use these ants to solve a maze?
4:25 it's like one of those lightning ball things!
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?
This, after they find food they should turn 180+- a degree and follow their home path home.
How can i do this i only know some c++ 😅
This science is so rad
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
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.
I'm curious, what are the differences, how do they behave differently in nature?
Would be really cool to see if they’d find the optimal route in a maze.
That's the next video :)
Can you upload a simulation without the dots that lead home and food?
i like how the paths optimize into kinda streight lines
What you know about me?
Your C++ code is so good that i am still seeing ants on my screen even 10 minutes after watching the video
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.
when u cant draw nerves:
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.
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!
I felt like Paul Rudd with the avengers music playing.
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.
Good job mr rooster
This should have so many more views. Amazing work
I see one ant that doesn't give a single fuck about pheromones. It just walks a straight line between food and home
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.
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.
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
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?
There's a psychic ant that goes directly between the hill and the food. Is that ant 0 issues?
Yes it was a initialization problem that has been fixed
I noticed that single ant too. Happy to see I'm not the only one. ^^
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).
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)
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
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.
alpha poge
that's just like how neuron connections are made by body except in 3D instead of 2D
this reminds me of quantum computer error correction and optimization systems
I'd be so curious to see how this aligns with desire paths at universities or racing lines in F1
How many blocks are used as inputs for the ant's pathfinding?
can u please show the basic requirments to create these types of simulations?
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.
Could there be a "danger hormone" where the ants would avoid? Then u could put some spiders or black holes or whtvr
Now what about predation and obstacles, and optimizing routes around danger?
optimal paths end up following nature like paths i.e. Leaf vein patterns, retinal images etc.
You are now following: Rants Simulation, underneath the video.
Pog
This really show how ants are extremely intelligent as a collective. They are the definition of "2 heads is better than 1".
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
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
the way they form neural looking shapes makes me wonder if a similar method could be used for neural nets.
Why does one ant make B-line straight to the goal and back on loop, and ignoring all pathing? 2nd sim.
Guy: erases rock
The ants: but the how who did how rock get is small?
Looks organic 👍👍👍
Really curious what might happen with two or more large food sources.
Each ant has a freedom coefficient and this one’s set to AMERICA 🇺🇸
be interesting to compare simulation to the real behavior of ants.
I wonder if the simulation that looks like a plasma ball is actually a model for the currents in a plasma ball.
man could you not make an exe or an installer or something for people to play with????
Old ants should eventually die and new ones be born to cut down on the hundreds of lost ants
Okay but why does the paths remind me of the images of neurons that they showed in bio class at school
I love insects and when I was a kid I used to watch ants all the time. Thanks for the great video.
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?
maybe it'll help, but I think Ants release a pheromone or something when they're aware that there's no more to gather.
From a distance and sped up this reminds me of how electricity flows path of least resistance
What happens when you don't show the trails, only the ants, their home, the walls and the food?