My Project
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ParaEngine::CEmuCSParaEditGame Class Reference

emulating a client/server based ParaEngine world editing game, using NPL language. More...

#include <EmuCSParaEditGame.h>

Public Types

enum  CurrentState { STATE_STAND_ALONE = 0, STATE_SERVER, STATE_CLIENT }
 

Public Member Functions

CurrentState GetState ()
 get the current state More...
 
bool SetState (CurrentState state)
 set the current game engine states. More...
 
bool OnReceiveNPLPacket (NPL::NPLPacket *p)
 Whenever an NPL chat packet is received. More...
 
bool OnCenterUserLost (const char *sUserName)
 this function is called automatically by the NPL runtime, when a user is lost by the center More...
 
bool OnReceptorUserLost (const char *sUserName)
 this function is called automatically by the NPL runtime, when a user is lost by the receptor More...
 
bool SendTerrainUpdate (const string &sDestination, const D3DXVECTOR3 &vCenter, float fRadius, float fResolution=1.f)
 Call this function to send a copy of the local terrain to a destination world at a given resolution. More...
 
bool OnReceiveTerrainUpdate (NPL::NPLPacket *p)
 called when received a terrain update from the network. More...
 
void FrameMove ()
 this should be called every frame. More...
 

Static Public Member Functions

static CEmuCSParaEditGameGetInstance ()
 get the singleton instance. More...
 

Detailed Description

emulating a client/server based ParaEngine world editing game, using NPL language.

we might create other network application classes in future for truly distributed network logics. for simplicity, this class is for C/S only.

Member Function Documentation

§ FrameMove()

void CEmuCSParaEditGame::FrameMove ( )

this should be called every frame.

Internally, it may send certain network packages at some given rate.

§ GetInstance()

CEmuCSParaEditGame & CEmuCSParaEditGame::GetInstance ( )
static

get the singleton instance.

§ GetState()

CEmuCSParaEditGame::CurrentState CEmuCSParaEditGame::GetState ( )

get the current state

Returns

§ OnCenterUserLost()

bool ParaEngine::CEmuCSParaEditGame::OnCenterUserLost ( const char *  sUserName)

this function is called automatically by the NPL runtime, when a user is lost by the center

Parameters
sUserName
Returns

§ OnReceiveNPLPacket()

bool CEmuCSParaEditGame::OnReceiveNPLPacket ( NPL::NPLPacket *  p)

Whenever an NPL chat packet is received.

This function will call other handlers.

Returns
:true if the packet is successfully processed.

§ OnReceiveTerrainUpdate()

bool ParaEngine::CEmuCSParaEditGame::OnReceiveTerrainUpdate ( NPL::NPLPacket *  p)

called when received a terrain update from the network.

It will update the local global terrain data according to the received data.

Parameters
p
Returns

§ OnReceptorUserLost()

bool ParaEngine::CEmuCSParaEditGame::OnReceptorUserLost ( const char *  sUserName)

this function is called automatically by the NPL runtime, when a user is lost by the receptor

Parameters
sUserName
Returns

§ SendTerrainUpdate()

bool CEmuCSParaEditGame::SendTerrainUpdate ( const string &  sDestination,
const D3DXVECTOR3 &  vCenter,
float  fRadius,
float  fResolution = 1.f 
)

Call this function to send a copy of the local terrain to a destination world at a given resolution.

Parameters
sDestinationa destination name, it could be "all@server" or "@server", etc. This will be used to fill the destination address of the packet to be sent.
sSourcea source name, it could be "".
vCentercenter of the terrain region to send
fRadiusradius of the terrain region to send
fResolutionif this is 1.f, the local world terrain grid resolution is used.
Returns

§ SetState()

bool CEmuCSParaEditGame::SetState ( CurrentState  state)

set the current game engine states.

Returns
: true if successful.

The documentation for this class was generated from the following files: