Contents

Console Objects Fields and Methods Quick Reference Part 7


This quick reference guide was taken directly out of The Game Programmer's Guide to Torque by Edward Maurina. It's an outstanding resource - a must for anyone wanting to get serious about programming in Torque.

LightningData



This is the datablock associated with the lightning object, it is used to specify the bitmap textures and the sounds use with the lightning object.

Fields

Field Name Description Sample or Range
strikeSound Audio profile to play on strike. AudioProfile datablock

strikeTexture[0]
...
strikeTexture[7]

Texture data to use when using textured lightning. ~/path/filename.png

thunderSounds[0]
...
thunderSounds[7]

Audio profiles for thunder sounds. AudioProfile datablock


Marker


This marker is used for building paths used by the PathCamera and other path following objects.

Fields

Field Name Description Sample or Range
msToNext Milliseconds to next marker in sequence. ( 0 , inf )
seqNum Marker position in sequence of markers on this path. [ 0 , 40 )
smoothingType Path smoothing at this marker/knot. “Linear” means no smoothing, while “Spline” means to smooth.

“Linear”
“Spline”

type Type of this marker/knot. A “normal” knot will have a smooth camera translation/rotation effect. “Position Only” will do the same for translations, leaving rotation un-touched. Lastly, a “Kink” means the rotation will take effect immediately for an abrupt rotation change.

“Normal”
“Position Only”
“Kink”


MissionArea


This object is used represent the outer bounds of the mission area. This is a reactive region in that, a callback will be entered each time an object enters or leaves the mission area. Please see the callbacks quick reference for information on these callbacks.

Fields

Field Name Description Sample or Range
Area

Four floating point values <Xl Yl Xw Yw> representing:
- Bottom left corner of mission area <Xl Yl> (in world).
- Size of mission area <Xw Yw>

“ 0.0 0.0 1024.0 512.0”
flightCeiling This value is used to specify the elevation at which a flying vehicles power. That is, when a flying vehicle reaches this elevation it will not be able to thrust vertically any longer. [ 0.0 , inf.0 )
flightCeilingRange This value is used to specify a range below the flight ceiling at which a flying vehicle's to thrust begins to taper off. [ 0.0 , flightCeiling ]


MissionMarker


This class is used to represent generic marker in the game world.

NetConnection


This is the parent object to GameConnection. We do not create instances of net connection, but it is important to note that this class exists and provides several features which are available through the GameConnection class.

Globals

Variable Name Description Sample or Range
pref::Net::PacketRateToClient Limits the packet rate from server to client. [ 1 , 32 ]
pref::Net::PacketRateToServer Limits the packet rate from client to server. [ 8 , 32 ]
pref::Net::PacketSize Limits the size of any one packet. [ 100 , 450 ]


Console Method Summaries

checkMaxRate clearPaths connect
connectLocal getAddress getGhostID
getGhostsActive getPacketLoss getPing
resolveGhostID resolveObjectFromGhostIndex setSimulatedNetParams


Console Methods

checkMaxRate()

Purpose
Use the checkMaxRate method to retrieve the current maximum packet rate for this connection.

Returns
Returns an integer value representing the maximum number of packets that can be transmitted by this connection per transmission period.

Notes
The period may not neccesarily be one second.
To adjust packet rates, see the preference variables above.



clearPaths()

Purpose
Use the clearPaths method to mark this connection as NOT having received any paths.

Returns
No return value.

See Also
transmitPaths



connect( remoteAddress )

Purpose
Use the connect method to request a connection to a remote server at the address remoteAddress.

Syntax
remoteAddress
– A string containing an address of the form: “A.B.C.D:Port”, where A .. B are standard IP numbers between 0 and 255 and Port can be between 1000 and 65536.

Returns
No return value.

See Also
connectLocal, getAddress



connectLocal()

Purpose
Use the connectLocal method to connect the current client-side connection to a local NetConnection, that is to create an internal connection from this client to the internal server. This is accomplished through the use of a back door mechanism and has an extremely high bandwidth.

Returns
No return value.

See Also
connect, getAddress



getAddress()

Purpose
Use the getAddress method to get the address and port that this NetConnection is currently attached to.

Returns
Returns the address and port that this NetConnection is currently attached to, where the addres will be of the form: “A.B.C.D:Port”. A .. B are standard IP numbers between 0 and 255 and Port can be between 1000 and 65536.

