Cafu Engine
CaServerWorldT Class Reference
Inheritance diagram for CaServerWorldT:

Public Member Functions

 CaServerWorldT (const char *FileName, ModelManagerT &ModelMan, cf::GuiSys::GuiResourcesT &GuiRes)
 
void RemoveEntity (unsigned long EntityID)
 Removes the entity identified by 'EntityID' from the (server) world. More...
 
unsigned long InsertHumanPlayerEntityForNextFrame (const char *PlayerName, const char *ModelName, unsigned long ClientInfoNr)
 
void NotifyHumanPlayerEntityOfClientCommand (unsigned long HumanPlayerEntityID, const PlayerCommandT &PlayerCommand)
 
unsigned long WriteClientNewBaseLines (unsigned long OldBaseLineFrameNr, ArrayT< ArrayT< char > > &OutDatas) const
 
void WriteClientDeltaUpdateMessages (const ClientInfoT &ClientInfo, NetDataT &OutData) const
 This method writes a delta update message for the given client into the given OutData. More...
 
void Think (float FrameTime)
 This method advances the world over the given time FrameTime into the next state. More...
 
void UpdateFrameInfo (ClientInfoT &ClientInfo) const
 This method must be called after Think() for each client: It updates the client's frame info corresponding to the the new/current server frame. More...
 
- Public Member Functions inherited from Ca3DEWorldT
 Ca3DEWorldT (const char *FileName, ModelManagerT &ModelMan, cf::GuiSys::GuiResourcesT &GuiRes, bool InitForGraphics, WorldT::ProgressFunctionT ProgressFunction)
 
const WorldTGetWorld () const
 
Vector3fT GetAmbientLightColorFromBB (const BoundingBox3T< double > &Dimensions, const VectorT &Origin) const
 Returns a "good" ambient light color for an arbitrary object (i.e. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Ca3DEWorldT
void CreateNewEntityFromBasicInfo (IntrusivePtrT< cf::GameSys::EntityT > Ent, unsigned long CreationFrameNr)
 Creates a new entity that is added to the m_EngineEntities array. More...
 
- Protected Attributes inherited from Ca3DEWorldT
const WorldTm_World
 
cf::ClipSys::ClipWorldTm_ClipWorld
 
PhysicsWorldT m_PhysicsWorld
 
cf::UniScriptStateTm_ScriptState
 
IntrusivePtrT
< cf::GameSys::WorldT
m_ScriptWorld
 The "script world" contains the entity hierarchy and their components. More...
 
ArrayT< EngineEntityT * > m_EngineEntities
 

Member Function Documentation

void CaServerWorldT::RemoveEntity ( unsigned long  EntityID)

Removes the entity identified by 'EntityID' from the (server) world.

void CaServerWorldT::Think ( float  FrameTime)

This method advances the world over the given time FrameTime into the next state.

That is, time FrameTime is applied to all entities in m_EngineEntities in order to compute the next state, advancing the m_ServerFrameNr by one.

void CaServerWorldT::UpdateFrameInfo ( ClientInfoT ClientInfo) const

This method must be called after Think() for each client: It updates the client's frame info corresponding to the the new/current server frame.

The previous call to Think() brought the entire world (all m_EngineEntities) into the new state with number m_ServerFrameNr. The ClientInfoT instances however know at this time nothing about the new state. Calling this method updates a client's frame info (the list of entities that are relevant for the client in the new frame) accordingly.

void CaServerWorldT::WriteClientDeltaUpdateMessages ( const ClientInfoT ClientInfo,
NetDataT OutData 
) const

This method writes a delta update message for the given client into the given OutData.

Note that this method must only be called after UpdateFrameInfo() has been called, because it relies on the client's frame info being up-to-date for the current frame!

The message consist of an SC1_FrameInfo header and all SC1_EntityUpdate and SC1_EntityRemove (sub-)messages as required for the client to reconstruct the current frame.


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