Jump to content
  • Advertisement
Sign in to follow this  
fguihen

crowd behavours

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

im creating an app to demonstrate crowd behavour, how even though each person is action logically , the crowd acts chaoticially. i want to add obstacle avoision and physics, such as the people slowing down when they turn or when a big crowd comes to a narrow doorway. would the envrionment class contain all the physics, or would i include it in the person class? sorry that my question isnt that clear , but im not fully sure what im doing at the moment. thanks all

Share this post


Link to post
Share on other sites
Advertisement
What you have there is a boid style flocking behavior.

The way I would do something like that is to have an environment class that holds your people and the obstacle. I would let the AI work in the individual object class though. Each person would check for neighbors or closeby obstacles that would affect their behavior and the modify their own movement and behavior on that.

As far as physics, that's a grey area on how detailed you are getting.

Most flocking simulations handle this by making a personal space around each object. When the AI of each boid weights out where it is intending on moving to, it takes into account it's own personal space and attempts to distance itself from other boids.

Share this post


Link to post
Share on other sites
google "Steering Behaviors For Autonomous Characters". There is actually an 'engine' for autonomous navigation. Check it out. THere is a demo of it in the java applet on the web page.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Here's a fun idea: Navier-Stokes.

Share this post


Link to post
Share on other sites
Quote:
Original post by fguihen
im creating an app to demonstrate crowd behavour, how even though each person is action logically , the crowd acts chaoticially. i want to add obstacle avoision and physics, such as the people slowing down when they turn or when a big crowd comes to a narrow doorway. would the envrionment class contain all the physics, or would i include it in the person class? sorry that my question isnt that clear , but im not fully sure what im doing at the moment. thanks all


I think I missed the point...

Each person should contain everything necessary for his own navigation. Like physics properties (inertia, speed, size, ...).

Then their navigation system ("the rabbit in their head, working the controls"), would scan for nearby agents and walls, and tweak the physics of the agent as seen fit. For example, in crowds, you can have several constraints, like each agents should be at least one meter away from each other. As they get closer, they repel each other more. In flocking behaviours, they should try to stay at most 2 meters away from each other. Also, for fleeing behaviour or attract behaviours (kind of like pac man), this will influence the direction of travel of the agent, moving away or towards the attractor (prey, the girl in the red dress), or repulsor (fire, predator, ...).

You can mix and match those behaviours, like making sure they all have their personal space, but each of them walks towards a goal or follow a path. You need to prioritise the behaviour somewhat, to give more weight to a goal (stay on the path) rather than another (stay away from this guy).

ect, ... you can invent rules like that as you wish. For characters, they can change their direction of movement pretty much freely. For a car, the car has to brake, steer (slow turning), reverse, so a lot more cumbersome. Given the inputs (the 'impulse' the path planning system requires to achieve the goal, like fleeing or flocking, or reaching a target), this impulse will be used by the driver to change the course of the agent within the constraints of the agent (how agile it is, how fast can it go, how fast can it accelerate, ect...) If you feel that you need to steer a lot sharper than the vehicle can, you need to do evasive actions like brake hard, but try to stay on the limits of the tyre grip (using a very simplified physics system).

So it's a three-stage system (well 4, but the last one is really a given).
1) for each requested behaviour (follow path/flock/avoid/flee/hunt), work out individual impulses to steer the agent.
2) concatenate the individual impulses into one, and weight each of them according to what the agent considers the most important.
3a) If the agent is dissasociated with a vehicle (say a little guy driving a car), convert that impulse vector into inputs for the physics system (car controls would be brake, steer, throttle).The vehile will process those inputs and update its physics.
3b) If you are using simplified physics (like the agent itself is a simple car), process the impulse directly and apply it to the physics, apply constraints (like rate of turn, max acceleration, max speed, stay within the grip limit).
4) As a general precaution, do a simple collision system to ensure that the agents don't intersect each other.

for people, they should be allowed to move relatively freely. The only constraint on their physics would be the maximum speed (you can split it into strafe, backwards and forward speed), and their inertia (the acceleration speed).

That is basically it. It's like a subconscient process, where the agents takes some goals, and automatically navigate towards achiving the goal, like you would do in real life. You don't keep reminding yourself to leave a separation of '1 meter between you and other people', like I need to go left to avoid that bloke, you just do it automatically.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!