![]() |
Public API Reference |
This is an interface you should implement in order to manage the events from the factory of game sessions. More...
#include <physicallayer/network.h>
Public Member Functions | |
| virtual void | GameInfoReceived (celGameInfo *game_info, csTicks server_latency) |
| The game factory is searching for available games (it has been started with iCelGameFactory::StartSearchForGameList), and a game has been found. | |
| virtual csPtr< iCelDataBuffer > | GetClientEventBaseline (celClientEventType event_type) |
| Return the baseline of a client event. | |
| virtual csPtr< iCelDataBuffer > | GetNetworkLinkBaseline (celNetworkLinkType link_type) |
| Return the baseline of a network link. | |
| virtual csPtr< iCelDataBuffer > | GetServerEventBaseline (celServerEventType event_type) |
| Return the baseline of a server event. | |
| virtual bool | InitClient (iCelGame *game) |
| A client is created and has to be initialized. | |
| virtual bool | InitServer (iCelGame *game) |
| A server is created and has to be initialized. | |
| virtual void | ServerNetworkStateChanged (celServerNetworkState new_state, celServerNetworkState previous_state, const char *reason="")=0 |
| The state of the network connection from the client to the server has changed. | |
This is an interface you should implement in order to manage the events from the factory of game sessions.
You can use it to:
| virtual void celGameFactoryManager::GameInfoReceived | ( | celGameInfo * | game_info, |
| csTicks | server_latency | ||
| ) | [inline, virtual] |
The game factory is searching for available games (it has been started with iCelGameFactory::StartSearchForGameList), and a game has been found.
| game_info | the info of the game. |
| server_latency | an estimation of the latency of the network connection from this client to the server. |
| virtual csPtr<iCelDataBuffer> celGameFactoryManager::GetClientEventBaseline | ( | celClientEventType | event_type | ) | [inline, virtual] |
Return the baseline of a client event.
Baselines are the default types and values of the fields of an event. They are used to limit the network traffic by delta-compression and by allowing the system to not be forced to send the types of the data.
It is not obligatory to provide the baselines and this function can return 0, but this can result in some network overhead.
| virtual csPtr<iCelDataBuffer> celGameFactoryManager::GetNetworkLinkBaseline | ( | celNetworkLinkType | link_type | ) | [inline, virtual] |
| virtual csPtr<iCelDataBuffer> celGameFactoryManager::GetServerEventBaseline | ( | celServerEventType | event_type | ) | [inline, virtual] |
| virtual bool celGameFactoryManager::InitClient | ( | iCelGame * | game | ) | [inline, virtual] |
A client is created and has to be initialized.
The iCelGameClient object is accessible from the iCelGame object.
You should create here a physical layer which will be the copy of the physical layer of the server. You should wait for network links from the server before adding most entities, but you can start loading the level, ie the static entities. If the type of the game is CEL_NET_SINGLEPLAYER, you do not need to create a physical layer and you can access directly the one from the server.
You should register here the client manager.
| virtual bool celGameFactoryManager::InitServer | ( | iCelGame * | game | ) | [inline, virtual] |
A server is created and has to be initialized.
The iCelGameServer object is accessible from the celGame object.
You should create here the physical layer, the initial entities and their behaviors.
You should register here the server manager.
| virtual void celGameFactoryManager::ServerNetworkStateChanged | ( | celServerNetworkState | new_state, |
| celServerNetworkState | previous_state, | ||
| const char * | reason = "" |
||
| ) | [pure virtual] |
The state of the network connection from the client to the server has changed.
An extra comment can be specified when new_state is: