Planeshift
Classes | Enumerations | Functions | Variables

Crowd

Members in this module implement local steering and dynamic avoidance features. More...

Classes

class  dtCrowd
 Provides local steering behaviors for a group of agents. More...
struct  dtCrowdAgent
 Represents an agent managed by a dtCrowd object. More...
struct  dtCrowdAgentParams
 Configuration parameters for a crowd agent. More...
struct  dtCrowdNeighbour
 Provides neighbor data for agents managed by the crowd. More...
class  dtPathCorridor
 Represents a dynamic polygon corridor used to plan agent movement. ,. More...

Enumerations

enum  CrowdAgentState { DT_CROWDAGENT_STATE_INVALID, DT_CROWDAGENT_STATE_WALKING, DT_CROWDAGENT_STATE_OFFMESH }
 

The type of navigation mesh polygon the agent is currently traversing.

More...
enum  UpdateFlags {
  DT_CROWD_ANTICIPATE_TURNS = 1, DT_CROWD_OBSTACLE_AVOIDANCE = 2, DT_CROWD_SEPARATION = 4, DT_CROWD_OPTIMIZE_VIS = 8,
  DT_CROWD_OPTIMIZE_TOPO = 16
}
 

Crowd agent update flags.

More...

Functions

dtCrowddtAllocCrowd ()
 Allocates a crowd object using the Detour allocator.
void dtFreeCrowd (dtCrowd *ptr)
 Frees the specified crowd object using the Detour allocator.

Variables

static const int DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS = 8
 The maximum number of crowd avoidance configurations supported by the crowd manager.
static const int DT_CROWDAGENT_MAX_CORNERS = 4
 The maximum number of corners a crowd agent will look ahead in the path. This value is used for sizing the crowd agent corner buffers. Due to the behavior of the crowd manager, the actual number of useful corners will be one less than this number.
static const int DT_CROWDAGENT_MAX_NEIGHBOURS = 6
 The maximum number of neighbors that a crowd agent can take into account for steering decisions.

Detailed Description

Members in this module implement local steering and dynamic avoidance features.

The crowd is the big beast of the navigation features. It not only handles a lot of the path management for you, but also local steering and dynamic avoidance between members of the crowd. I.e. It can keep your agents from running into each other.

Main class: dtCrowd

The dtNavMeshQuery and dtPathCorridor classes provide perfectly good, easy to use path planning features. But in the end they only give you points that your navigation client should be moving toward. When it comes to deciding things like agent velocity and steering to avoid other agents, that is up to you to implement. Unless, of course, you decide to use dtCrowd.

Basically, you add an agent to the crowd, providing various configuration settings such as maximum speed and acceleration. You also provide a local target to more toward. The crowd manager then provides, with every update, the new agent position and velocity for the frame. The movement will be constrained to the navigation mesh, and steering will be applied to ensure agents managed by the crowd do not collide with each other.

This is very powerful feature set. But it comes with limitations.

The biggest limitation is that you must give control of the agent's position completely over to the crowd manager. You can update things like maximum speed and acceleration. But in order for the crowd manager to do its thing, it can't allow you to constantly be giving it overrides to position and velocity. So you give up direct control of the agent's movement. It belongs to the crowd.

The second biggest limitation revolves around the fact that the crowd manager deals with local planning. So the agent's target should never be more than 256 polygons aways from its current position. If it is, you risk your agent failing to reach its target. So you may still need to do long distance planning and provide the crowd manager with intermediate targets.

Other significant limitations:

Note:
This is a summary list of members. Use the index or search feature to find minor members.

Enumeration Type Documentation

The type of navigation mesh polygon the agent is currently traversing.

Enumerator:
DT_CROWDAGENT_STATE_INVALID 

The agent is not in a valid state.

DT_CROWDAGENT_STATE_WALKING 

The agent is traversing a normal navigation mesh polygon.

DT_CROWDAGENT_STATE_OFFMESH 

The agent is traversing an off-mesh connection.

Definition at line 59 of file DetourCrowd.h.

Crowd agent update flags.

See also:
dtCrowdAgentParams::updateFlags
Enumerator:
DT_CROWD_ANTICIPATE_TURNS 
DT_CROWD_OBSTACLE_AVOIDANCE 
DT_CROWD_SEPARATION 
DT_CROWD_OPTIMIZE_VIS 

Use #dtPathCorridor::optimizePathVisibility() to optimize the agent path.

DT_CROWD_OPTIMIZE_TOPO 

Use dtPathCorridor::optimizePathTopology() to optimize the agent path.

Definition at line 173 of file DetourCrowd.h.


Function Documentation

dtCrowd* dtAllocCrowd ( )

Allocates a crowd object using the Detour allocator.

Returns:
A crowd object that is ready for initialization, or null on failure.
void dtFreeCrowd ( dtCrowd ptr)

Frees the specified crowd object using the Detour allocator.

Parameters:
[in]ptrA crowd object allocated using dtAllocCrowd

Variable Documentation

The maximum number of crowd avoidance configurations supported by the crowd manager.

See also:
dtObstacleAvoidanceParams, dtCrowd::setObstacleAvoidanceParams(), dtCrowd::getObstacleAvoidanceParams(), dtCrowdAgentParams::obstacleAvoidanceType

Definition at line 46 of file DetourCrowd.h.

const int DT_CROWDAGENT_MAX_CORNERS = 4 [static]

The maximum number of corners a crowd agent will look ahead in the path. This value is used for sizing the crowd agent corner buffers. Due to the behavior of the crowd manager, the actual number of useful corners will be one less than this number.

Definition at line 39 of file DetourCrowd.h.

const int DT_CROWDAGENT_MAX_NEIGHBOURS = 6 [static]

The maximum number of neighbors that a crowd agent can take into account for steering decisions.

Definition at line 32 of file DetourCrowd.h.