You can make ants more realistic. They should go back home and stay there some time when they have low energy. Also add more types of pheromones, enemies or fights with other colonies.
regarding realism, I can say that in many similar implementations, ants do not know the way to the anthill, just as they do not know the way to food and remember it through pheromones, this allows ants to move not quite in a straight line to the anthill, but also to avoid potential obstacles
I love your way of presenting, and also that you show not just the success, but also the strugle you had with all the different problems and steps! Thats what programming is mostly about. Also very clean code, readable, necessities documented and well organized. Good work! Like every feedback, there is a "but"... The computation time and the fps... I'd highly recommend, especially when it comes down to visualising, using different python libraries which are already solving for that, such as numba, taichi, etc... There are a lot of different libraries out there optimized for not just matrix, but also tensor optimizations. If you wanna know more, I once made a good "speedcomparison" of all libraries and different implementations, demonstrated on the mandelbrot set (not released yet). Let me know, and I will share the sourcecode with you. Long story short: Keep up the good work :) mandelbrot demo: ua-cam.com/video/XV2CVJAfVJk/v-deo.html
There's another fairly easy metric to implement. That's food levels in the any nest - ant pheromones change from building to scavenging when the food gets low. Also builders could allow more ants to live in the colony. Hope you open source this, I'd love to have a play, I love ants, they're truly fascinating.
I love the project. It is very fundamental intelligence research / engagement with its concepts. The only nitpick I have with the video was the jump in volumes. Your voice was very quiet and then the bass hit :D But anyway, keep up the good work!
that was a great video, ants are great, and so is coding i'm currently learning python actually, and i already know a bit, so i'll look into this to learn more about how to make great things like it
Neat. I never gave it much thought before, but can Python do a multiway tree? If so, I'd add a time component and sort by that along one tree. Add the lifespan to the starting timestamp to get the ending timestamp and sort by that, removing from both trees at the end of a particle's lifespan.
Thanks for your feedback! There are implementations of multiway trees in python libraries, somebody has even suggested trying it out instead of the grid. I'll look into that!
Already spent hours providing enough food to the ants using my mouse-buttons and mouse-wheels, a pleassure to watch ;-) Interesting that in your first iterations the ants seem to leave a (blue) trail, appearing as lines - where in the later iterations (and when using your code on Guthub) they leave blue dots, have you noticed it as well?
That's because in the first version ants leave pheromones every single frame, so they appear as a blue line because they blend together. Later I reduced it to every 7 (I believe) steps.
You can rewrite ant logic to compute shader, which can potentially increase the performance to handle millions of them, also, i don't know whether kd tree or octtree can increase performance in comparison to grid, but it worth trying. In regard to ant simulation, maybe adding rival ants or other creatures can create interesting patterns.
The things that I tried are mentioned in the video, I haven't done anything else yet. Rendering certainly slows the simulation down, it should be done on a separate thread
@@CodeCr4fter Yes, like you, I had optimization problems related to the number of pheromones being tested.I've been experimenting with this for a long time, but I can say that dividing space is really a great idea that I saw when I was working on another project.Dividing space into equal parts is a good idea when the objects being checked are the same size, but within the same project I ran into the problem that some objects were larger than others, so much so that if you leave the space as finely divided, then collisions with the object could not be properly processed, and if you increase the area of the cells, it turned out that the optimization suffered much worse
Thank you so much for a well made and thought provoking video. I've mostly been thinking about the fewest numbers of phermones and fewest number of "rules" over the ants' behavior. One question, how do ants know where the nest is? I'm not sure they have individual awareness, other than "that direction smells like exploration, that direction smells like food, that direction smells like combat". Just food for thought. Again, thanks.
Thanks for the comment! I've read they actually do have spatial awareness and can use landmarks for navigation, some even build them (some desert species). They also use a thing called 'path integration' which basically means that they remember turns and count steps to get back to the anthill.
Hi! Best advice I can give you is don't stop creating. Create and design things you're interested in and solve problems one by one looking for solutions online. Now that we have LLMs it's easier than ever, but if you're using them avoid mindlessly copying code and try to understand why it works. Don't hesitate to ask for clarifications if you're not sure. Good luck!
Nice project! If you want any kind of feedback (or constructive criticism) on the video itself I think you should try to modulate your narrating a bit more. As in put some emphasis on some words here and there instead of just sounding so flat. I expect you're reading from a script, and that's the reason your voice never changes much.
@@CodeCr4fter It's just one of those things that could potentially make the videos more appealling to people in general. It's one of those things that gets mentioned alot for public speaking. If your voice sounds the same all the time people tend to have difficulties keeping engaged. I don't think it's that much of a problem for an audience that is already very interested in the subject though.
Biggest issue I see with this is not using numpy operations for arrays. Your code is full of for loops that are 100s or 1000s of times slower than vectorized code. I know using classes and objects looks cool but it hurts performance by a lot.
Choosing the right algorithms and optimizations is always important but I wouldnt use python. If you want to go for speed and in this case simulating hundreds or thousand of ants you probably should go with zig. The only way python could be remotely close is by using numpy I think it was which uses C code behind making it fast. Using zig with sfml for rendering would be a good way and probably a huge improvement, could be also interesting of comparing the speed to python but watch out for the rendering since that can make a difference aswell. I would write the logic code separate from the rendering code so running the simulation without any rendering can be a good way of measuring the performance. Alternatively using c++ will give you similar performance but in my opinion it's easier than zig but memory safety is not enforced 👉👈
Thank you for the feedback! You're absolutely right, python is not made for this kind of task. Separating rendering from logic is a very good idea as well, I'll try to implement that. I've never heard of zig but I'll look into that. Thanks again!
@CodeCr4fter yeah no problem, zig is a relatively new language that "replaces" the c language, which is does pretty good and gains a lot of popularity. It implements safety features like rust and decent memory safety (no garbage collector). Its already a usable language which basically has all features implemented that are needed (v 0.13.0), it's usage is not that complicated but the hard part is that the documentation is weak and very not beginner friendly. Features that are awesome is you can use any c library in zig, c++ as well I heard? But I didn't test that yet, you can cross compile easily to a different system / architecture arm, x32, even compile to webassembly if you like, has testing support directly built into it which I never heard of in any other language.
My intuition tells me that your method of optimization isn’t ideal. Optimizing slow code is a bandaid. Switching to a method that isn’t slow, and optimizing that, is a superior path to performance. The code that was partitioned is still slow code.
You can make ants more realistic. They should go back home and stay there some time when they have low energy. Also add more types of pheromones, enemies or fights with other colonies.
Thank you for your feedback! I'm actually planning on developing it further and try to use AI
regarding realism, I can say that in many similar implementations, ants do not know the way to the anthill, just as they do not know the way to food and remember it through pheromones, this allows ants to move not quite in a straight line to the anthill, but also to avoid potential obstacles
I'm gonna try to do that in the next video, implement more types of pheromones and add obstacles on the plane.
Warfare is the primary mechanism for ant population control. Add warfare.
I love your way of presenting, and also that you show not just the success, but also the strugle you had with all the different problems and steps! Thats what programming is mostly about. Also very clean code, readable, necessities documented and well organized. Good work! Like every feedback, there is a "but"... The computation time and the fps... I'd highly recommend, especially when it comes down to visualising, using different python libraries which are already solving for that, such as numba, taichi, etc... There are a lot of different libraries out there optimized for not just matrix, but also tensor optimizations. If you wanna know more, I once made a good "speedcomparison" of all libraries and different implementations, demonstrated on the mandelbrot set (not released yet). Let me know, and I will share the sourcecode with you. Long story short: Keep up the good work :)
mandelbrot demo: ua-cam.com/video/XV2CVJAfVJk/v-deo.html
Thank you for the tips! Your visualization looks amazing, I'll make sure to try out the libraries you mentioned!
I like how the first bug you met was a pheromone loop of death. It's kinda realistic.
There's another fairly easy metric to implement. That's food levels in the any nest - ant pheromones change from building to scavenging when the food gets low. Also builders could allow more ants to live in the colony.
Hope you open source this, I'd love to have a play, I love ants, they're truly fascinating.
Thanks for the idea!
I created a repository if you'd still like to play with it :) Link is in the description.
@@CodeCr4fter Thanks!! Stared and forked :)
ants truly are fascinating indeed
@@CodeCr4fterthanks a lot, i'll be sure to check this out later when i have time, this was awesome!
I love the project. It is very fundamental intelligence research / engagement with its concepts.
The only nitpick I have with the video was the jump in volumes. Your voice was very quiet and then the bass hit :D
But anyway, keep up the good work!
Thanks! Sorry about the bass
0:02 ant colonies when humans aren't looking:
This is cool man. Keep it up, I enjoyed the video. Honestly shocked you aren't a bigger channel.
I'm glad you liked it!
how does such quality content has only 172 subscribers?
let me fix that, i'll bring in both of my alts
Thank you so much bro!
Nice work bro!
Thanks a lot!
Nice work and editing !
Thanks a lot!
Amazing work!
I'm glad you liked it ❤️
I enjoyed this! Keep it up!
Thank you!
that was a great video, ants are great, and so is coding
i'm currently learning python actually, and i already know a bit, so i'll look into this to learn more about how to make great things like it
I'm glad you liked it!
Neat. I never gave it much thought before, but can Python do a multiway tree? If so, I'd add a time component and sort by that along one tree. Add the lifespan to the starting timestamp to get the ending timestamp and sort by that, removing from both trees at the end of a particle's lifespan.
Thanks for your feedback! There are implementations of multiway trees in python libraries, somebody has even suggested trying it out instead of the grid. I'll look into that!
Fascinating but I think you had an ant colony living in your microphone...
Sorry about that, the sound quality will be better in the next video
Recommend making the cells larger relative to the ant detection radius. Say 9 squares covering the circle
Already spent hours providing enough food to the ants using my mouse-buttons and mouse-wheels, a pleassure to watch ;-)
Interesting that in your first iterations the ants seem to leave a (blue) trail, appearing as lines - where in the later iterations (and when using your code on Guthub) they leave blue dots, have you noticed it as well?
That's because in the first version ants leave pheromones every single frame, so they appear as a blue line because they blend together. Later I reduced it to every 7 (I believe) steps.
I hate it when my ant simulation is full of bugs.
You can rewrite ant logic to compute shader, which can potentially increase the performance to handle millions of them, also, i don't know whether kd tree or octtree can increase performance in comparison to grid, but it worth trying. In regard to ant simulation, maybe adding rival ants or other creatures can create interesting patterns.
Thanks for the feedback! I'll make sure to look into the things you mentioned
very nice, maybe try multiple types of pheromones? i dunno you did something pretty cool
Thanks for the idea! I'll see what i can do
I've done similar experiments, and I've also tried to do it in python.tell me, have you done any optimizations, or is it just a fairly long rendering?
The things that I tried are mentioned in the video, I haven't done anything else yet. Rendering certainly slows the simulation down, it should be done on a separate thread
@@CodeCr4fter Yes, like you, I had optimization problems related to the number of pheromones being tested.I've been experimenting with this for a long time, but I can say that dividing space is really a great idea that I saw when I was working on another project.Dividing space into equal parts is a good idea when the objects being checked are the same size, but within the same project I ran into the problem that some objects were larger than others, so much so that if you leave the space as finely divided, then collisions with the object could not be properly processed, and if you increase the area of the cells, it turned out that the optimization suffered much worse
Good work!
Thank you, I appreciate it!
Thank you so much for a well made and thought provoking video. I've mostly been thinking about the fewest numbers of phermones and fewest number of "rules" over the ants' behavior. One question, how do ants know where the nest is? I'm not sure they have individual awareness, other than "that direction smells like exploration, that direction smells like food, that direction smells like combat".
Just food for thought. Again, thanks.
Thanks for the comment! I've read they actually do have spatial awareness and can use landmarks for navigation, some even build them (some desert species). They also use a thing called 'path integration' which basically means that they remember turns and count steps to get back to the anthill.
heyy, i am student and stuck on basic can you help how do i improve
Hi! Best advice I can give you is don't stop creating. Create and design things you're interested in and solve problems one by one looking for solutions online. Now that we have LLMs it's easier than ever, but if you're using them avoid mindlessly copying code and try to understand why it works. Don't hesitate to ask for clarifications if you're not sure. Good luck!
Nice project!
If you want any kind of feedback (or constructive criticism) on the video itself I think you should try to modulate your narrating a bit more. As in put some emphasis on some words here and there instead of just sounding so flat. I expect you're reading from a script, and that's the reason your voice never changes much.
Thank you! I will make sure to pay attention to modulation next time.
@@CodeCr4fter It's just one of those things that could potentially make the videos more appealling to people in general. It's one of those things that gets mentioned alot for public speaking. If your voice sounds the same all the time people tend to have difficulties keeping engaged. I don't think it's that much of a problem for an audience that is already very interested in the subject though.
@@cybermanne You're absolutely right. Even if the audience is engaged on its own, improving my speaking skills certainly won't hurt.
underrated chanel
Thank you!
it needs terrain and obstacles!
ants could also drop food
and of course there will need to be epic battles against other colonies ;)
Thanks for the feedback!
7:40 i can bro
I can and i do
Its like a ton is lifted off your forehead and chest and you can breathe normally and your brain chills out
open source? seems fun to play with
I created a repository if you'd still like to play with it :) Link is in the description.
Biggest issue I see with this is not using numpy operations for arrays. Your code is full of for loops that are 100s or 1000s of times slower than vectorized code. I know using classes and objects looks cool but it hurts performance by a lot.
Thanks for the feedback! I'll try to improve next time
Choosing the right algorithms and optimizations is always important but I wouldnt use python. If you want to go for speed and in this case simulating hundreds or thousand of ants you probably should go with zig. The only way python could be remotely close is by using numpy I think it was which uses C code behind making it fast.
Using zig with sfml for rendering would be a good way and probably a huge improvement, could be also interesting of comparing the speed to python but watch out for the rendering since that can make a difference aswell. I would write the logic code separate from the rendering code so running the simulation without any rendering can be a good way of measuring the performance.
Alternatively using c++ will give you similar performance but in my opinion it's easier than zig but memory safety is not enforced 👉👈
Thank you for the feedback! You're absolutely right, python is not made for this kind of task. Separating rendering from logic is a very good idea as well, I'll try to implement that. I've never heard of zig but I'll look into that. Thanks again!
@CodeCr4fter yeah no problem, zig is a relatively new language that "replaces" the c language, which is does pretty good and gains a lot of popularity. It implements safety features like rust and decent memory safety (no garbage collector).
Its already a usable language which basically has all features implemented that are needed (v 0.13.0), it's usage is not that complicated but the hard part is that the documentation is weak and very not beginner friendly.
Features that are awesome is you can use any c library in zig, c++ as well I heard? But I didn't test that yet, you can cross compile easily to a different system / architecture arm, x32, even compile to webassembly if you like, has testing support directly built into it which I never heard of in any other language.
I literally thought i was watching some successful channel
For 10 minutes
Then i saw the view count and then the sub count and i was blown away
Thanks bro, it means a lot!
good vid
Thank you!
u already know that u gotta throw some ai magic into that, u better
I'll try to do that in the next video for sure!
You wrote it in Turtle. 😂
That's a good one 😂
great video but please focus on the code part more
I'm glad you liked it! Do you mean that I should explain the code in more detail?
@@CodeCr4fter yes, this video was a lot better than other videos on your channel,create something new and tell us how you did it step by step, tanks
I'm happy to hear that because it took quite some time to create it :) Thank you for your feedback!
@@CodeCr4fter you could try to apply them to 2d or even 3d characters
Can you make a tutorial
Hi! Maybe someday, but probably not in the near future. If you need the code, link to my github repository is in the description :)
Believed everything
My intuition tells me that your method of optimization isn’t ideal. Optimizing slow code is a bandaid. Switching to a method that isn’t slow, and optimizing that, is a superior path to performance. The code that was partitioned is still slow code.
Thanks for the feedback! You're right, I'll try to fix that in the next video
Wtf is going on with the speech audio.
can we get the code great work btw
Thank you! I'll consider creating a repository
I created a repository if you'd still like to play with it :) Link is in the description.
thanks world needs more like you
You need a better mic. It's the only bad thing in the video.
eh, it's fine
Thanks! I know, I was trying to improve it during editing but I could only do so much
Cool stuff, great story, but cheap MIDI music really hurts sometimes.
Thank you! I didn't really spend a long time picking music but if it's that bad I'll definitely try to put more effort into that in the next video
@@CodeCr4fterI don't think its bad at all
It's just extremely loud compared to your narration
@@sirynka You mean the parts when I'm not talking right?
@@CodeCr4fter yeah