GameConnection
Engine/source/T3D/gameBase/gameConnection.h
Classes:
Client side first/third person
bool
Are we currently first person or not.
bool
Set to notify client or server of first person change.
bool
Set to notify server of camera FOV change.
Current camera fov (in degrees).
Current camera pos (0-1).
Camera in/out speed.
Optional client display device that imposes rendering properties.
Client side control scheme that may be referenced by control objects
bool
Set to notify client or server of control scheme change.
bool
Use absolute rotation values from client, likely through ExtendedMove.
bool
Add relative yaw control to the absolute rotation calculation. Only useful with mAbsoluteRotation.
bool
Add relative pitch control to the absolute rotation calculation. Only useful with mAbsoluteRotation.
Connection State
This data is set with setConnectArgs() and setJoinPassword(), and sent across the wire when we connect.
Protocol Versions
Protocol versions are used to indicated changes in network traffic.
These could be changes in how any object transmits or processes network information. You can specify backwards compatibility by specifying a MinRequireProtocolVersion. If the client protocol is >= this min value, the connection is accepted.
Torque (V12) SDK 1.0 uses protocol = 1
Torque SDK 1.1 uses protocol = 2 Torque SDK 1.4 uses protocol = 12
Flashing
Note, these variables are not networked, they are for the local connection only.
bool
Event Handling
onDisconnect(const char * reason)
onConnectionRejected(const char * reason)
onConnectionEstablished(bool isInitiator)
handleStartupError(const char * errorString)
Packet I/O
writeConnectRequest(BitStream * stream)
bool
readConnectRequest(BitStream * stream, const char ** errorString)
writeConnectAccept(BitStream * stream)
bool
readConnectAccept(BitStream * stream, const char ** errorString)
readPacket(BitStream * bstream)
writePacket(BitStream * bstream, PacketNotify * note)
packetReceived(PacketNotify * note)
packetDropped(PacketNotify * note)
connectionError(const char * errorString)
writeDemoStartBlock(ResizeBitStream * stream)
bool
readDemoStartBlock(BitStream * stream)
handleRecordedBlock(U32 type, U32 size, void * data)
Control object
bool
getControlCameraTransform(F32 dt, MatrixF * mat)
bool
getControlCameraVelocity(Point3F * vel)
bool
getControlCameraHeadTransform(IDisplayDevice * display, MatrixF * transform)
Returns the head transform for the control object, using supplemental information from the provided IDisplayDevice.
bool
getControlCameraEyeTransforms(IDisplayDevice * display, MatrixF * transforms)
Returns the eye transforms for the control object, using supplemental information from the provided IDisplayDevice.
bool
getControlCameraDefaultFov(F32 * fov)
bool
getControlCameraFov(F32 * fov)
bool
setControlCameraFov(F32 fov)
bool
setFirstPerson(bool firstPerson)
bool
setDisplayDevice(IDisplayDevice * display)
setControlSchemeParameters(bool absoluteRotation, bool addYawToAbsRot, bool addPitchToAbsRot)
Datablock management
Return the datablock sequence number that this game connection is on.
setDataBlockSequence(U32 seq)
Set the datablock sequence number.
Fade control
setBlackOut(bool fadeToBlack, S32 timeMS)
Sound
play2D(SFXProfile * profile)
play3D(SFXProfile * profile, const MatrixF * transform)
Misc.
Public Types
Constants { BlockTypeMove = NetConnectionBlockTypeCount GameConnectionBlockTypeCount MaxConnectArgs = 16 DataBlocksDone = NumConnectionMessages DataBlocksDownloadDone }
Configuration.
Private Types
Parent
Private Attributes
char
mDisconnectReason [256]
Public Static Attributes
Protected Attributes
bool
bool
Protected Static Attributes
Private Static Attributes
Public Functions
bool
Called when we finish downloading file data.
handleConnectionMessage(U32 message, U32 sequence, U32 ghostCount)
Handle message from sendConnectionMessage().
bool
bool
bool
onAdd()
Called when the object is added to the sim.
preloadDataBlock(SimDataBlock * block)
preloadNextDataBlock(bool hadNew)
repackClientDatablock(BitStream * , S32 start_pos)
saveDatablockCache(bool on_server)
setConnectArgs(U32 argc, const char ** argv)
Set connection arguments; these are passed to the server when we connect.
setDisconnectReason(const char * reason)
setJoinPassword(const char * password)
Set the server password to use when we join.
setServerCacheCRC(U32 crc)
setVisibleGhostDistance(F32 dist)
Protected Functions
DECLARE_CALLBACK(void , initialControlSet , () )
DECLARE_CALLBACK(void , onConnectionAccepted , () )
DECLARE_CALLBACK(void , onConnectionDropped , (const char *reason) )
DECLARE_CALLBACK(void , onConnectionError , (const char *errorString) )
DECLARE_CALLBACK(void , onConnectionTimedOut , () )
DECLARE_CALLBACK(void , onConnectRequestRejected , (const char *reason) )
DECLARE_CALLBACK(void , onConnectRequestTimedOut , () )
DECLARE_CALLBACK(void , onControlObjectChange , () )
DECLARE_CALLBACK(void , onDataBlocksDone , (U32 sequence) )
DECLARE_CALLBACK(void , onDrop , (const char *disconnectReason) )
DECLARE_CALLBACK(void , onFlash , (bool state) )
DECLARE_CALLBACK(void , setLagIcon , (bool state) )
ghostPreRead(NetObject * , bool newGhost)
ghostReadExtra(NetObject * , BitStream * , bool newGhost)
ghostWriteExtra(NetObject * , BitStream * )
Called when 'EndGhosting' message is received from server.
Detailed Description
Client side first/third person
bool mFirstPerson
Are we currently first person or not.
bool mUpdateFirstPerson
Set to notify client or server of first person change.
bool mUpdateCameraFov
Set to notify server of camera FOV change.
F32 mCameraFov
Current camera fov (in degrees).
F32 mCameraPos
Current camera pos (0-1).
F32 mCameraSpeed
Camera in/out speed.
IDisplayDevice * mDisplayDevice
Optional client display device that imposes rendering properties.
Client side control scheme that may be referenced by control objects
bool mUpdateControlScheme
Set to notify client or server of control scheme change.
bool mAbsoluteRotation
Use absolute rotation values from client, likely through ExtendedMove.
bool mAddYawToAbsRot
Add relative yaw control to the absolute rotation calculation. Only useful with mAbsoluteRotation.
bool mAddPitchToAbsRot
Add relative pitch control to the absolute rotation calculation. Only useful with mAbsoluteRotation.
Connection State
This data is set with setConnectArgs() and setJoinPassword(), and sent across the wire when we connect.
U32 mConnectArgc
char * mConnectArgv [MaxConnectArgs]
char * mJoinPassword
Protocol Versions
Protocol versions are used to indicated changes in network traffic.
These could be changes in how any object transmits or processes network information. You can specify backwards compatibility by specifying a MinRequireProtocolVersion. If the client protocol is >= this min value, the connection is accepted.
Torque (V12) SDK 1.0 uses protocol = 1
Torque SDK 1.1 uses protocol = 2 Torque SDK 1.4 uses protocol = 12
const U32 CurrentProtocolVersion
const U32 MinRequiredProtocolVersion
Flashing
F32 mDamageFlash
Note, these variables are not networked, they are for the local connection only.
F32 mWhiteOut
F32 mBlackOut
S32 mBlackOutTimeMS
S32 mBlackOutStartTimeMS
bool mFadeToBlack
Event Handling
onTimedOut()
Reimplemented from: NetConnection
onConnectTimedOut()
Reimplemented from: NetConnection
onDisconnect(const char * reason)
Reimplemented from: NetConnection
onConnectionRejected(const char * reason)
Reimplemented from: NetConnection
onConnectionEstablished(bool isInitiator)
Reimplemented from: NetConnection
handleStartupError(const char * errorString)
Reimplemented from: NetConnection
Packet I/O
writeConnectRequest(BitStream * stream)
Reimplemented from: NetConnection
readConnectRequest(BitStream * stream, const char ** errorString)
Reimplemented from: NetConnection
writeConnectAccept(BitStream * stream)
Reimplemented from: NetConnection
readConnectAccept(BitStream * stream, const char ** errorString)
Reimplemented from: NetConnection
readPacket(BitStream * bstream)
Reimplemented from: NetConnection
writePacket(BitStream * bstream, PacketNotify * note)
Reimplemented from: NetConnection
packetReceived(PacketNotify * note)
Reimplemented from: NetConnection
packetDropped(PacketNotify * note)
Reimplemented from: NetConnection
connectionError(const char * errorString)
Reimplemented from: NetConnection
writeDemoStartBlock(ResizeBitStream * stream)
Reimplemented from: NetConnection
readDemoStartBlock(BitStream * stream)
Reimplemented from: NetConnection
handleRecordedBlock(U32 type, U32 size, void * data)
Reimplemented from: NetConnection
Control object
setControlObject(GameBase * )
getControlObject()
getControlObject()
setCameraObject(GameBase * )
getCameraObject()
getControlCameraTransform(F32 dt, MatrixF * mat)
getControlCameraVelocity(Point3F * vel)
getControlCameraHeadTransform(IDisplayDevice * display, MatrixF * transform)
Returns the head transform for the control object, using supplemental information from the provided IDisplayDevice.
getControlCameraEyeTransforms(IDisplayDevice * display, MatrixF * transforms)
Returns the eye transforms for the control object, using supplemental information from the provided IDisplayDevice.
getControlCameraDefaultFov(F32 * fov)
getControlCameraFov(F32 * fov)
setControlCameraFov(F32 fov)
isValidControlCameraFov(F32 fov)
isControlObjectRotDampedCamera()
setFirstPerson(bool firstPerson)
hasDisplayDevice()
getDisplayDevice()
setDisplayDevice(IDisplayDevice * display)
clearDisplayDevice()
setControlSchemeParameters(bool absoluteRotation, bool addYawToAbsRot, bool addPitchToAbsRot)
getControlSchemeAbsoluteRotation()
getControlSchemeAddYawToAbsRot()
getControlSchemeAddPitchToAbsRot()
Datablock management
getDataBlockModifiedKey()
setDataBlockModifiedKey(S32 key)
getMaxDataBlockModifiedKey()
setMaxDataBlockModifiedKey(S32 key)
getDataBlockSequence()
Return the datablock sequence number that this game connection is on.
The datablock sequence number is synchronized to the mission sequence number on each datablock transmission.
setDataBlockSequence(U32 seq)
Set the datablock sequence number.
Fade control
getDamageFlash()
getWhiteOut()
setBlackOut(bool fadeToBlack, S32 timeMS)
getBlackOut()
Authentication
This is remnant code from Tribes 2.
setAuthInfo(const AuthInfo * info)
getAuthInfo()
Sound
play2D(SFXProfile * profile)
play3D(SFXProfile * profile, const MatrixF * transform)
Misc.
isFirstPerson()
isAIControlled()
doneScopingScene()
Reimplemented from: NetConnection
demoPlaybackComplete()
Reimplemented from: NetConnection
setMissionCRC(U32 crc)
getMissionCRC()
Public Types
Constants
Enumerator
- BlockTypeMove = NetConnectionBlockTypeCount
- GameConnectionBlockTypeCount
- MaxConnectArgs = 16
- DataBlocksDone = NumConnectionMessages
- DataBlocksDownloadDone
Configuration.
Private Types
typedef NetConnection Parent
Private Attributes
BitStream * client_db_stream
SimObjectPtr< GameBase > mCameraObject
SimObjectPtr< GameBase > mControlObject
S32 mDataBlockModifiedKey
U32 mDataBlockSequence
char mDisconnectReason [256]
U32 mLastControlRequestTime
S32 mMaxDataBlockModifiedKey
U32 mMissionCRC
F32 mVisibleGhostDistance
U32 server_cache_CRC
Public Static Attributes
Signal< void(F32)> smFovUpdate
Signal< void()> smPlayingDemo
Protected Attributes
bool mAIControlled
AuthInfo * mAuthInfo
bool mControlForceMismatch
Vector< SimDataBlock * > mDataBlockLoadList
bool mLagging
S32 mLastPacketTime
Public Attributes
MoveList * mMoveList
Protected Static Attributes
S32 mLagThresholdMS
Private Static Attributes
StringTableEntry client_cache_filename
bool client_cache_on
StringTableEntry server_cache_filename
bool server_cache_on
Public Functions
GameConnection()
~GameConnection()
canRemoteCreate()
Reimplemented from: NetConnection
DECLARE_CONOBJECT(GameConnection )
detectLag()
fileDownloadSegmentComplete()
Reimplemented from: NetConnection
getVisibleGhostDistance()
handleConnectionMessage(U32 message, U32 sequence, U32 ghostCount)
Reimplemented from: NetConnection
loadDatablockCache()
loadDatablockCache_Begin()
loadDatablockCache_Continue()
onAdd()
Reimplemented from: SimObject
onRemove()
Reimplemented from: NetConnection
preloadDataBlock(SimDataBlock * block)
preloadNextDataBlock(bool hadNew)
repackClientDatablock(BitStream * , S32 start_pos)
restoreStringBuffering(BitStream * bs)
saveDatablockCache(bool on_server)
setConnectArgs(U32 argc, const char ** argv)
Set connection arguments; these are passed to the server when we connect.
setDisconnectReason(const char * reason)
setJoinPassword(const char * password)
Set the server password to use when we join.
setServerCacheCRC(U32 crc)
setVisibleGhostDistance(F32 dist)
tempDisableStringBuffering(BitStream * bs)
Protected Functions
allocNotify()
Reimplemented from: NetConnection
DECLARE_CALLBACK(void , initialControlSet , () )
DECLARE_CALLBACK(void , onConnectionAccepted , () )
DECLARE_CALLBACK(void , onConnectionDropped , (const char *reason) )
DECLARE_CALLBACK(void , onConnectionError , (const char *errorString) )
DECLARE_CALLBACK(void , onConnectionTimedOut , () )
DECLARE_CALLBACK(void , onConnectRequestRejected , (const char *reason) )
DECLARE_CALLBACK(void , onConnectRequestTimedOut , () )
DECLARE_CALLBACK(void , onControlObjectChange , () )
DECLARE_CALLBACK(void , onDataBlocksDone , (U32 sequence) )
DECLARE_CALLBACK(void , onDrop , (const char *disconnectReason) )
DECLARE_CALLBACK(void , onFlash , (bool state) )
DECLARE_CALLBACK(void , setLagIcon , (bool state) )
ghostPreRead(NetObject * , bool newGhost)
Reimplemented from: NetConnection
ghostReadExtra(NetObject * , BitStream * , bool newGhost)
Reimplemented from: NetConnection
ghostWriteExtra(NetObject * , BitStream * )
Reimplemented from: NetConnection
onEndGhosting()
Reimplemented from: NetConnection
Public Static Functions
clientCacheEnabled()
clientCacheFilename()
consoleInit()
getConnectionToServer()
getLocalClientConnection()
resetDatablockCache()
serverCacheEnabled()
serverCacheFilename()