My Project
|
this is the environment simulator of a standard game world server. More...
#include <EnvSimServer.h>
Public Member Functions | |
virtual SIMULATOR_TYPE | GetSimulatorType () |
return the current type of simulator. More... | |
virtual void | Animate (double dTimeDelta) |
called each frame to simulate the game world. More... | |
virtual void | CheckLoadPhysics (const D3DXVECTOR3 &vCenter, float fRadius) |
when this function is called, it ensures that the physics object around an object is properly loaded. More... | |
virtual void | Release () |
delete this object. More... | |
virtual CNetTime * | GetNetTime () |
get the net time object More... | |
bool | SendNormalUpdate (const string &id, NPL::CBitStream *s) |
send normal update information of an Other Player Character (OPC) to a given client. More... | |
bool | SendNormalUpdate (COPCBiped *pOPC, NPL::CBitStream *s) |
bool | OnReceiveNormalUpdate (const string &id, NPL::CBitStream *s) |
called when received normal update messages from a given client. More... | |
bool | SendCharacterUpdate (CBipedObject *pChar, CCharacterTracker *pCharTracker, NPL::CBitStream *s, const char *sIdentifier=NULL) |
send a block for just a single character. More... | |
IGameObject * | ReceiveCharacterUpdate (NPL::CBitStream *s, bool &bIsDifferentUpdate, const char *sIdentifier=NULL) |
receive a block of a single character. More... | |
![]() | |
virtual void | CheckLoadPhysics (CShapeSphere *points, int nPointCount=1)=0 |
when this function is called, it ensures that the physics object around one or more points are properly loaded. More... | |
void | CheckLoadPhysics (const Vector3 &vCenter, float fRadius) |
Static Public Member Functions | |
static bool | NetworkMoveCharacter (CBipedObject *pBiped, const D3DXVECTOR3 &vDest, float fFacing, float fSpeed, float fVerticalSpeed, bool bForceRun, bool bForceWalk) |
move a character. More... | |
![]() | |
static void | EnableLog (bool bWriteLog) |
static bool | IsLogEnabled () |
Additional Inherited Members | |
![]() | |
enum | SIMULATOR_TYPE { SIM_TYPE_STANDALONE = 0, SIM_TYPE_SERVER = 1, SIM_TYPE_CLIENT = 2 } |
this is the environment simulator of a standard game world server.
|
virtual |
called each frame to simulate the game world.
dTimeDelta | in seconds. |
time lag more than MAX_SIM_LAG(1) second will be detected by the environment simulator
advance the game time
Check load physics around the current player and the camera position this is very game specific. It only ensures that physics object around the current player and camera is loaded.
frame move each unexploded missile objects.
Implements ParaEngine::IEnvironmentSim.
|
virtual |
when this function is called, it ensures that the physics object around an object is properly loaded.
It increases the hit count of these physics objects by 1. The garbage collector in the physics world may use the hit count to move out unused static physics object from the physics scene. This function might be called for the current player, each active mobile object in the scene and the camera eye position.
vCenter | the center of the object in world coordinates |
fRadius | the radius of the object within which all physics object must be active. |
breadth first transversing the scene(the root tile is ignored) pTile is now the root tile. object attached to it are never rendered directly
add other tiles
rough culling algorithm using the quad tree terrain tiles test against a sphere round the eye
go down the quad tree terrain tile to render objects
even we know that the tile is empty, we still need to see if there is anything in the queueNode for rendering so when both queue are empty, we can exit the main rendering transversing loop
For each mesh physics object in the tile, load its physics.
|
inlinevirtual |
|
inlinevirtual |
return the current type of simulator.
0 means standalone simulator, 1 means server, 2 means client.
Implements ParaEngine::IEnvironmentSim.
|
static |
move a character.
vDest | the absolute solution from the last network. |
bForceRun | force using running animation. |
bForceWalk | force using walking animation. |
bool CEnvSimServer::OnReceiveNormalUpdate | ( | const string & | id, |
NPL::CBitStream * | s | ||
) |
called when received normal update messages from a given client.
id | the id of the player, from which the package is received. |
s | [in|out] the bit stream from which the data are read. |
IGameObject * CEnvSimServer::ReceiveCharacterUpdate | ( | NPL::CBitStream * | s, |
bool & | bIsDifferentUpdate, | ||
const char * | sIdentifier = NULL |
||
) |
receive a block of a single character.
s | |
IsDifferentUpdate | [out], if false, the same character might be updated multiple times in a single frame move. |
sIdentifier | if this is not NULL, the player ID read from s will be replaced by this one. so it will be this specified character that get updated. |
Group1 if any:
set perceptive radius for the character
Group2 if any:
in case character model has never been set before
|
virtual |
bool CEnvSimServer::SendCharacterUpdate | ( | CBipedObject * | pChar, |
CCharacterTracker * | pCharTracker, | ||
NPL::CBitStream * | s, | ||
const char * | sIdentifier = NULL |
||
) |
send a block for just a single character.
pChar | |
pCharTracker | it contains a history of values sent for the character. |
s | |
sIdentifier | if this is not NULL, the player ID of pChar will be replaced by this one. |
Header or group0: send if any of the following is true:
Group1: send if any of the following is true:
Group2: send if any of the following is true:
bool CEnvSimServer::SendNormalUpdate | ( | const string & | id, |
NPL::CBitStream * | s | ||
) |
send normal update information of an Other Player Character (OPC) to a given client.
a normal update usually contains the positions of all characters in the given character's perceptive radius. when a client receives such as package, it will use the information to update its local networked characters, as well as itself.
pOPC | pointer to an OPC player, to which the package is sent. |
s | [in|out] the bit stream to which the data are written. |