[HN Gopher] Show HN: Ants Sandbox - an ants simulator
       ___________________________________________________________________
        
       Show HN: Ants Sandbox - an ants simulator
        
       I was inspired to make a web based ants simulator after watching
       this video https://www.youtube.com/watch?v=81GQNPJip2Y  Any
       feedback appreciated.  Best viewed on Chromium based browsers.
       Firefox is slow for some reason and Safari is not tested as I don't
       have a Mac.
        
       Author : tulustul
       Score  : 282 points
       Date   : 2022-07-10 09:48 UTC (13 hours ago)
        
 (HTM) web link (www.ants-sandbox.io)
 (TXT) w3m dump (www.ants-sandbox.io)
        
       | sa1 wrote:
       | Individual ants might be smarter than you give them credit for:
       | they've been known to pass the mirror test.
       | 
       | https://www.scinapse.io/papers/2180773430
        
       | fho wrote:
       | One thing that is missing from this simulation is that (at least
       | some) ant species walk straight back to their nest once they
       | found some food. They do this (as far as we know) by accumulating
       | each step they take into what is called the "home vector",
       | effectively integrating the whole path they took. That way they
       | always know which way is "back to the nest". There is a vast
       | amount of papers on the topic. Some (personal) highlights:
       | 
       | If you put the ants on stilts they will follow the same home
       | vector, but because each step on stilts is effectively longer
       | they will overshoot the target:
       | https://www.researchgate.net/figure/Fig4-Odometry-by-stride-...
       | 
       | If the ant is placed close to the nest after gathering food, it
       | will still follow its home vector ... away from the nest:
       | https://royalsocietypublishing.org/doi/abs/10.1098/rspb.2004...
       | 
       | Crazy little buggers these ants.
        
         | Retr0id wrote:
         | Hah, that reminds me of a robotics competition I took part in
         | at school.
         | 
         | Robots were placed in an arena, and the objective was to gather
         | QR-marked boxes, and bring them back "home".
         | 
         | There were also QR codes placed at known locations around the
         | arena, and the intention was that you could use them for
         | navigation. However, the camera systems were pretty flakey
         | (especially under unpredictable lighting conditions), so we
         | wanted to avoid using them as much as possible. So, we put
         | rotary encoders on our wheels, and integrated the readings to
         | calculate a "home vector" for the return journey, just like you
         | described.
         | 
         | At the time, I wasn't aware that this was an ant-inspired
         | technique - but it was very effective, and we won the
         | competition. Thanks, ants!
        
           | x0hm wrote:
           | thants
        
             | eclipticplane wrote:
             | Bless you ants.
             | 
             | Blants. [0]
             | 
             | [0] https://www.youtube.com/watch?v=gaI6kBVyu00 - Look
             | Around You
        
           | fho wrote:
           | The crazy thing is how good the ants are at this. Especially
           | considering their brain size.
           | 
           | With robots it works ok, but over time small errors
           | accumulate. After travelling for a while the home error will
           | be off.
           | 
           | In contrast desert ants are able to do this trick after
           | travelling for hundreds of meters.
        
       | EamonnMR wrote:
       | My only feedback is that this is amazing. I would gladly pay for
       | a fleshed out version of this. SimAnt was an old favorite of
       | mine.
        
       | mywacaday wrote:
       | I think it crashed my phone, froze between tutorial steps and
       | when I looked back my phone, a galaxy note 10+ had restarted.
        
       | x86x87 wrote:
        
       | smcleod wrote:
       | Gives me nostalgia for playing Sim Ant when I was young.
       | 
       | https://en.wikipedia.org/wiki/SimAnt
        
         | wintermutestwin wrote:
         | Sim Ant and Sim Earth are both begging for remakes!
        
           | noduerme wrote:
           | Yup, I loved both those games. SimEarth in particular would
           | be fantastic for a remake... lots of stuff you can learn
           | about climate change from that game. Maxis did such excellent
           | work building the systems that you could probably work from
           | the original sim logic and build something massive in Unity
           | mostly focusing on the graphics.
        
           | folli wrote:
           | I don't understand why there's no true SimCity remake (not
           | this Mobile game crap). It's a surefire commercial success.
        
             | dawnerd wrote:
             | Even the spiritual successor Cities Skylines is getting old
             | at this point. There's a few other city-building games that
             | almost nail it but the devs always add in something that
             | makes it too micro-managey like production chains.
        
               | eproxus wrote:
               | Personally I like the production chains in Cities
               | Skylines. I feel they add purpose to the design of the
               | road network and handling of traffic problems. I just
               | wish the AI was a ton better (there are a few mods that
               | help though).
        
       | throwaway413 wrote:
       | My dog is currently running a similar study from the balcony to
       | her dog food bowl.
       | 
       | Every day I move the bowl, every night they find it, and every
       | morning I spend battling soldier ants.
       | 
       | The tour was really enjoyable to watch through, thanks for
       | sharing this!
        
         | mthoms wrote:
         | Have a little fun with it. Chalk can disrupt the ant's route
         | finding. At least for a little while.
         | 
         | https://homeguides.sfgate.com/kind-chalk-used-keep-ants-away...
        
       | NelsonMinar wrote:
       | Very nice! There's a long history of this kind of simulation,
       | going back to Alan Turing (or before). I used to work doing this
       | kind of thing in the 90s, as part of the Artificial Life
       | community. There's a lot of papers from back then if you're
       | looking for other ideas for agent based simulations or complex
       | systems. For that matter the ALife community itself still exists.
        
         | JKCalhoun wrote:
         | I remember A. K. Dewdney introducing "Wa-Tor" in Scientific
         | American in the 80's. I was fascinated by those explorations.
         | 
         | (And SimAnt is of course the more obvious parallel to this
         | particular simulation.)
         | 
         | https://en.wikipedia.org/wiki/Wa-Tor
         | 
         | https://en.wikipedia.org/wiki/SimAnt
        
         | louky wrote:
         | Yeah, there was a discussion of emergence in _Godel, Escher,
         | Bach_ [0] published 1979.
         | 
         | "Aunt Hillary" was the super-organism created from the actions
         | of the indivdual ants, IIRC.
         | 
         | [0] https://en.wikipedia.org/wiki/G%C3%B6del%2C_Escher%2C_Bach
        
       | adnanc wrote:
       | Brings back memories of my final year dissertation at University
       | nearly 20 years ago, "An emergent model of an Ant colony" (in
       | VRML and Javascript).
       | 
       | Incredibly fascinating and great to see this.
        
       | hughrlomas wrote:
       | This is great to see. Years ago I created a basic simulation
       | using the same principles of pheromone gradients, one for the
       | nest and one for food. https://youtu.be/VsHc91IhzdI
       | 
       | It a fascinating example of emergent behavior from simple rules.
       | 
       | I've been wanting to find time to revisit the concept and produce
       | an updated version, your simulation seems to include everything I
       | wanted to do and more.
        
       | testmasterflex wrote:
       | Super cool!
        
       | TruthWillHurt wrote:
       | cool, but this needs WebGL or something as I'm getting 8 fps
        
       | drivers99 wrote:
       | When I touch the screen on iPad, everything goes black. Edit:
       | it's usable if I only use the gui element to zoom out one step
       | and don't scroll or zoom.
       | 
       | I was thinking: what if workers also fight? I think they
       | generally do in real life.
        
         | tulustul wrote:
         | Unfortunately, I don't posses any Apple device so I cannot fix
         | it.
         | 
         | You're right, workers do fight in the real life. It's one of
         | many simplifications in the simulation. Real world is much more
         | complex
        
           | noman-land wrote:
           | Looks like the same thing happens on an Android phone as
           | well.
        
           | MonsieurMoony wrote:
           | Just curious, can't device emulation on Chrome and other
           | browsers help reproduce the issue?
        
             | nullwarp wrote:
             | Negatory, there's literally no way other than owning an
             | apple device. I have a stack of bugs in a FLOSS app I can't
             | fix for safari because I don't have a mac anymore.
             | 
             | I guess I could try to boot a hackintosh but it's not worth
             | the effort to me.
        
       | detritus wrote:
       | May I ask - in the early stages, when a wandering ant encounters
       | its first food pheromone trail, is there a logic that dictates
       | which direction it chooses to then follow? It has two options -
       | towards the source of the food, or away from. The latter
       | resulting in a wasted journey home before a hoped-for bounce
       | back.
       | 
       | - ed - it seems to me that they always go towards the food, is
       | all.
       | 
       | - ed - ed : Great work, btw! SimAnt was a big favourite as a kid,
       | so this is right up my street! :)
        
         | garyfirestorm wrote:
         | What happens when there is a circular path. Do all ants follow
         | it until they die?
        
           | detritus wrote:
           | Yes. The system breaks down locally.
           | 
           | https://en.wikipedia.org/wiki/Ant_mill
           | 
           | - ed - d'oh, sorry - I have no idea how this works in the
           | simulation, but I guess This. :)
        
       | Cameri wrote:
       | Doesn't work well on Firefox Android. Zooming in causes the map
       | to fly away who knows where.
        
       | foobiekr wrote:
       | I was trying to create a circular mill with rock placement
       | without luck. https://www.youtube.com/watch?v=LEKwQxO4EZU
        
       | bcjordan wrote:
       | Really love this, it can create such amazing visuals (before the
       | ants erase them with the "no food left" signal!)
       | 
       | Fun to read through the TS/Vue/PixiJS source as well, thanks for
       | open sourcing it. Nicely built!
       | 
       | Could imagine this being a fun base upon which to build a game
       | like Liquid War https://www.gnu.org/software/liquidwar6/
        
       | adenozine wrote:
       | How does the draw function work? I can't seem to draw food or
       | rocks when I try. Latest MS Edge on Windows 10.
        
         | tulustul wrote:
         | You should be able to draw with right mouse button. Is this how
         | you try it? Does it work on other browsers?
        
           | seszett wrote:
           | I don't have a right mouse button. On OSX, I use ctrl+click
           | as an equivalent (normally) to the right mouse button.
           | 
           | But it might be because of my convoluted setup (using the
           | touchpad on Linux on a Macbook to control OSX on another Mac
           | using barrier) so I'm not sure if it's actually relevant,
           | don't sweat it.
        
             | dylan604 wrote:
             | Yeah, right-click drawing is not the most intuitive. I
             | found it purely by accident.
        
           | adenozine wrote:
           | Ah! In fact, it does. Thanks!
        
       | xixixao wrote:
       | The tours are awesome! The last one (with soldiers) stops working
       | after the first Next tap (iOS, Safari).
        
       | [deleted]
        
       | geuis wrote:
       | Sorry but this completely fails on iOS. Can't touch the controls,
       | zoom in or out, etc.
        
         | mthoms wrote:
         | Works for me.
        
       | wdfx wrote:
       | The simulation works fine on Firefox on Android. But touching the
       | map causes it to fly out of view and I can never get it back.
       | Might benefit from a Centre View button for navigation.
        
         | dddw wrote:
         | Can confirm
        
         | floodle wrote:
         | Also get this on Firefox on Android. Would love to restart the
         | step but it looks like you would have to cancel the whole tour
         | and start over.
         | 
         | Really enjoyed it though! Love the retro vibe.
        
       ___________________________________________________________________
       (page generated 2022-07-10 23:00 UTC)