AI for Games 1.1.1
|
Public Member Functions | |
Vehicle (Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, double max_turn_rate, double max_force) | |
Vehicle (String name, Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, double max_turn_rate, double max_force) | |
Vehicle | AP (AutoPilot ap) |
AutoPilot | AP () |
double | maxForce () |
Vehicle | forceRecorderOn () |
Vehicle | forceRecorderOff () |
ForceRecorder | forceRecorder () |
boolean | hasForceRecorder () |
void | printForceData () |
void | update (double deltaTime, World world) |
String | toString () |
Public Member Functions inherited from game2dai.entities.MovingEntity | |
MovingEntity (Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, double max_turn_rate, double max_force) | |
MovingEntity (String name, Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, double max_turn_rate, double max_force) | |
Vector2D | prevPos () |
Vector2D | velocity () |
MovingEntity | velocity (Vector2D newVel) |
MovingEntity | velocity (double vx, double vy) |
MovingEntity | heading (Vector2D h) |
MovingEntity | heading (double x, double y) |
Vector2D | heading () |
Vector2D | headingAtRest () |
MovingEntity | headingAtRest (Vector2D restHeading) |
void | mass (double mass) |
double | mass () |
Vector2D | side () |
double | maxSpeed () |
MovingEntity | maxSpeed (double maxSpeed) |
double | maxForce () |
MovingEntity | maxForce (double mf) |
boolean | isSpeedMaxedOut () |
double | speed () |
double | speedSq () |
double | maxTurnRate () |
MovingEntity | maxTurnRate (double maxTurnRate) |
double | turnRate () |
MovingEntity | turnRate (double turnRate) |
double | viewDistance () |
MovingEntity | viewDistance (double viewDistance) |
double | viewFOV () |
MovingEntity | viewFOV (double viewFOV) |
MovingEntity | viewFactors (double viewDistance, double viewFOV) |
MovingEntity | worldDomain (Domain wd) |
MovingEntity | worldDomain (Domain wd, int constraint) |
MovingEntity | worldDomainConstraint (int constraint) |
Domain | worldDomain () |
int | worldDomainConstraint () |
boolean | isEitherSide (double x0, double y0, double x1, double y1) |
boolean | canSee (World world, double x0, double y0) |
boolean | canSee (World world, Vector2D pos) |
boolean | rotateHeadingToFacePosition (double deltaTime, Vector2D faceTarget) |
boolean | rotateHeadingToAlignWith (double deltaTime, final Vector2D allignTo) |
boolean | isInDomain (Domain view) |
boolean | isOver (double px, double py) |
void | update (double deltaTime, World world) |
void | draw (double elapsedTime, World world) |
void | draw (World world) |
Public Member Functions inherited from game2dai.entities.BaseEntity | |
BaseEntity () | |
BaseEntity (String name) | |
BaseEntity (String entityName, Vector2D entityPos, double entityColRadius) | |
int | ID () |
void | updateFSM (double deltaTime, World world) |
FiniteStateMachine | FSM () |
boolean | hasFSM () |
void | addFSM () |
boolean | removeFSM () |
int | Z () |
BaseEntity | Z (int z) |
boolean | isVisible () |
BaseEntity | visible (boolean visible) |
double | colRadius () |
BaseEntity | colRadius (double colRadius) |
boolean | isOverLapAllowed () |
BaseEntity | overLapAllowed (boolean overLapAllowed) |
boolean | isInDomain (Domain view) |
boolean | isOver (double px, double py) |
BaseEntity | renderer (Picture renderer) |
Picture | renderer () |
void | die (World world, double timeToLive) |
void | born (World world, double timeToLive) |
BaseEntity | moveTo (double x, double y) |
BaseEntity | moveTo (Vector2D p) |
BaseEntity | moveBy (double x, double y) |
BaseEntity | moveBy (Vector2D p) |
Vector2D | pos () |
BaseEntity | name (String name) |
String | name () |
boolean | isEitherSide (double x0, double y0, double x1, double y1) |
boolean | isEitherSide (Vector2D p0, Vector2D p1) |
void | update (double deltaTime, World world) |
void | draw (World world) |
void | draw (double elapsedTime, World world) |
int | compareTo (BaseEntity o) |
String | toString () |
Static Public Member Functions | |
static Vehicle[] | makeFromXML (PApplet app, String xmlFilename) |
static Vehicle[] | makeFromXML (String xmlFilename) |
static Vehicle[] | makeFromXML (File xmlFile) |
Protected Attributes | |
Vector2D | force = new Vector2D() |
Vector2D | accel = new Vector2D() |
ForceRecorder | forceRecorder = null |
Protected Attributes inherited from game2dai.entities.MovingEntity | |
Domain | wd = null |
int | domainConstraint = SBF.WRAP |
Vector2D | prevPos = new Vector2D() |
Vector2D | velocity = new Vector2D() |
Vector2D | heading = new Vector2D() |
Vector2D | side = new Vector2D() |
double | mass |
double | maxSpeed |
double | maxForce |
double | maxTurnRate |
double | currTurnRate |
double | prevTurnRate |
double | viewDistance = 50 |
double | viewFOV = 1.047 |
Protected Attributes inherited from game2dai.entities.BaseEntity | |
Integer | entityID |
String | name = "" |
Picture | renderer = null |
boolean | visible = true |
Vector2D | pos = new Vector2D() |
double | colRadius |
Private Attributes | |
AutoPilot | ap |
Additional Inherited Members | |
Public Attributes inherited from game2dai.entities.BaseEntity | |
String | tag = "" |
int | tagNo = 0 |
Protected Member Functions inherited from game2dai.entities.MovingEntity | |
void | applyDomainConstraint () |
Package Attributes inherited from game2dai.entities.BaseEntity | |
boolean | overlapAllowed = false |
This class models the behaviour of a moving entity acting under the influence of an AutoPilot.
game2dai.entities.Vehicle.Vehicle | ( | Vector2D | position, |
double | radius, | ||
Vector2D | velocity, | ||
double | max_speed, | ||
Vector2D | heading, | ||
double | mass, | ||
double | max_turn_rate, | ||
double | max_force | ||
) |
The constructor that should be used when creating a Vehicle without a name.
position | initial world position |
radius | bounding radius |
velocity | initial velocity |
max_speed | maximum speed |
heading | initial heading |
mass | initial mass |
max_turn_rate | how fast the entity can turn (radians / second) |
max_force | the maximum force that can be applied by a steering behaviour |
game2dai.entities.Vehicle.Vehicle | ( | String | name, |
Vector2D | position, | ||
double | radius, | ||
Vector2D | velocity, | ||
double | max_speed, | ||
Vector2D | heading, | ||
double | mass, | ||
double | max_turn_rate, | ||
double | max_force | ||
) |
The constructor that should be used when creating a Vehicle with a name.
name | optional name for the entity |
position | initial world position |
radius | bounding radius |
velocity | initial velocity |
max_speed | maximum speed |
heading | initial heading |
mass | initial mass |
max_turn_rate | how fast the entity can turn (radians / second) |
max_force | the maximum force that can be applied by a steering behaviour |
AutoPilot game2dai.entities.Vehicle.AP | ( | ) |
Use this to access the auto-pilot object so that it can be modified.
Set the auto-pilot to use with this entity. Null vales and steering behaviour object with an owner are ignored.
ap | an available steering behaviour |
ForceRecorder game2dai.entities.Vehicle.forceRecorder | ( | ) |
Get the force recorder if this vehicle has one. This is used by the World class when displaying all force logs
Vehicle game2dai.entities.Vehicle.forceRecorderOff | ( | ) |
Dump the force recorder on for this Vehicle. Any collected data will be lost.
Vehicle game2dai.entities.Vehicle.forceRecorderOn | ( | ) |
Enable the force recorder on for this Vehicle. This will delete any collected data and start the logger.
The recorder will record the minimum, maximum average and number of readings for each steering force.
This is useful in tweaking max force values for vehicles and to help decide on the best force calculation method to use.
The force recorder should be switched off in the final sketch.
boolean game2dai.entities.Vehicle.hasForceRecorder | ( | ) |
See if this vehicle has a force recorder.
|
static |
Alternative if not using Processing
xmlFile | File to parse |
|
static |
This is the one to use with Processing
app | |
xmlFilename |
|
static |
Alternative if not using Processing
xmlFilename | name of the file to parse |
double game2dai.entities.Vehicle.maxForce | ( | ) |
Get the maximum force that can be applied to this entity
Reimplemented from game2dai.entities.MovingEntity.
void game2dai.entities.Vehicle.printForceData | ( | ) |
Display the steering force data for this Vehicle. If there is no recorder or no data has been collected for this Vehicle then nothing is displayed.
String game2dai.entities.Vehicle.toString | ( | ) |
Entity ID number and name returned as a String
Reimplemented from game2dai.entities.BaseEntity.
void game2dai.entities.Vehicle.update | ( | double | deltaTime, |
World | world | ||
) |
Update method for any moving entity in the world that is under the influence of a steering behaviour.
deltaTime | elapsed time since last update |
world | the game world object |
Reimplemented from game2dai.entities.MovingEntity.
The acceleration created from the accumulated force
|
private |
The auto-pilot
The accumulated force from the steering behaviours
|
protected |
Used to record force calculation data for this vehicle.