If the connection is local, the string “local” will be returned.

If a this NetConnection is not currently connected the method will return a NULL string.

See Also
connect, connectLocal



getGhostsActive()

Purpose
Use the getGhostsActive method to determine how many ghosts are active on a particular connection.

Returns
Returns an integer value between 0 and inf, specifying how many objects are being ghosted to a client on the other side of a specific connection.



getPacketLoss()

Purpose
Use the getPacketLoss method to determine the current packetLoss count for this connection.

Returns
Returns an integer value between 0 and inf, indicating the number of packets that have been lost to date on this net connection.

See Also



getPing()

Purpose
Use the getPing method to determine the round-trip travel time from this connection to the agent on the other end and back again.

Returns
Returns an integer value representing the total time in milliseconds it takes for a ping request to travel to the agent on the other end of a connection and back to this agent.

See Also
getPacketLoss



setSimulatedNetParams( packetLoss , delay )

Purpose
Use the setSimulatedNetParams method to force a connection to experience a certain degree of packet-loss and/or latency. This is a debug feature to allow us to see how a distributed game will behave in the face of poor connection quality.

Syntax
packetLoss
– A floating-point value between 0.0 (0%) and 1.0 (100%) dictating the percentage of packets to be artificially lost.
delay – An integer value specifying the number of milliseconds to insert into transmission latencies.
Returns
No return value.

See Also
getPacketLoss, getPing



transmitPaths()

Purpose
Use the transmitPaths method to send Interior path information to a client on this connection.

Returns
No return value.

Notes
Only called on client connections from the server.

See Also
clearPaths


NetObject



Console Method Summaries

clearScopeToClient getGhostID scopeToClient

Console Methods

clearScopeToClient( client )

Purpose
Use the clearScopeToClient method to undo the effects of a previous call to scopeToClient.

Syntax
client
– The ID of the client to stop forcing scoping this object for.

Returns
No return value.

See Also
scopeToClient



scopeToClient( client )

Purpose
Use the scopeToClient method to force this object to be SCOPE_ALWAYS on client.

Syntax
client
– The ID of the client to force this object to be SCOPE_ALWAYS for.

Returns
No return value.

Notes
When an object is SCOPE_ALWAYS it is always ghosted. Therefore, if you have an object that should always be ghosted to a client, use this method.

See Also
clearScopeToClient, setScopeAlways



setScopeAlways()

Purpose
Use the setScopeAlways method to force an object to be SCOPE_ALWAYS for all clients.

Returns
No return value.

Notes
When an object is SCOPE_ALWAYS it is always ghosted. Therefore, if you have an object that should always be ghosted to all clients, use this method.

See Also
scopeToClient


ParticleData (PD)


This is the datablock used to represent individual particles. This datablock is subsequently used by particle emitter data to produce particle effects. Torque provides a variety of particle effects. Particles may be animated sequences of textures, a single fixed texture, a colorized or non-colorized texture.


Fields

Field Name Description Sample or Range
animateTexture Use textures beyond [ false , true ]

animTexName[0]
...
animTexName[49]

Textures used when animating textures.

Note: animTexName[0] == textureName

~/path/filename.png

colors[0]
colors[1]
colors[2]
colors[3]

Key-framing color controls for particles. "1.0 0.5 0.5 1.0"
constantAcceleration Acceleration applied to particle per second over particle lifetime. ( -inf.0 , inf.0 )
dragCoefficient Drag multiplier (total drag == particle velocity * dragCoefficient). ( -inf.0 , inf.0 )
framesPerSec Texture animation frames per second. ( -inf , inf )
gravityCoefficient Gravity multiplier. ( -inf.0 , inf.0 )
inheritedVelFactor Velocity multiplier (inherited velocity == emitter velocity * inheritedVelFactor). ( -inf.0 , inf.0 )
lifetimeMS Time this particle lives in milliseconds. ( Total lifetime == lifetimeMS +/- rand( lifetimeVarianceMS ) ). ( -inf , inf )
lifetimeVarianceMS Random amount by which lifetime varies. ( -inf , inf )

sizes[0]
sizes[1]
sizes[2]
sizes[3]

