playMaker

Author Topic: Herd behavior  (Read 1669 times)

Seraph2910

  • Playmaker Newbie
  • *
  • Posts: 1
Herd behavior
« on: July 07, 2013, 07:31:46 AM »
Hey everybody,

I'm creating a prototype for a game, and I'm trying to make a herd that keeps together and follows a leader character. There will be 10 characters in the herd that automatically follows the leader whenever he moves...

Oh - and they follow him on Vector2 (no depth).

1) The leader should always be ahead -- so the group should stay at some distance from him. A simple move towards (minus the distance) won't solve it because the herd characters should be spaced a bit one from the other, so there should be some randomness to the way they follow the leader, and always at some distance from him, but also from each other (so they won't appear as one).

2) Another problem I couldn't solve: when the leader dies, a herd member takes his place, with the remaining herd following him now. This goes on until there's no more herd to replace the last leader. So I basically need to destroy the leader character, choose a random herd member, make him step forward ahead of the herd, ditch the follower FMS's and get the leader FSM's...
However I couldn't find the right FSM actions to achieve these goals.

I would really appreciate any ideas you might have :)

Thanks a lot!
Ethan.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Herd behavior
« Reply #1 on: July 09, 2013, 03:25:31 AM »
Hi,

 actually, I think this is the job for a pathfinding framework, any pathfinding framework will help you here.

 your herd will be the target, and anyone who wants to follow him will have its arget set to the current leard position.

 So look in the asset store for pathfinding solutions. For example:

http://hutonggames.com/playmakerforum/index.php?topic=2540.msg19991#msg19991

bye,

 Jean