GameBase Class Reference#include <gameBase.h>
Inheritance diagram for GameBase: ![]() Detailed DescriptionBase class for game objects which use datablocks, networking, are editable, and need to process ticks.
GameBase and ProcessListGameBase adds two kinds of time-based updates. Torque works off of a concept of ticks. Ticks are slices of time 32 milliseconds in length. There are three methods which are used to update GameBase objects that are registered with the ProcessLists:
Torque maintains a server and a client processing list; in a local game, both are populated, while in multiplayer situations, either one or the other is populated. You can control whether an object is considered for ticking by means of the setProcessTick() method. GameBase and DatablocksGameBase adds support for datablocks. Datablocks are secondary classes which store static data for types of game elements. For instance, this means that all "light human male armor" type Players share the same datablock. Datablocks typically store not only raw data, but perform precalculations, like finding nodes in the game model, or validating movement parameters.There are three parts to the datablock interface implemented in GameBase:
Datablocks are also usable through the scripting language.
GameBase and NetworkingwritePacketData() and readPacketData() are called to transfer information needed for client side prediction. They are usually used when updating a client of its control object state.Subclasses of GameBase usually transmit positional and basic status data in the packUpdate() functions, while giving velocity, momentum, and similar state information in the writePacketData(). writePacketData()/readPacketData() are called in addition to packUpdate/unpackUpdate().
Member Typedef Documentation
Reimplemented from SceneObject. Reimplemented in PathedInterior, sgLightObject, sgMissionLightingFilter, VolumeLight, AIPlayer, Camera, Debris, Explosion, fxLight, Lightning, ParticleEmitter, ParticleEmitterNode, Precipitation, Splash, Item, MissionMarker, SpawnSphere, CameraBookmark, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle.
Member Enumeration Documentation
Constructor & Destructor Documentation
Member Function Documentation
Called when the object is added to the sim.
Reimplemented from SceneObject. Reimplemented in PathedInterior, sgLightObject, sgMissionLightingFilter, VolumeLight, Camera, Debris, Explosion, fxLight, Lightning, ParticleEmitter, ParticleEmitterNode, Precipitation, Splash, Item, MissionMarker, SpawnSphere, CameraBookmark, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle.
Called when the object is removed from the sim.
Reimplemented from SceneObject. Reimplemented in PathedInterior, sgMissionLightingFilter, VolumeLight, Camera, Debris, Explosion, fxLight, Lightning, ParticleEmitter, ParticleEmitterNode, Precipitation, Splash, Item, MissionMarker, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle.
Called after any property of the object is changed in the world editor.
Reimplemented from SceneObject. Reimplemented in sgLightObject, sgMissionLightingFilter, VolumeLight, fxLight, Precipitation, MissionMarker, SpawnSphere, and CameraBookmark.
Register dynamic fields in a subclass of ConsoleObject.
Reimplemented from SceneObject. Reimplemented in PathedInterior, sgLightObject, sgMissionLightingFilter, VolumeLight, Camera, Debris, Explosion, fxLight, Lightning, ParticleEmitterNode, Precipitation, Item, MissionMarker, SpawnSphere, CameraBookmark, PathCamera, Projectile, RigidShape, StaticShape, Trigger, FlyingVehicle, Vehicle, and WheeledVehicle.
Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.
Reimplemented from ConsoleObject. Reimplemented in Camera, fxLight, Item, PathCamera, Player, and ShapeBase.
Assigns this object a datablock and loads attributes with onNewDataBlock.
Called when a new datablock is set. This allows subclasses to appropriately handle new datablocks.
Reimplemented in PathedInterior, sgLightObject, sgMissionLightingFilter, VolumeLight, Debris, Explosion, fxLight, Lightning, ParticleEmitter, ParticleEmitterNode, Precipitation, Splash, Item, MissionMarker, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle.
Executes the 'onAdd' script function for this object.
Executes the 'onNewDataBlock' script function for this object.
Executes the 'onRemove' script function for this object.
Set the status of tick processing. If this is set to true, processTick will be called; if false, then it will be skipped.
Force this object to process after some other object. For example, a player mounted to a vehicle would want to process after the vehicle, to prevent a visible "lagging" from occurring when the vehicle motions, so the player would be set to processAfter(theVehicle);
Clears the effects of a call to processAfter().
Reimplemented from ProcessObject.
Removes this object from the tick-processing list.
Processes a move event and updates object state once every 32 milliseconds. This takes place both on the client and server, every 32 milliseconds (1 tick).
Reimplemented in PathedInterior, sgLightObject, Camera, Debris, Explosion, fxLight, Lightning, ParticleEmitter, Precipitation, Splash, Item, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, Vehicle, and WheeledVehicle. Interpolates between tick events. This takes place on the CLIENT ONLY.
Reimplemented in Camera, Lightning, Precipitation, Item, PathCamera, Player, Projectile, RigidShape, StaticShape, and Vehicle. Advances simulation time for animations. This is called every frame.
Reimplemented in Debris, Explosion, Lightning, ParticleEmitter, ParticleEmitterNode, Splash, Item, Player, Projectile, RigidShape, ShapeBase, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle. Allow object a chance to tweak move before it is sent to client and server.
This returns a value which is used to prioritize which objects need to be updated. In NetObject, our returned priority is 0.1 * updateSkips, so that less recently updated objects are more likely to be updated. In subclasses, this can be adjusted. For instance, ShapeBase provides priority based on proximity to the camera.
Reimplemented from NetObject. Reimplemented in Projectile, and ShapeBase.
Instructs this object to pack its state for transfer over the network.
Reimplemented from NetObject. Reimplemented in PathedInterior, sgLightObject, sgMissionLightingFilter, VolumeLight, Camera, fxLight, Lightning, ParticleEmitterNode, Precipitation, Splash, Item, MissionMarker, SpawnSphere, CameraBookmark, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle.
Instructs this object to read state data previously packed with packUpdate.
Reimplemented from NetObject. Reimplemented in PathedInterior, sgLightObject, sgMissionLightingFilter, VolumeLight, Camera, fxLight, Lightning, ParticleEmitterNode, Precipitation, Splash, Item, MissionMarker, SpawnSphere, CameraBookmark, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle.
Write state information necessary to perform client side prediction of an object. This information is sent only to the controling object. For example, if you are a client controlling a Player, the server uses writePacketData() instead of packUpdate() to generate the data you receive.
Reimplemented in Camera, Player, RigidShape, ShapeBase, FlyingVehicle, Vehicle, and WheeledVehicle.
Read data written with writePacketData() and update the object state.
Reimplemented in Camera, Player, RigidShape, ShapeBase, FlyingVehicle, Vehicle, and WheeledVehicle.
Gets the checksum for packet data. Basically writes a packet, does a CRC check on it, and returns that CRC.
Returns the client controlling this object.
Sets the client controlling this object.
Reimplemented in Player.
Reimplemented in Camera, PathCamera, RigidShape, ShapeBase, and Vehicle.
Friends And Related Function Documentation
Reimplemented from ProcessObject.
Reimplemented from ProcessObject.
Member Data Documentation
Reimplemented in PathedInterior, sgLightObject, sgMissionLightingFilter, VolumeLight, Debris, Explosion, fxLight, Lightning, ParticleEmitter, ParticleEmitterNode, Precipitation, Splash, Item, MissionMarker, PathCamera, Player, Projectile, RigidShape, ShapeBase, StaticShape, Trigger, FlyingVehicle, HoverVehicle, Vehicle, and WheeledVehicle.
Should we render bounding boxes?
Reimplemented in ShapeBase.
|