Package svs_simulation :: Package ai_lib :: Module steering :: Class SimpleSteeringBehaviour
[show private | hide private]
[frames | no frames]

Class SimpleSteeringBehaviour


Encapsulates steering behaviours for moving entities.

@ivar self.entity:the owner of this instance
Method Summary
  __init__(self, entity)
boolean accumulateForce(self, runningTotal, forceToAdd)
This function calculates how much of its max steering force the entity has left to apply and then applies that amount of the force to add.
  addTargetAgent(self, targetAgent)
Adds new agent to list of target agents.
  alignmentOff(self)
  alignmentOn(self)
Turns alignment behaviour on.
  arrive(self, targetPos, deceleration)
Similar to seek but it attempts to arrive at the target position with a zero velocity.
  arriveOff(self)
  arriveOn(self)
Turns arrive behaviour on.
  calculate(self)
Calculates and sums the steering forces from any active behaviors, according to the method set in SteeringBehaviours.summingMethod.
  calculateDithered(self)
Sums up the active behaviors by assigning a probabilty of being calculated to each behavior.
  calculatePrioritized(self)
Calls each active steering behavior in order of priority and acumulates their forces until the max steering force magnitude is reached, at which time the function returns the steering force accumulated to that point.
  calculateWeightedSum(self)
Sums up all the active behaviors X their weights and truncates the result to the max available steering force before returning.
  cohesionOff(self)
  cohesionOn(self)
Turns cohesion behaviour on.
  createFeelers(self)
Creates the antenna utilized by the wall avoidance behavior.
  evadeOff(self)
  evadeOn(self, targetAgent)
Turns evade behaviour on and defines agent to evade.
  fleeOff(self)
  fleeOn(self)
Turns flee behaviour on.
  flockingOff(self)
  flockingOn(self)
Turns flocking behaviour on.
  followPath(self)
Given a series of svs_simulation.numdata.vectors.Vector2Ds, this method produces a force that will move the agent along the waypoints in order.
  followPathOff(self)
  followPathOn(self)
Turns path following behaviour on.
  forwardComponent(self)
Calculates the component of the steering force that is parallel with the entity heading.
  getHidingPosition(self, posOb, radiusOb, posHunter)
Given the position of a hunter, and the position and radius of an obstacle, this method calculates a position DistanceFromBoundary away from its bounding radius and directly opposite the hunter.
  hideOff(self)
  hideOn(self, targetAgent)
Turns hide behaviour on and define sagent to hide from.
  interposeOff(self)
  interposeOn(self, targetAgent_1, targetAgent_2)
Turns interpose behaviour on and defines two agents to interpose between.
  isAlignmentOn(self)
  isArriveOn(self)
  isCohesionOn(self)
  isEvadeOn(self)
  isFleeOn(self)
  isFollowPathOn(self)
  isHideOn(self)
  isInterposeOn(self)
  isObstacleAvoidanceOn(self)
  isOffsetPursuitOn(self)
  isPursuitOn(self)
  isSeekOn(self)
  isSeparationOn(self)
  isWallAvoidanceOn(self)
  isWanderOn(self)
  obstacleAvoidanceOff(self)
  obstacleAvoidanceOn(self)
Turns obstacle avoidance behaviour on.
  offsetPursuitOff(self)
  offsetPursuitOn(self, targetAgent, offset)
Turns pursuit behaviour on, defines target of pursuit and set offset.
  pursuitOff(self)
  pursuitOn(self, targetAgent)
Turns pursuit behaviour on and defines target of pursuit.
  seek(self, targetPos)
Given a target, this behavior returns a steering force which will direct the agent towards the target.
  seekOff(self)
  seekOn(self)
Turns seek behaviour on.
  seekToPoint(self, x, y)
Sets a target point for entity to move towards and start seek behaviour.
  separationOff(self)
  separationOn(self)
Turns separation behaviour on.
  setOffset(self, offset)
Sets offset to steering behaviour.
  setpath(self, path)
Sets path for entity to follow.
  setSummingMethod(self, summingMethod)
Sets summing method, this should be a value defined in summing_method.
  setTarget(self, target)
Sets new target for steering behaviour.
  sideComponent(self)
Calculates the component of the steering force that is perpendicuar with the entity heading.
  wallAvoidanceOff(self)
  wallAvoidanceOn(self)
Turns wall avoidance behaviour on.
  wanderOff(self)
  wanderOn(self)
