# Swarm Intelligence- Replicating Ant behaviour

Hi I am looking for studying and replicating ant behaviour. I came across several plugins like culebra, cocoon which are giving me results to certain level.

What I wish to do is take soil from one part and move it to another place. repeatedly . So that the soil at point A is excavated to form cavity and Point B forms a structure.

Check out the video in the link. Any suggestions how to do it?

Idea: Maybe voxelization of soil is first step. But how tdo you move voxels from A to B?

1 Like

Interesting!
But also a difficult challenge.

Voxelizing is a nice idea, and maybe also the only feasible one.
You probably want to build a simpler solution first, in 2Dâ€¦ maybe.

Youâ€™ll need to mark some point/sphere underground as target for ants to dig, an area where to workâ€¦ and a dome shape to â€śfillâ€ť above the groundâ€¦ raw ideaâ€¦

The soil/dirt is 4in1:

• obstacle
• walk-able path (ants dont fly)
• an object to transfer
• structure (you canâ€™t leave floating soil, we are not in minecraft)

We can have a bool, true/false = soil/air.
You can also consider to have each soil pixel pre-calculating at each iteration if he is exposed to air or not, and what is the distance to the nearest air pixel. And even how much is exposed to air.
A soil block exposed to 2 air blocks (or 4 in 3D) should not be removed (actually it is more complex than this, but this is the concept), or the structure would fall!
Instead, a soil block with just 1 side exposed to air can be removed without worries.

On the opposite rule, an air block cant be filled if it would close a passage!

Then the ant.
Probably having more ants at the same time is troublesome, might want to start with a single lone ant.
No â€śswarmâ€ť thenâ€¦ iâ€™m thinking more of the anthill now .
The ant, which can travel only in air, will have a bool â€ścarrying_soilâ€ť, making it wanting to go near the underground sphere if false, or towards the dome if true.

Determining the likeliness of blocks to be digged or filled can be done with a sort of diffuse reaction / game of life combo of rules.

http://aanthill.free.fr/noframe/en/simulation_en.html

Keep this updated, post here if you find something else related on the web.

Seems like a big project.

Edit:
Another way , with no voxel/pixel, could be to treat soil as particles (spheres) that have a sort of micro-gravity or capillar force or â€śglueâ€ť â€¦ and ants move and drop themâ€¦

3 Likes

Apart from @maje90â€™s great suggestions, Iâ€™d recommend to take a look at Sebastian Lagueâ€™s tutorial series on procedural cave generation. He mostly works in the Unity game engine, but the concepts are valid along the board!

Another thing to look for is the term stigmergy. It basically describes the coordination system of ants.

And there is a great book called â€śTurtles, Termites and Traffic Jamsâ€ť by Mitchel Resnick about these kinds of systems and ways to simulate some of their aspects. It appeared 1994 in MIT Press!

This is an ambitious, but really interesting project to tackle! I hope youâ€™ll keep updating this post with your progress. Would be quite interesting to see.

5 Likes