Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ONE::network::Server Class Reference

Inheritance diagram for ONE::network::Server:

Inheritance graph
[legend]
List of all members.

Detailed Description

a server that allows multiplayer gaming

Author:
Henning Hamer


Public Member Functions

int addSyncable (Syncable *_syncableP)
 Add a Syncable in order to synchronize it across the network.
void addSyncables (Array< Syncable * > _syncablePArray)
 Add several Syncables in order to synchronize them across the network.
void broadcastScriptEvent (int _identifier, const string &_param)
 Can be used when a script is not executed on the clients.
void doNetwork ()
 Main method of the server. Must be called from main loop.
bool getAllClientsReady ()
 Indicates if the game can begin.
void getAllPlayerIDs (Array< int > &ids)
int getConnectedClientsAmount ()
 Returns the amount of connected clients.
SyncableMapgetSyncableMapP ()
 Returns a pointer to the server's syncableMap.
void removeSyncable (Syncable *_syncableP)
 Removes a Syncable from the server and all clients.
void removeSyncables (Array< Syncable * > _syncablePArray)
 Removes the Syncables from the server and all clients.
void sendScriptEventToClient (int _syncableID, int _identifier, const string &_param)
 Can be used to notify a client about reached checkpoints and similar events.
void setBlockNewClients (bool _blockNewClients)
 Stops more clients from connecting.
void setContext (NetworkDevice *_networkDeviceP, Log *_networkLogP, Logic *_logicP, DiscoverySettings *_discoverySettingsP)
 Prepares the server for use.
void shutDown ()
 Shuts down the server. Can be called several times.
void startUp (DiscoveryAdvertisement *_discoveryAdvertisementP, int _portNumber, int _maxPlayers)
 Method to start the server. Don't call a second time before shutting down first.
void updateAllSyncables ()
 Causes the properties of all added Syncables to be broadcastet.
void updateAllSyncableStates ()
 Causes the state of all added Syncables to get broadcastet.
void updateLogic ()
 Synchronizes the state of the Logic class across the network (example: who is leading the race?).
void updateSyncable (Syncable *_syncableP)
 Synchronizes the properties of an added Syncable via a MessageCreateSyncable.
void updateSyncables (Array< Syncable * > _syncablePArray)
 Causes the properties of the Syncables to be broadcastet.
void updateSyncableState (Syncable *_syncableP)
 Synchronizes only the state of an added Entity via a MessageSyncableState.
void updateSyncableStates (Array< Syncable * > _syncablePArray)
 Causes the state of the Syncables to get broadcastet.

Static Public Member Functions

static void createInstance ()
 creates the singleton instance
static void destroyInstance ()
 destroys the singleton instance
static ServergetInstance ()
 accesses the singleton instance
static bool isActive ()
 checks if the singleton is active
static bool isDestroyed ()
 checks if the singleton is destroyed
static bool isVirgin ()
 checks if the singleton has not been initialized

Protected Member Functions

 Singleton ()

Static Protected Member Functions

static void destroyedError ()
static void initInstance ()

Friends

class Client


Member Function Documentation

int ONE::network::Server::addSyncable Syncable _syncableP  ) 
 

Add a Syncable in order to synchronize it across the network.

called by 1. acceptIncomingClient - for adding a special Entity: PlayerEntitiy 2. non network class - for adding a normal Entity

Parameters:
_syncableP pointer to a Syncable to be synchronized over the network
Returns:
the assigned syncableID

void ONE::network::Server::addSyncables Array< Syncable * >  _syncablePArray  ) 
 

Add several Syncables in order to synchronize them across the network.

Parameters:
_syncablePArray array of Syncable pointers to be synchronized over the network

void ONE::network::Server::broadcastScriptEvent int  _identifier,
const string &  _param
 

Can be used when a script is not executed on the clients.

Parameters:
_identifier indicates the type of script event
_param the parameters for the script event

static void ONE::util::Manual< Server >::createInstance  )  [static, inherited]
 

creates the singleton instance

static void ONE::util::Manual< Server >::destroyedError  )  [static, protected, inherited]
 

static void ONE::util::Manual< Server >::destroyInstance  )  [static, inherited]
 

destroys the singleton instance

void ONE::network::Server::doNetwork  ) 
 

Main method of the server. Must be called from main loop.

bool ONE::network::Server::getAllClientsReady  ) 
 

Indicates if the game can begin.

return true when all connected clients are ready for a game

void ONE::network::Server::getAllPlayerIDs Array< int > &  ids  ) 
 