Turns wander behaviour on.
  _behaviourOn(self, behaviorType)
Tests if a specific bit of self.flags is set.

Method Details

accumulateForce(self, runningTotal, forceToAdd)

This function calculates how much of its max steering force the entity has left to apply and then applies that amount of the force to add.

@type runningTotal:svs_simulation.numdata.vectors.Vector2D @type forceToAdd:svs_simulation.numdata.vectors.Vector2D
Returns:
boolean

addTargetAgent(self, targetAgent)

Adds new agent to list of target agents.

alignmentOn(self)

Turns alignment behaviour on.

arrive(self, targetPos, deceleration)

Similar to seek but it attempts to arrive at the target position with a zero velocity.
Parameters:
targetPos
           (type=svs_core.geometry.vectors.Vector2D)
deceleration
           (type=integer)

arriveOn(self)

Turns arrive behaviour on.

calculate(self)

Calculates and sums the steering forces from any active behaviors, according to the method set in SteeringBehaviours.summingMethod.

To Do: add in space-partitioning.

calculateDithered(self)

Sums up the active behaviors by assigning a probabilty of being calculated to each behavior. It then tests the first priority to see if it should be calcukated this simulation-step. If so, it calculates the steering force resulting from this behavior. If it is more than zero it returns the force. If zero, or if the behavior is skipped it continues onto the next priority, and so on.

NOTE: not implemented

calculatePrioritized(self)

Calls each active steering behavior in order of priority and acumulates their forces until the max steering force magnitude is reached, at which time the function returns the steering force accumulated to that point.

calculateWeightedSum(self)

Sums up all the active behaviors X their weights and truncates the result to the max available steering force before returning.

cohesionOn(self)

Turns cohesion behaviour on.

createFeelers(self)

Creates the antenna utilized by the wall avoidance behavior.

evadeOn(self, targetAgent)

Turns evade behaviour on and defines agent to evade.

fleeOn(self)

Turns flee behaviour on.

flockingOn(self)

Turns flocking behaviour on.

followPath(self)

Given a series of svs_simulation.numdata.vectors.Vector2Ds, this method produces a force that will move the agent along the waypoints in order.

NOTE: not currently implemented.

followPathOn(self)

Turns path following behaviour on.

forwardComponent(self)

Calculates the component of the steering force that is parallel with the entity heading.

getHidingPosition(self, posOb, radiusOb, posHunter)

Given the position of a hunter, and the position and radius of an obstacle, this method calculates a position DistanceFromBoundary away from its bounding radius and directly opposite the hunter.
Parameters:
posOb
           (type=svs_simulation.numdata.vectors.Vector2D)
radiusOb
           (type=float)
posHunter
           (type=svs_simulation.numdata.vectors.Vector2D)

hideOn(self, targetAgent)

Turns hide behaviour on and define sagent to hide from.

interposeOn(self, targetAgent_1, targetAgent_2)

Turns interpose behaviour on and defines two agents to interpose between.

obstacleAvoidanceOn(self)

Turns obstacle avoidance behaviour on.

offsetPursuitOn(self, targetAgent, offset)

Turns pursuit behaviour on, defines target of pursuit and set offset.

pursuitOn(self, targetAgent)

Turns pursuit behaviour on and defines target of pursuit.

seek(self, targetPos)

Given a target, this behavior returns a steering force which will direct the agent towards the target.
Parameters:
targetPos
           (type=svs_simulation.numdata.vectors.Vector2D)

seekOn(self)

Turns seek behaviour on.

seekToPoint(self, x, y)

Sets a target point for entity to move towards and start seek behaviour.

separationOn(self)

Turns separation behaviour on.

setOffset(self, offset)

Sets offset to steering behaviour.

@type offset:svs_simulation.numdata.vectors.Vector2D

setpath(self, path)

Sets path for entity to follow. The path is defined as an array of svs_simulation.numdata.vectors.Vector2Ds

setSummingMethod(self, summingMethod)

Sets summing method, this should be a value defined in summing_method.

setTarget(self, target)

Sets new target for steering behaviour.

sideComponent(self)

Calculates the component of the steering force that is perpendicuar with the entity heading.

wallAvoidanceOn(self)

Turns wall avoidance behaviour on.

wanderOn(self)

Turns wander behaviour on.

_behaviourOn(self, behaviorType)

Tests if a specific bit of self.flags is set.

Generated by Epydoc 2.1 on Thu Oct 20 15:30:31 2005 http://epydoc.sf.net