Jump to content
  • Advertisement
Sign in to follow this  
hengh2009

how to implement formation in group?

This topic is 3264 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

I met a problem recently, i want to implement formation in group,something like OpenSteer'pedestrian run on a map,but there are some differences,within these agents,some agents belong to same group,so they will have same velocity,and acceleration also they will closer to each other than to the agent not within same group, but i have no idea about how to implement it, can anybody help me, thank you very much.

Share this post


Link to post
Share on other sites
Advertisement
If I understand your badly worded question correctly, you are trying to progress from a single pool of coordinated pedestrian agents to separate groups of agents that keep a formation only with others in the same group rather than with any agent that happens to be close.
You can simply tag agents with their group and use this information to filter the results of spatial queries for agents: group A agents try to match the velocity of nearby group A agents while walking towards a waypoint, group B agents try to distance themselves from group A agents and get close to group C agents without going anywhere, group C agents just try to spread out, and so on.
Note that you cannot guarantee that such behavioural groups will always be spatially separated: groups can cross each other's path, or even stop in the same place and mingle indefinitely.

Share this post


Link to post
Share on other sites
Steering behaviors are great for inspiration, but personally I prefer a more principled approach: Define an "energy function" over your agents' positions and velocities that (1) will be minimized by the states you want, and (2) gets very large near unwanted states, and then simply have your agents walk down the gradient of this function in state-space.

Mixtures of quadratic penalty functions (which are "soft") and logarithmic barrier functions (which are "harder") have worked well for me in the past.

Share this post


Link to post
Share on other sites
Quote:
Original post by Emergent
Steering behaviors are great for inspiration, but personally I prefer a more principled approach: Define an "energy function" over your agents' positions and velocities that (1) will be minimized by the states you want, and (2) gets very large near unwanted states, and then simply have your agents walk down the gradient of this function in state-space.

Mixtures of quadratic penalty functions (which are "soft") and logarithmic barrier functions (which are "harder") have worked well for me in the past.


i think your method is something like potential field algorithm,but it is path finding algorithm,but i want agents within same group align with each other,and closer to each other,i do not think this algorithm can solve this problem.thank you very much.

Share this post


Link to post
Share on other sites
Quote:
Original post by LorenzoGatti
If I understand your badly worded question correctly, you are trying to progress from a single pool of coordinated pedestrian agents to separate groups of agents that keep a formation only with others in the same group rather than with any agent that happens to be close.
You can simply tag agents with their group and use this information to filter the results of spatial queries for agents: group A agents try to match the velocity of nearby group A agents while walking towards a waypoint, group B agents try to distance themselves from group A agents and get close to group C agents without going anywhere, group C agents just try to spread out, and so on.
Note that you cannot guarantee that such behavioural groups will always be spatially separated: groups can cross each other's path, or even stop in the same place and mingle indefinitely.


i should apologize for my poor english,Thank you very much~

Share this post


Link to post
Share on other sites
Quote:
Original post by hengh2009
i think your method is something like potential field algorithm,but it is path finding algorithm,but i want agents within same group align with each other,and closer to each other,i do not think this algorithm can solve this problem.thank you very much.


The idea is to define the potential not over 3-space, but over the state space--which includes agents' headings, etc. And if multiple states are equally desirable -- say, all the states in which the agents are aligned -- then you'd use a potential function which has a "trough"-like minimum (so that all states in which agents are aligned are minima).

A good way to define these functions is as a sum of "interaction potentials."

For alignment, for example, you can use the potential



where denotes the difference in heading angle between agents i and j, and denotes the neighbors to agent i.

When you differentiate this, you see that each agent should steer according to the average sine of angular deviation with its neighbors; these sines-of-angles can be computed with cross products (or "2d cross products" depending on the number of dimensions) without resorting to trig functions at all.

You could add other terms penalizing when agents are too close together -- or too far apart.

See where I'm going with this?

Share this post


Link to post
Share on other sites
Quote:
Original post by Emergent
Quote:
Original post by hengh2009
i think your method is something like potential field algorithm,but it is path finding algorithm,but i want agents within same group align with each other,and closer to each other,i do not think this algorithm can solve this problem.thank you very much.


The idea is to define the potential not over 3-space, but over the state space--which includes agents' headings, etc. And if multiple states are equally desirable -- say, all the states in which the agents are aligned -- then you'd use a potential function which has a "trough"-like minimum (so that all states in which agents are aligned are minima).

A good way to define these functions is as a sum of "interaction potentials."

For alignment, for example, you can use the potential



where denotes the difference in heading angle between agents i and j, and denotes the neighbors to agent i.

When you differentiate this, you see that each agent should steer according to the average sine of angular deviation with its neighbors; these sines-of-angles can be computed with cross products (or "2d cross products" depending on the number of dimensions) without resorting to trig functions at all.

You could add other terms penalizing when agents are too close together -- or too far apart.

See where I'm going with this?


thank you very much,i will try your method.

[Edited by - hengh2009 on December 8, 2009 10:54:22 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!