• Advertisement
Sign in to follow this  

flocking better for this suituation?any info on flocking?

This topic is 4767 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 posted this earlier, but under a different heading: i have a square room. in this room i will have many people walking around, controlled by the computer. if they hit a wall or another person, they should slow down and turn to avoid collision. my problem here is how do i know which way to turn? lets say i colide with a wall and turn left, but theres another person there turning right? i have been told to look into path finding algorithms, like A*, but i cant see how i would apply this to a world of constantly moving obstacles, as if the obstacles dont stay still, a path cannot be calculated as it wont be there after all the other charachters move. also, im using directX and c# and i have no idea what heuristic i would use, how i would apply it to the world or anything. I briefly looked at A* before but its quite complicated. anyone had this problem before and could they help me with a solution? i am told that flocking algorithms might be a better solution. anyone be able to comment on this or help me out at all?thanks all

Share this post


Link to post
Share on other sites
Advertisement
Flocking would be interesting to try, actually. The original Game Programming Gems has a pretty nice article on the subject, and there are also websites like this which you should check out first.

Stopping people from walking into walls, but one thing that I think might be interesting to try would be to add a vector pointing to the center of the room for each character, to keep them in roughly one place. That would work pretty well for a small, square room. The question is whether you want them to stay relatively still, or to wander frantically around the room and never stop. I'd say not to mimick the flocking algorithm exactly, but to perhaps take several of the rules and use them, modify them, and come up with new ones.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://www.red3d.com/cwr/boids/

there are other interesting things (OpenSteer library) at that site as well...

good luck!

Share this post


Link to post
Share on other sites
All you really do, is you apply four forces:

1st force: Random motion, just wanting to go anywhere.
2nd force: Repulsive force, it repells everything away from anything else with a force that gets exponentially stronger as you get closer.
3rd force: Group force, it attracts all the same sort of creatures to come together, but with a weak force That gets stronger as the creatures get weaker.
4th force: A movement force: Its a force attracting them all to a path. It doesn't exist when there is no path.


With those forces, you can end up with hepas of relitively complex patterns, for little effort. you simply give them a path to follow, and they'll all follow it.

It makes it easier.

Use as you see fit.
From,
Nice coder

Share this post


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

  • Advertisement