#### Archived

This topic is now archived and is closed to further replies.

# model of a burden to carry

This topic is 5653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hello, I would like to create an ant simulation. More pecisely, I would like to simulate how the ants are able cooperate together to carry a prey. In the reality, the ants modifies their behaviour according to how is the resistance of the prey. If one ant cannot move a prey it will recruit nestmates. I plan to associate a vector to the prey. Then when an ant applies a force to the prey it modifies the prey vector. If several ants applies a force to the prey then the prey vector resulting will be the sum of each applied force. Could it be possible to have your mind on it? May be there is a better way to do that. Just feel free your idea. This is the beginning of a project and I wouldn''t like to go to the wrong way. Thank you!!!!!!

#### Share this post

##### Share on other sites
That would definitely make the prey move. However if you want a coordinated effort you will need some extra code.

#### Share this post

##### Share on other sites
Actually, you should be able to create some nice emergent behaviour by considering ants individually.

For each ant   Grab hold of the prey at random location   do loop      Start moving in the desired direction      If prey is not moving in desired direction         call another ant

Cheers,

Timkin

#### Share this post

##### Share on other sites
Also you might want something that has only the first ant recruiting, else you will end up with more ants than you need...
IE
First ant grabs sandwich piece, cant move.
Gets Ant 2.
Both cant move, both get ants 3 and 4.
So it will be a quadratic function if you dont have the rule of only one ant recruiting.
If I am not mistaken.

The actual physics sound about right...

just loop through the numebr of ants and add their force vectors together.
Then calculate that against the object resistance.

#### Share this post

##### Share on other sites
you could have a linked list of ants working on a single thing.

if the ant cant move something it would check the pointer to a helper ant. If its null it would call for a helper ant. then if that ant cant do it the second ant would fill its empty "NextHelperAnt" pointer and so on... then u can easily loop though all the ants and get the total force with a simple linked list iteration.

-SniperBoB-

#### Share this post

##### Share on other sites
hi,

thank you for your answer. A good point is that I have to stop the recruitment when it is not needed. I didn''t understand the way to do it with linked list.

I have another question : Is someone could give me a relation between a force and a weight(with unit please).

thank you!!!!

#### Share this post

##### Share on other sites
quote:
Original post by zip7000
thank you for your answer. A good point is that I have to stop the recruitment when it is not needed. I didn''t understand the way to do it with linked list.

Actually, you don''t need to stop recruitment at all. For every ant, just add a test as to whether the force they need to exert is less than some tolerance... If it is... they leave... if you cycle through all of your ants, then ants will leave one by one until ust the right amount of ants are carrying the object.

quote:
Original post by zip7000
I have another question : Is someone could give me a relation between a force and a weight(with unit please).

Force = mass* acceleration
Force = weight

so

weight = mass * acceleration due to gravity

Units: Newtons (N) = Kg m / s2

Cheers,

Timkin