Key-framing size controls for particles. ( -inf.0 , inf.0 )
spinRandomMax Maximum degrees for randomized angular spin about billboard's normal. ( -inf.0 , inf.0 )
spinRandomMin Minimum degrees for randomized angular spin about billboard's normal. ( -inf.0 , inf.0 )
spinSpeed Degrees-per-second spin rate about billboard's normal. ( -inf.0 , inf.0 )
textureName Texture to use for non-animated particles. ~/path/filename.png

times[0]
times[1]
times[2]
times[3]

Key-framing time controls for particles.

[ 0.0, times[1] ]
[ times[0], times[2] ]
[ times[1], times[3] ]
[ times[2], 1.0 ]

useInvAlpha Invert alpha components in texture(s). [ false , true ]
windCoefficient Amount by which wind effects particle velocity. ( -inf.0 , inf.0 )


ParticleEmitterData



Fields

Field Name Description Sample or Range
ejectionOffset Each particle is given an ejection direction at which to be emitted, and ejectionOffset specifies the distance in this direction from the particle emitter a particle will be emitted at. This field's value must be non-negative, otherwise a console warning is generated and the value is forced to 0.0. The actual ejectionOffset value used is only guaranteed to be within 0.01 of the value used, and values greater than 655 are not possible. ( -inf.0 , inf.0 )
ejectionPeriodMS Used along with periodVarianceMS to determine the frequency with which to emit particles. See the periodVarianceMS field for more details. Stored with only 10 bits of precision, so values above 1023 are not possible. If value is less than 1, a console warning is generated and the value is forced to 1. ( -inf , inf )
ejectionVelocity Used along with velocityVariance to determine the initial velocity at which a particle is emitted. See the velocityVariance field documentation for more details. This field's value must be non-negative, otherwise a console warning is generated and the value is forced to 0.0. The actual value used is only guaranteed to be within 0.01 of the value specified, and values larger than 655 are not valid. ( -inf.0 , inf.0 )
lifetimeMS Used with lifetimeVarianceMS to determine the total life-time of each emitted particle. Measured in milliseconds. This field's value must be greater than zero, otherwise a console warning is generated and the value is forced to one. To save network transmission bandwidth, the value of lifetimeMS is shifted-right 5 bits, implying a loss of precision. Thus, the lifetime value used may be up to 31 milliseconds less than the value specified. After being shifted, the value is clamped to 10-bits of precision as well; thus, values of more than about 32000 milliseconds will not behave as expected. ( -inf , inf )
lifetimeVarianceMS Used with lifetimeMS to determine the total life-time of each emitted particle. Measured in milliseconds. Each time a particle is created, a random number between -1*lifetimeVarianceMS and lifetimeVarianceMS is generated and added to lifetimeMS to determine the particle's total lifetime. This field's value must be no greater than that of lifetimeMS, otherwise a console warning is generated and the value is clamped. The lifetimeVarianceMS value is shifted and stored with 10-bit precision in the exact manner that lifetimeMS's value is. ( -inf , inf )
orientOnVelocity Only applicable when orientParticles is True. Specifies whether emitted particles will be checked for velocity. If True, and the particle has no velocity, it will not be rendered. If True, and the particle has a velocity, the velocity magnitude will affect the particle's rendered size. False means that the particle's velocity will not affect the rendered size. [ false , true ]
orientParticles Specifies whether emitted particles should be oriented as billboards (always face directly towards the camera), or if they should face the emission direction (see the field documentation for thetaMin, thetaMax, phiReferenceVel, and phiVariance for more information on emission direction). True means the particles should be oriented toward the emission direction, False means particles should be oriented as billboards. [ false , true ]
overrideAdvance Specifies whether a newly created particle's acceleration, color, and other settings should begin being updated immediately after it is created. If false, the new particle is updated immediately. If true, the particle's time advancement system is initially deferred. [ false , true ]
particles String containing a tab-delimited list of ParticleData datablock names. When a particle is emitted from the emitter, its datablock is randomly selected from the list of valid datablocks supplied in the particles field string. The string must be non-empty and at least one token must evaluate to a valid ParticleData datablock name. String must also be less than 256 characters long. If either of these conditions is not met, a console warning will be produced and the datablock's onAdd() method will fail. see type
periodVarianceMS Used along with ejectionPeriodMS to determine the frequency with which to emit particles. Each time a particle is emitted, a random value between -1*periodVarianceMS and periodVarianceMS is generated and added to ejectionPeriodMS to determine the time at which to emit the next particle. So, with the default values ejectionPeriodMS = 100 and periodVarianceMS = 0, particles would be emitted exactly 10 times per second. This field's value is stored with only 10 bits of precision, so values above 1023 are not possible. Value must be less than the value of ejectionPeriodMS, otherwise a console warning is generated and the value is set to ejectionPeriodMS - 1. ( -inf , inf )
phiReferenceVel Each time a particle is emitted, it is given an ejection direction, see the thetaMin field documentation for more information. phiReferenceVel and phiVariance determine the particle's ejection angle about the z-axis. Particles are emitted starting at 0 degrees, and the emission angle is rotated over time, according to the velocity specified in phiReferenceVel, as well as random numbers generated from phiVariance. See the phiVariance field documentation. This field's value is measured in degrees per second and may range from 0.0 to 360.0; if it lies outside this range, a console warning is generated and the value is clamped. ( -inf.0 , inf.0 )
phiVariance Used along with phiReferenceVel to determine the angle relative to the z-axis at which to eject a particle. Each time a particle is generated, a new ejection direction is determined for it. The ejection angle about the z-axis is defined by adding a random variable between 0.0 and phiVariance to the angle determined by phiRefVelocity. See the phiRefVelocity field documentation for more information. This field's value is measured in degrees and must lie in the range of 0.0 to 360.0; if it does not, a console warning is generated and the value is clamped. ( -inf.0 , inf.0 )
thetaMax Each time a particle is emitted, it is given an ejection direction. See the thetaMin field documentation for more information. thetaMax defines the maximum ejection direction angle relative to the x-axis. This field's value is measured in degrees. The value may range from 0.0 to 180.0; if it lies outside this range, a console warning is generated and the value is clamped. ( -inf.0 , inf.0 )
thetaMin Each time a particle is emitted, it is given an ejection direction. This direction is defined by the thetaMin, thetaMax, phiReferenceVel, and phiVariance fields. A random angle between thetaMin and thetaMax is generated and provides the ejection direction angle relative to the x-axis. This field's value is measured in degrees. The value may range from 0.0 to 180.0, and must be less than thetaMax. If one of these conditions is not met, a console warning is generated and the value is clamped accordingly. ( -inf.0 , inf.0 )
useEmitterColors Specifies whether the particle's datablock colors array field should be over-ridden by the colors array provided by the ParticleEmitter object. True implies that the particle's datablock should be over-ridden. [ false , true ]
useEmitterSizes Specifies whether the particle's datablock sizes array field should be over-ridden by the sizes array provided by the ParticleEmitter object. True implies that the particle's datablock should be over-ridden. [ false , true ]
velocityVariance Used along with ejectionVelocity to determine the speed at which a particle will be emitted. Each particle gets a new velocity, which is calculated by adding a random number between -1*velocityVariance and velocityVariance to ejectionVelocity. This field's value must be non-negative and must not be greater than ejectionVelocity, otherwise a console warning is generated and the value is clamped appropriately. The actual value used is only guaranteed to be within 0.01 of the value specified, and values larger than 163 are not valid. ( -inf.0 , inf.0 )


ParticleEmitterNode



Fields

Field Name Description Sample or Range
emitter ParticleEmitterData datablock used by this emitter node ParticleEmitterData datablock
velocity Velocity at which to emit particles. [ 0.0 , inf.0 )


ParticleEmitterNodeData



Fields

Field Name Description Sample or Range
timeMultiple A multiplier that will affect the behavior or the emitter node and the particles it emits. [ 0.0 , inf.0 )


Path



Fields

Field Name Description Sample or Range
isLooping If this is true, the loop is closed, otherwise it is open. [ false , true ]


Console Method Summaries

getPathID


Console Method

getPathID()

Purpose
Use the getPathID method to get the path ID (not the object ID) of this path.

Returns
Returns an integer value representing the path index for this path as stored by the path manager.


Table of Contents || Part 1 || Part 2 || Part 3 || Part 4 || Part 5 || Part 6 || Part 8 || Part 9 || Part 10 || Part 11 || Part 12 || Part 13 || Part 14 || Part 15