Torque Game Engine DocumentationVersion 1.3.x |
With ShapeBaseData, datablocks begin getting more complex and useful. ShapeBaseData is derived from GameBaseData and offers all the same basic functionality, along with manynew features.
ShapeBaseData defines rendering data: fields can be set to specify a renderable shape, some texturing effects, and destruction behavior. Camera-related data is also defined. Damage behavior can be specified as well. ShapeBaseData also defines a field related to CRC-checking, which is a security feature. Physics information is defined, though by default objects containing a ShapeBaseData datablock do not utilize physical information-- rather, physics data is used in objects with datablocks which are themselves derived from ShapeBaseData. In addition, energy data is defined, but this may be removed in the future. A field related to AI behavior is defined as well, but may also be removed. HUD-related fields are also specified, but these fields are not fully supported and are very likely to be removed.
The Torque Game Engine defines many datablocks which derive from ShapeBaseData, as we will soon see. As such, it is a good idea to familiarize yourself with ShapeBaseData's fields. Below is a table listing all of the data fields provided in ShapeBaseData, along with brief descriptions for each.
Table D.2. ShapeBaseData Member Fields
| Field Name | Type | Default Value | Description |
|---|---|---|---|
| GameBaseData Derived Fields | |||
| Category | String | Identifies which category in the Mission Editor objects based on this datablock will show up in. | |
| className | String | ShapeBaseData | Used to identify this datablock's class. Value can be over-ridden in script. |
| Rendering Data | |||
| shapeFile | Filename | NULL | Name of a shape file. Specified as a string, but must adhere to the semantics associated with the filename data type, as defined in the engine. |
| cloakTexture | Filename | The name of a texture file, which can be used to render a cloaking effect. NOTE: This field may eventually be removed from the ShapeBaseData description. | |
| emap | Boolean | False | Specifies whether environment mapping should be enabled for this object. |
| Destruction Effect Data | |||
| Explosion | ExplosionDataPtr | NULL | If specified, this field must point to another datablock object of type ExplosionData. Must adhere to the semantics associated with ExplosionData*, as defined in the engine. |
| underwaterExplosion | ExplosionDataPtr | NULL | See the Explosion field. underWaterExplosion must follow the same specification, but is intended to enable a separate explosion effect for use under water. |
| Debris | DebrisDataPtr | NULL | If specified, this field must point to another datablock of type DebrisData. Must adhere to the semantics associated with DebrisData*, as defined in the engine. |
| debrisShapeName | Filename | The filename of the shape associated with the Debris field. | |
| renderWhenDestroyed | Boolean | True | Specifies whether the object should be rendered after it is destroyed. |
| Camera Data | |||
| cameraMaxDist | float | 0.0 | Maximum allowable camera distance from the eye. |
| cameraMinDist | float | 0.2 | The minimum allowable camera distance from the eye. |
| cameraDefaultFOV | float | 90.0 | The default Field-of-Vision angle, measured in angles. |
| cameraMinFOV | float | 5.0 | The minimum allowable Field-of-Vision angle, measured in angles. |
| cameraMaxFOV | float | 120.0 | The maximum allowable Field-of-Vision angle, measured in angles. |
| useEyePoint | Boolean | False | Specifies whether we should use the shape's eye point as the camera viewing point. |
| observeThroughObject | Boolean | False | Specifies whether we observe the object through its camera transform and FOV. |
| cameraDefaultFOV | float | 90.0 | The default Field-of-Vision angle, measured in angles. |
| firstPersonOnly | Boolean | False | Specifies whether only first-person view can be used. |
| Security Data | |||
| computeCRC | Boolean | False | Specifies whether the shapeFile CRC must match that sent from the server. |
| Physics Data | |||
| mass | Float | 1.0 | The property of mass, as used in physical simulations. |
| density | Float | 1.0 | The property of density, as used in physical simulations. |
| drag | Float | 0.0 | The property of drag, as used in physical simulations. |
| Damage-Specific Fields | |||
| isInvincible | Boolean | False | Specifies whether the entity should be treated as unable to take damage. |
| maxDamage | Float | 1.0 | The maximum damage that the entity can withstand. |
| destroyedLevel | Float | 1.0 | The point at which the is considered destroyed, in relation to damage taken versus maximum damage. Valid values range from 0.0 to 1.0. NOTE: This field may be removed in the future. |
| disabledLevel | Float | 1.0 | The point at which the entity is considered disabled, in relation to damage taken versus maximum damage. Valid values range from 0.0 to 1.0. |
| repairRate | Float | 0.0033 | Repair rate per tick. |
| Energy Data | |||
| MaxEnergy | Float | 0.0 | The maximal energy value. NOTE: This field may be removed in the future. |
| inheritEnergyFromMount | Boolean | False | Specifies whether the engine should transfer energy from a mounted energy source to the object. NOTE: This field may be removed in the future. |
| AI Data | |||
| aiAvoidThis | Boolean | False | Specifies whether the AI should avoid this object. NOTE: This field is not fully supported and may be removed in the future. |
| HUD Data | |||
| hudImageName | String | NOTE: This field is not fully supported and may be removed in the future. | |
| hudImageNameFriendly | String (array) | NOTE: This field is not fully supported and may be removed in the future. | |
| hudImageNameEnemy | String (array) | NOTE: This field is not fully supported and may be removed in the future. | |
| hudRenderCenter | Boolean (array) | False | NOTE: This field is not fully supported and may be removed in the future. |
| hudRenderModulated | Boolean (array) | False | NOTE: This field is not fully supported and may be removed in the future. |
| hudRenderAlways | Boolean (array) | False | NOTE: This field is not fully supported and may be removed in the future. |
| hudRenderDistance | Boolean (array) | False | NOTE: This field is not fully supported and may be removed in the future. |
| hudRenderName | Boolean (array) | False | NOTE: This field is not fully supported and may be removed in the future. |
Creating a ShapeBaseData datablock works just like creating a GameBaseData datablock; simply enter values for the fields you want to change from default, and add any new entries you'd like to.
As you can see, ShapeBaseData begins to define some useful fields which can be used to quickly specify gameplay behavior. Next, we'll take a look at the datablocks that are derived from ShapeBaseData.