Torque Game EngineTorque Game Engine Documentation
Version 1.3.x

PlayerData

The PlayerData datablock class enables us to easily specify many aspects of player character behavior. PlayerData includes all the fields of ShapeBaseData, and adds many more which are specifically related to players and characters in games.

We will look at each field in PlayerData. For the sake of space and clarity, fields defined in ShapeBaseData are omitted from the table below.

Table D.3. PlayerData Member Fields

Field NameTypeDefault ValueDescription
Rendering Data
renderFirstPersonBooleanTrueSpecifies whether the player shape should be rendered in first person
Special Effect Data
DecalDataDecalDataPtrNULLIf specified, this field must point to another datablock object of type DecalData. Must adhere to the semantics associated with DecalData*, as defined in the engine.
decalOffsetfloat0.0The offset from the player's center by which the decal should be displayed; should correlate with the distance from player's center, to the player's right foot center.
footPuffEmitterFootPuffEmitterDataPtrNULLIf specified, this field must point to another datablock of type FootPuffEmitterData. Must adhere to the semantics associated with FootPuffEmitterData*, as defined in the engine.
footPuffNumPartsInteger15Number of dust particles to be generated for foot puffs.
footPuffRadiusFloat0.25The radius of dust spread from foot steps.
dustEmitterParticleEmitterDataPtrNULLIf specified, must point to a datablock of type ParticleEmitterData. Must adhere to the semantics associated with ParticleEmitterData*, as defined in the Torque Game Engine. The ParticleEmitterData datablock will be used to emit particles at footstep locations.
FootSoftSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for soft footsteps.
FootHardSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for hard footsteps.
FootMetalSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for footsteps on metal.
FootSnowSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for footsteps on snow.
FootShallowSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for footsteps in shallow water.
FootWadingSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for footsteps in wading water.
FootUnderwaterSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for footsteps underwater.
FootBubblesSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for bubbles produced by footsteps.
movingBubblesSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for bubbles moving through the water.
waterBreathSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for breathing underwater.
impactSoftSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for soft impacts.
impactHardSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for hard impacts.
impactMetalSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for impacts against metal.
impactSnowSoundAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for impacts against snow.
impactWaterEasyAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for soft impacts against water.
impactWaterMediumAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for medium impacts against water.
impactWaterHardAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds for hard impacts against water.
exitingWaterAudioProfilePtrNULLIf specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. The AudioProfile will be used to produce sounds when emerging from water.
mediumSplashSoundVelocityfloat2.0The minimum velocity at which the medium splash effect will be played when impacting water.
hardSplashSoundVelocityfloat3.0The minimum velocity at which the hard splash effect will be played when impacting water.
exitSplashSoundVelocityfloat2.0The minimum velocity at which the exit splash sound will be played when emerging from water.
SplashSplashDataPtrNULLIf specified, must point to a datablock of type SplashData. Must adhere to the semantics associated with SplashData*, as defined in the Torque Game Engine.
splashVelocityfloat1.0The mimimum velocity a player needs in order to generate a splash effect.
splashAnglefloat45The mimimum verticle angle at which a player must be travelling in order to generate a splash effect.
splashFreqModfloat300.0The simulated frequency modulation of a splash generated by this player. Multiplied along with player speed and time elapsed when determining splash emition rate.
splashVelEpsilonfloat0.25The threshold speed at which we consider the player's movement to have stopped when updating splash effects.
bubbleEmitTimefloat0.4The length of time to continue emitting bubbles.
splashEmitterParticleEmitterDataPtr (array)NULL [NUM_SPLASH_EMITTERS]Array of pointers to ParticleEmitterData datablocks which will be used to generate splash effect particles. If specified, each pointer must reference a datablock of type ParticleEmitterData and must adhere to the semantics associated with ParticleEmitterData*, as defined in the Torque Game Engine.
footstepSplashHeightfloat0.1The maximum height at which to play the shallow footstep effect.
groundImpactMinSpeedfloat10.0The minimum speed at which the player must impact the ground in order to generate ground impact effects.
groundImpactShakeFreqPoint3F(10.0, 10.0, 10.0)The frequency at which to shake the camera if the player is a control object, and a ground impact effect is triggered.
groundImpactShakeAmpPoint3F(20.0, 20.0, 20.0)The amplitude at which to begin shaking the camera if the player is a control object, when a ground impact effect is triggered.
groundImpactShakeDurationFloat1.0The duration to shake the camera if the player is a control object, and a ground impact effect is triggered.
groundImpactShakeFalloffFloat10.0The amplitude falloff over time for camera shake effects generated when the player is a control object, and a ground impact effect is triggered.
View Restrictions Data
minLookAnglefloat-1.4The lowest angle that the player can look, in radians.
maxLookAnglefloat1.4The highest angle that the player can look, in radians.
maxFreelookAnglefloat3.0The max left/right angle the player can look, when in free look mode, in radians.
Player Movement Physics Data
runForceFloat360.0The simulated physcial force of the player when running. Used in running acceleration and speed calculations.
maxForwardSpeedFloat10.0The maximum speed at which the player can run forward when not in water.
maxBackwardSpeedFloat10.0The maximum speed at which the player can run backward when not in water.
maxSideSpeedFloat10.0The maximum speed at which the player can run sideways when not in water.
maxUnderwaterForwardSpeedFloat10.0The maximum speed at which the player can run forward when in water.
maxUnderwaterBackwardSpeedFloat10.0The maximum speed at which the player can run backward when in water.
maxUnderwaterSideSpeedFloat10.0The maximum speed at which the player can run sideways when in water.
maxStepHeightFloat1.0Maximum height the player can step up.
runSurfaceAngleFloat80.0Maximum degree from vertical that the player can run, in degrees.
horizMaxSpeedFloat80.0Maximum horizontal speed the player can attain via any means.
horizResistSpeedFloat38.0Horizontal speed at which resistance will set in.
horizResistFactorFloat1.0Horizontal resistance against player once horizResistSpeed has been attained.
upMaxSpeedFloat80.0Maximum upward speed the player can attain via any means.
upResistSpeedFloat38.0Upward speed at which resistance will set in.
horizResistFactorFloat1.0Upward resistance against player once upResistSpeed has been attained.
minImpactSpeedFloat25.0Minimum speed at which player must be travelling for an impact effect to be triggered.
recoverDelayInteger30.0Number of ticks required for the player to recover from an impact.
recoverRunForceScaleFloat1.0Multiplier used to modify the player's running force while recovering from an impact.
minJumpSpeedFloat500.0Minimum player speed at which to begin scaling jump height.
maxJumpSpeedFloat1000.0Maximum speed at which a player can jump. The value provided will be forced larger than minJumpSpeed.
jumpSurfaceAngleFloat78.0Angle from vertical in degrees where the player can jump.
jumpDelayInteger78.0Delay time between jumps, in ticks.
jumpForceFloat75.0Force exerted by the player jumping.
minJumpEnergyFloat0.0Minimum energy required to jump. NOTE: this field may be removed in the future.
jumpEnergyDrainFloat0.0Player's energy drained by jumping. NOTE: this field may be removed in the future.
minRunEnergyFloat0.0Minimum energy required to run. NOTE: this field may be removed in the future.
runEnergyDrainFloat0.0Player's energy drained by running. NOTE: this field may be removed in the future.
Bounding Box Data
boundingBoxPoint3F(1.0, 1.0, 2.3)This field specifies the width, depth, and height of the player's bounding box
boxHeadPercentageFloat0.85The distance from the bottom of the player's bounding box, to the beginning of the area considered to bound the player's head. Measured as a raw percentage. Thus, by default, the top 15% of the bounding box is considered to bound the player's head.
boxTorsoPercentageFloat0.55Like boxHeadPercentage, but specifies where the torso area begins.
boxHeadLeftPercentageInteger0In conjunction with boxHeadRightPercentage, used to determine whether the left, middle, or right side of the player's torso or legs was hit. Note: this functionality is difficult to properly change; it is recommended that default values be used
boxHeadRightPercentageInteger1See boxHeadLeftPercentage description.
boxHeadFrontPercentageInteger1In conjunction with boxHeadBackPercentage, used to determine whether the front, middle, or back side of the player's torso or legs was hit. Note: this functionality is difficult to proprely change; it is recommended taht default values be used.
boxHeadBackPercentageInteger0See boxHeadFrontPercentage description.
pickupRadiusFloat0.0Radius around player for items (on server). When testing the value, Torque will, by default, force the pickupRadius to be not less than the larger of boundingBox.x and boundingBox.y and no more than twice the same. (pickupRadius must be >= max(boundingBox.x, boundingBox.y) and <= 2*max(boundingBox.x, boundingBox.y))
Animation Data
maxTimeScaleFloat1.5The maximum time scale allowed for player action animations.

There you have it. Again, implementing datablocks based on PlayerData is a simple process identical to that which we saw for GameBaseData. There is one important note, however:

Warning

PlayerData datablocks must be given a non-empty string for the shapeFile field. If no shapeFile value is given, Torque will, by default, produce an error and quit. When working with PlayerData datablocks, always provide a non-empty string for the shapeFile field, even if it's only a dummy string. If a dummy string or invalid file name is given for a PlayerData datablock's shapeFile field, Torque will continue to run, but no data whatsoever will be retrievable from the datablock.

The Torque Game Engine does not define any derivative datablocks of PlayerData. In the next section, we'll look at another derivative of ShapeBaseData, ItemData.