model of a burden to carry

Started by
5 comments, last by zip7000 21 years, 10 months ago
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!!!!!!
Advertisement
That would definitely make the prey move. However if you want a coordinated effort you will need some extra code.
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
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.
~V'lionBugle4d
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-
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!!!!



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

This topic is closed to new replies.

Advertisement