torque Torque Game Engine Documentation
TGE Version 1.5.2

GameConnection Class Reference

#include <gameConnection.h>

Inheritance diagram for GameConnection:

Inheritance graph
[legend]

Public Types

enum  Constants {
  BlockTypeMove = NetConnectionBlockTypeCount,
  GameConnectionBlockTypeCount,
  MaxConnectArgs = 16,
  DataBlocksDone = NumConnectionMessages,
  DataBlocksDownloadDone
}
 Configuration. More...

Public Member Functions

void setConnectArgs (U32 argc, const char **argv)
 Set connection arguments; these are passed to the server when we connect.
void setJoinPassword (const char *password)
 Set the server password to use when we join.
bool canRemoteCreate ()
 DECLARE_CONOBJECT (GameConnection)
void handleConnectionMessage (U32 message, U32 sequence, U32 ghostCount)
 Handle message from sendConnectionMessage().
void preloadDataBlock (SimDataBlock *block)
void fileDownloadSegmentComplete ()
 Called when we finish downloading file data.
void preloadNextDataBlock (bool hadNew)
void setDisconnectReason (const char *reason)
 GameConnection ()
 ~GameConnection ()
U32 getDataBlockSequence ()
void setDataBlockSequence (U32 seq)
bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
void detectLag ()
Event Handling
virtual void onTimedOut ()
virtual void onConnectTimedOut ()
virtual void onDisconnect (const char *reason)
virtual void onConnectionRejected (const char *reason)
virtual void onConnectionEstablished (bool isInitiator)
virtual void handleStartupError (const char *errorString)
Packet I/O
virtual void writeConnectRequest (BitStream *stream)
virtual bool readConnectRequest (BitStream *stream, const char **errorString)
virtual void writeConnectAccept (BitStream *stream)
virtual bool readConnectAccept (BitStream *stream, const char **errorString)
Control object
void setControlObject (ShapeBase *co)
ShapeBasegetControlObject ()
void setCameraObject (ShapeBase *co)
ShapeBasegetCameraObject ()
bool getControlCameraTransform (F32 dt, MatrixF *mat)
bool getControlCameraVelocity (Point3F *vel)
bool getControlCameraFov (F32 *fov)
bool setControlCameraFov (F32 fov)
bool isValidControlCameraFov (F32 fov)
void setFirstPerson (bool firstPerson)
Datablock management
S32 getDataBlockModifiedKey ()
void setDataBlockModifiedKey (S32 key)
S32 getMaxDataBlockModifiedKey ()
void setMaxDataBlockModifiedKey (S32 key)
Fade control
F32 getDamageFlash ()
F32 getWhiteOut ()
void setBlackOut (bool fadeToBlack, S32 timeMS)
F32 getBlackOut ()
Move Management
void pushMove (const Move &mv)
bool getNextMove (Move &curMove)
bool isBacklogged ()
virtual void getMoveList (Move **, U32 *numMoves)
virtual void clearMoves (U32 count)
void collectMove (U32 simTime)
virtual bool areMovesPending ()
void incMoveCredit (U32 count)
Authentication
This is remnant code from Tribes 2.

void setAuthInfo (const AuthInfo *info)
const AuthInfogetAuthInfo ()
Sound
void play2D (const AudioProfile *profile)
void play3D (const AudioProfile *profile, const MatrixF *transform)
Misc.
bool isFirstPerson ()
bool isAIControlled ()
void doneScopingScene ()
 Called when we're done with normal scoping.
void demoPlaybackComplete ()
void setMissionCRC (U32 crc)
U32 getMissionCRC ()

Static Public Member Functions

static void consoleInit ()
 Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.
static GameConnectiongetConnectionToServer ()
static GameConnectiongetLocalClientConnection ()

Static Public Attributes

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

static const U32 CurrentProtocolVersion
static const U32 MinRequiredProtocolVersion

Protected Member Functions

PacketNotify * allocNotify ()
 Get a free Notify structure.
Packet I/O
void readPacket (BitStream *bstream)
void writePacket (BitStream *bstream, PacketNotify *note)
void packetReceived (PacketNotify *note)
void packetDropped (PacketNotify *note)
void connectionError (const char *errorString)
void writeDemoStartBlock (ResizeBitStream *stream)
bool readDemoStartBlock (BitStream *stream)
void handleRecordedBlock (U32 type, U32 size, void *data)

Protected Attributes

U32 mLastMoveAck
U32 mLastClientMove
U32 mFirstMoveIndex
U32 mMoveCredit
U32 mLastControlObjectChecksum
Vector< SimDataBlock * > mDataBlockLoadList
MoveList mMoveList
bool mAIControlled
AuthInfomAuthInfo
S32 mLastPacketTime
bool mLagging
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

