   More flocking AI!
  Well, there was that other post about herd/flocking AI, and I had this one, and yeah... irrelevant.Anyways, I just had some ideas to bounce off you guys about this preditor/prey program I'm thinking about getting serious about.  This is largely a theory forum anyway, as is the field :)So, in this program, there are two types of creatures, a preditor, along the lines of a wolf, and prey, like a deer or something.  I'm trying to think of a way to do the AI in an "individualistic" fashion, so that rather than having a big overarching AI doing the moves, each creature decides where to move on its own.  I was thinking that each preditor and prey creature would have its own speed, providing for the whole "going after the weak" aspect.  For the preditors, they would simply close on the nearest prey creature to them.  This would eventually wind up being the slowest prey in the herd.  For the prey, I think that they would end up prioritizing these things in an individual fashion:a) Moving closer to the other prey, for protection and distraction, as the preditors might go for a different animal than them, if you catch my drift.b) Avoiding the preditors, even at the cost of breaking away from the groupI think this might end up providing fairly good-looking herd movement.  Also, it could be kind of a simplistic genetic algorithm.Let me know what you think, especially if you can think of more variables that might affect either the preditor's or the prey's actions.  Thanks.   
  hey, i just read your post, to make things interesting i would add a random placement of food as well for the prey.  if thy do not get food they die, meaning not necessarilly the fastest would survive. you could allocate the food in different patterns to make things more complicated, depending upon how movement is generated, and if movement can be altered based on past generations   ;  So maybe the prey will move to the food if the preditors aren't attacking at the moment, and that is where they replentish their energy?  I would think that they wouldn't want to eat on the run.  I was thinking more of a straight up flocking simulation, rather than a life situation.  But your idea is interesting, and I might include it.  Thanks!   ;  Back in Uni I developed a simulation of machine learning in a predator prey situation. The prey in the sim was dumb... it just moved in straight lines and bounced off the walls of the environment. The predator, however, started with no knowledge of how to capture the prey and had to learn which actions to take in any given scenario. It received reward for sequences of actions that resulted in it eating the prey. Now, this isn't exactly what you're looking for, however, I did find that the predator was very successful in learning to catch the prey when it simply tried to minimise the distance to the prey and the angle between their headings. Since the predator can usually use a burst of speed that exceeds the prey (most natural predators are like this... typically slower moving (because larger) but more powerful (=faster over short distances)) then this strategy works really well.So, for your purposes, you could encode your predators with a really simple strategy.(1) If they don't have a target, move to the area of highest prey density.(2) Select a target that has a heading close to that of the predators (so they predator doesn't have to spend a lot of energy slowing down, turning and accelerating again).(3) Minimise the distance to the target and the angle between the heading of the target and the predator.(4) When within a pre-defined distance (which might depend on speed), execute a 'pounce' to bring the prey down.(5) Enjoy the meal! ;)As for your prey, the preys best defences are:(1) Being part of the crowd (decrease the probability of being targetted).(2) Fleeing at oblique angles to the predators heading.(3) Insert random, high angle turns into the path(4) Preference heading for cover rather than open areasAll of this should give you an interesting predator prey simulation. However, you should also realise that there are only 3 basic limiting states (critical points) of any predator prey dynamical system:(1) Prey are 'over-farmed' and die out. Predators starve and die out too.(2) Predators cannot find enough prey and die out. Prey number grow to a limit defined by their resources.(3) Number of predator and prey oscillate around a stable equilibrium point.If you were to introduce other factors that dampen or amplify the birth-death rates of each population, then you can achieve far more interesting dynamical responses of the system.Good luck and have fun!Timkin   ;  In my game (Tank-Wars) you can see "Fleaing of the Waek" and "Flocking of Teamates" as you want to make it in your "Predator/Prey"-Game.But in Tank-Wars you have TWO STRONG groups, in yours ONE weak and ONE strong. But this could be managed easily. The only things that would have to be changed are :- Make 1 Team Weak (No shooting, just flocking and fleaing- The Fire-Range SMAAAAALER (= Eat the Weak)TANK-WARS-Info + etc !;  You could make a fun game of this for testing it out. Have one or more players control the predator (a dog) and try and herd the prey (sheep) into a pen or something.   