int ONE::network::Server::getConnectedClientsAmount  ) 
 

Returns the amount of connected clients.

Returns:
the amount of connected clients

static Server * ONE::util::Singleton< Server , Manual >::getInstance  )  [static, inherited]
 

accesses the singleton instance

The exact operation executed by calling this function is determined by the singleton policies.

Returns:
a pointer to the singleton instance

SyncableMap* ONE::network::Server::getSyncableMapP  ) 
 

Returns a pointer to the server's syncableMap.

Returns:
pointer to the server's syncableMap

static void ONE::util::Manual< Server >::initInstance  )  [static, protected, inherited]
 

static bool ONE::util::Singleton< Server , Manual >::isActive  )  [static, inherited]
 

checks if the singleton is active

Returns:
if the singleton is instantiated

static bool ONE::util::Singleton< Server , Manual >::isDestroyed  )  [static, inherited]
 

checks if the singleton is destroyed

This function returns true if an instance existed and was destroyed. Note that in some cases it is possible to revive a singleton.

Returns:
if the singleton is destroyed

static bool ONE::util::Singleton< Server , Manual >::isVirgin  )  [static, inherited]
 

checks if the singleton has not been initialized

A singleton is not initialized if no instance exists and no instance has been destroyed.

Returns:
if the singleton is untouched

void ONE::network::Server::removeSyncable Syncable _syncableP  ) 
 

Removes a Syncable from the server and all clients.

Parameters:
_syncableP pointer to a Syncable

void ONE::network::Server::removeSyncables Array< Syncable * >  _syncablePArray  ) 
 

Removes the Syncables from the server and all clients.

Parameters:
_syncablePArray array of Syncable pointers

void ONE::network::Server::sendScriptEventToClient int  _syncableID,
int  _identifier,
const string &  _param
 

Can be used to notify a client about reached checkpoints and similar events.

Parameters:
_syncableID Owner of the UserEntity with this ID is the receiver
_identifier indicates the type of script event
_param the parameters for the script event

void ONE::network::Server::setBlockNewClients bool  _blockNewClients  ) 
 

Stops more clients from connecting.

Parameters:
_blockNewClients false, when no more clients may connect

void ONE::network::Server::setContext NetworkDevice *  _networkDeviceP,
Log *  _networkLogP,
Logic _logicP,
DiscoverySettings *  _discoverySettingsP
 

Prepares the server for use.

Sets the state of the server so that is can function properly

Parameters:
_networkDeviceP pointer to a NetworkDevice.
_networkLogP pointer to a Log.
_logicP Pointer to a Logic.

void ONE::network::Server::shutDown  ) 
 

Shuts down the server. Can be called several times.

ONE::util::Singleton< Server , Manual >::Singleton  )  [protected, inherited]
 

void ONE::network::Server::startUp DiscoveryAdvertisement *  _discoveryAdvertisementP,
int  _portNumber,
int  _maxPlayers
 

Method to start the server. Don't call a second time before shutting down first.

Parameters:
_discoveryAdvertisementP contains the information broadcasted by the DiscoveryServer
_portNumber the desired game port
_maxPlayers limits the allowed number of players. _maxPlayers=1 means single player mode

void ONE::network::Server::updateAllSyncables  ) 
 

Causes the properties of all added Syncables to be broadcastet.

void ONE::network::Server::updateAllSyncableStates  ) 
 

Causes the state of all added Syncables to get broadcastet.

void ONE::network::Server::updateLogic  ) 
 

Synchronizes the state of the Logic class across the network (example: who is leading the race?).

void ONE::network::Server::updateSyncable Syncable _syncableP  ) 
 

Synchronizes the properties of an added Syncable via a MessageCreateSyncable.

Parameters:
_syncableP pointer to a Syncable

void ONE::network::Server::updateSyncables Array< Syncable * >  _syncablePArray  ) 
 

Causes the properties of the Syncables to be broadcastet.

Parameters:
_syncablePArray array of Syncable pointers

void ONE::network::Server::updateSyncableState Syncable _syncableP  ) 
 

Synchronizes only the state of an added Entity via a MessageSyncableState.

Parameters:
_syncableP pointer to a Syncable

void ONE::network::Server::updateSyncableStates Array< Syncable * >  _syncablePArray  ) 
 

Causes the state of the Syncables to get broadcastet.

Parameters:
_syncablePArray array of Syncable pointers


Friends And Related Function Documentation

friend class Client [friend]
 


Generated on Wed Sep 7 19:03:25 2005 for ONEngine by  doxygen 1.4.3