Static Protected Attributes

static S32 mLagThresholdMS

Private Types

enum  PrivateConstants {
  MoveCountBits = 5,
  MaxMoveCount = 30
}
typedef NetConnection Parent
typedef Vector< MoveMoveList

Private Member Functions

Move Packets
Write/read move data to the packet.

void moveWritePacket (BitStream *bstream)
void moveReadPacket (BitStream *bstream)

Private Attributes

SimObjectPtr< ShapeBasemControlObject
SimObjectPtr< ShapeBasemCameraObject
U32 mDataBlockSequence
char mDisconnectReason [256]
U32 mMissionCRC
U32 mLastControlRequestTime
S32 mDataBlockModifiedKey
S32 mMaxDataBlockModifiedKey
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.
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

Data Structures

struct  GamePacketNotify

Member Typedef Documentation

Reimplemented from NetConnection.

Reimplemented in AIClient, and AIConnection.

typedef Vector<Move> GameConnection::MoveList [private]


Member Enumeration Documentation

Enumerator:
MoveCountBits 
MaxMoveCount  MaxMoveCount should not exceed the MoveManager's own maximum (MaxMoveQueueSize).

Configuration.

Enumerator:
BlockTypeMove 
GameConnectionBlockTypeCount 
MaxConnectArgs 
DataBlocksDone 
DataBlocksDownloadDone 

Reimplemented from NetConnection.


Constructor & Destructor Documentation

GameConnection::GameConnection (  ) 

GameConnection::~GameConnection (  ) 


Member Function Documentation

void GameConnection::moveWritePacket ( BitStream bstream  )  [private]

void GameConnection::moveReadPacket ( BitStream bstream  )  [private]

void GameConnection::setConnectArgs ( U32  argc,
const char **  argv 
)

Set connection arguments; these are passed to the server when we connect.

void GameConnection::setJoinPassword ( const char *  password  ) 

Set the server password to use when we join.

virtual void GameConnection::onTimedOut (  )  [virtual]

Reimplemented from NetConnection.

virtual void GameConnection::onConnectTimedOut (  )  [virtual]

Reimplemented from NetConnection.

virtual void GameConnection::onDisconnect ( const char *  reason  )  [virtual]

Reimplemented from NetConnection.

virtual void GameConnection::onConnectionRejected ( const char *  reason  )  [virtual]

Reimplemented from NetConnection.

virtual void GameConnection::onConnectionEstablished ( bool  isInitiator  )  [virtual]

Reimplemented from NetConnection.

virtual void GameConnection::handleStartupError ( const char *  errorString  )  [virtual]

Reimplemented from NetConnection.

virtual void GameConnection::writeConnectRequest ( BitStream stream  )  [virtual]

Reimplemented from NetConnection.

virtual bool GameConnection::readConnectRequest ( BitStream stream,
const char **  errorString 
) [virtual]

Reimplemented from NetConnection.

virtual void GameConnection::writeConnectAccept ( BitStream stream  )  [virtual]

Reimplemented from NetConnection.

virtual bool GameConnection::readConnectAccept ( BitStream stream,
const char **  errorString 
) [virtual]

Reimplemented from NetConnection.

bool GameConnection::canRemoteCreate (  )  [virtual]

Reimplemented from NetConnection.

PacketNotify* GameConnection::allocNotify (  )  [protected, virtual]

Get a free Notify structure.

Reimplemented from NetConnection.

void GameConnection::readPacket ( BitStream bstream  )  [protected, virtual]

Reimplemented from NetConnection.

void GameConnection::writePacket ( BitStream bstream,
PacketNotify *  note 
) [protected]

void GameConnection::packetReceived ( PacketNotify *  note  )  [protected]

void GameConnection::packetDropped ( PacketNotify *  note  )  [protected]

void GameConnection::connectionError ( const char *  errorString  )  [protected, virtual]

Reimplemented from NetConnection.

void GameConnection::writeDemoStartBlock ( ResizeBitStream stream  )  [protected, virtual]

Reimplemented from NetConnection.

bool GameConnection::readDemoStartBlock ( BitStream stream  )  [protected, virtual]

Reimplemented from NetConnection.

void GameConnection::handleRecordedBlock ( U32  type,
U32  size,
void data 
) [protected, virtual]

Reimplemented from NetConnection.

GameConnection::DECLARE_CONOBJECT ( GameConnection   ) 

void GameConnection::handleConnectionMessage ( U32  message,
U32  sequence,
U32  ghostCount 
) [virtual]

Handle message from sendConnectionMessage().

This is called to handle messages sent via sendConnectionMessage.

Parameters:
message One of GhostStates
sequence A sequence number, if any.
ghostCount A count of ghosts relating to this message.

Reimplemented from NetConnection.

void GameConnection::preloadDataBlock ( SimDataBlock block  ) 

void GameConnection::fileDownloadSegmentComplete (  )  [virtual]

Called when we finish downloading file data.

Reimplemented from NetConnection.

void GameConnection::preloadNextDataBlock ( bool  hadNew  ) 

static void GameConnection::consoleInit (  )  [static]

Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.

Deprecated:
You should use ConsoleMethod and ConsoleFunction, not this, to register methods or commands.
See also:
console

Reimplemented from NetConnection.

void GameConnection::setDisconnectReason ( const char *  reason  ) 

U32 GameConnection::getDataBlockSequence (  )  [inline]

void GameConnection::setDataBlockSequence ( U32  seq  )  [inline]

bool GameConnection::onAdd (  )  [virtual]

Called when the object is added to the sim.

Reimplemented from SimObject.

void GameConnection::onRemove (  )  [virtual]

Called when the object is removed from the sim.

Reimplemented from NetConnection.

static GameConnection* GameConnection::getConnectionToServer (  )  [inline, static]

Reimplemented from NetConnection.

static GameConnection* GameConnection::getLocalClientConnection (  )  [inline, static]

Reimplemented from NetConnection.

void GameConnection::setControlObject ( ShapeBase co  ) 

ShapeBase* GameConnection::getControlObject (  )  [inline]

void GameConnection::setCameraObject ( ShapeBase co  ) 

ShapeBase* GameConnection::getCameraObject (  ) 

bool GameConnection::getControlCameraTransform ( F32  dt,
MatrixF mat 
)

bool GameConnection::getControlCameraVelocity ( Point3F vel  ) 

bool GameConnection::getControlCameraFov ( F32 fov  ) 

bool GameConnection::setControlCameraFov ( F32  fov  ) 

bool GameConnection::isValidControlCameraFov ( F32  fov  ) 

void GameConnection::setFirstPerson ( bool  firstPerson  ) 

void GameConnection::detectLag (  ) 

S32 GameConnection::getDataBlockModifiedKey (  )  [inline]

void GameConnection::setDataBlockModifiedKey ( S32  key  )  [inline]

S32 GameConnection::getMaxDataBlockModifiedKey (  )  [inline]

void GameConnection::setMaxDataBlockModifiedKey ( S32  key  )  [inline]

F32 GameConnection::getDamageFlash (  )  [inline]

F32 GameConnection::getWhiteOut (  )  [inline]

void GameConnection::setBlackOut ( bool  fadeToBlack,
S32  timeMS 
)

F32 GameConnection::getBlackOut (  ) 

void GameConnection::pushMove ( const Move mv  ) 

bool GameConnection::getNextMove ( Move curMove  ) 

bool GameConnection::isBacklogged (  ) 

virtual void GameConnection::getMoveList ( Move **  ,
U32 numMoves 
) [virtual]

Reimplemented in AIClient, and AIConnection.

virtual void GameConnection::clearMoves ( U32  count  )  [virtual]

Reimplemented in AIConnection.

void GameConnection::collectMove ( U32  simTime  ) 

virtual bool GameConnection::areMovesPending (  )  [virtual]

void GameConnection::incMoveCredit ( U32  count  ) 

void GameConnection::setAuthInfo ( const AuthInfo info  ) 

const AuthInfo* GameConnection::getAuthInfo (  ) 

void GameConnection::play2D ( const AudioProfile profile  ) 

void GameConnection::play3D ( const AudioProfile profile,
const MatrixF transform 
)

bool GameConnection::isFirstPerson (  )  [inline]

bool GameConnection::isAIControlled (  )  [inline]

void GameConnection::doneScopingScene (  )  [virtual]

Called when we're done with normal scoping.

This gives subclasses a chance to shove things into scope, such as the results of a sensor network calculation, that would otherwise be awkward to add.

Reimplemented from NetConnection.

void GameConnection::demoPlaybackComplete (  )  [virtual]

Reimplemented from NetConnection.

void GameConnection::setMissionCRC ( U32  crc  )  [inline]

U32 GameConnection::getMissionCRC (  )  [inline]


Field Documentation

char GameConnection::mDisconnectReason[256] [private]

Are we currently first person or not.

Set to notify client or server of first person change.

Set to notify server of camera FOV change.

Current camera fov (in degrees).

Current camera pos (0-1).

Camera in/out speed.

char* GameConnection::mConnectArgv[MaxConnectArgs] [private]

S32 GameConnection::mLagThresholdMS [static, protected]

bool GameConnection::mLagging [protected]

Note, these variables are not networked, they are for the local connection only.

bool GameConnection::mFadeToBlack [protected]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen