CEL: Crystal Entity Layer: celGameFactoryManager Class Reference (CEL: Crystal Entity Layer Public API Reference)

| ## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# celGameFactoryManager Class 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>`

List of all members.

## 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, csString reason="")=0
| The state of the network connection from the client to the server has changed.

## Detailed Description

This is an interface you should implement in order to manage the events from the factory of game sessions.

You can use it to:

- receive the information on new games accessible.
- catch the changes of the connection state from the client to the server.
- initialize the client and the server.
- provide the baselines of the client and server events, and of the network links.

Definition at line 240 of file network.h.

## Member Function Documentation

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.

Parameters:

  | game_info | the info of the game.
  | server_latency | an estimation of the latency of the network connection from this client to the server.

Definition at line 251 of file network.h.

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.

Definition at line 304 of file network.h.

virtual csPtr<iCelDataBuffer> celGameFactoryManager::GetNetworkLinkBaseline | ( | celNetworkLinkType | link_type | ) | `[inline, virtual]`

Return the baseline of a network link.

It is not obligatory to provide the baselines and this function can return 0, but this can result in some network overhead.

Definition at line 320 of file network.h.

virtual csPtr<iCelDataBuffer> celGameFactoryManager::GetServerEventBaseline | ( | celServerEventType | event_type | ) | `[inline, virtual]`

Return the baseline of a server event.

It is not obligatory to provide the baselines and this function can return 0, but this can result in some network overhead.

Definition at line 312 of file network.h.

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.

Definition at line 285 of file network.h.

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.

Definition at line 294 of file network.h.

virtual void celGameFactoryManager::ServerNetworkStateChanged | ( | celServerNetworkState | new_state,
|  | celServerNetworkState | previous_state,
|  | csString | 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:

- CEL_NET_SERVER_INVALID_HOSTNAME: reason is the value of the hostname.
- CEL_NET_SERVER_REJECTED_BAD_GAME: reason is the name of the game played by the server.
- CEL_NET_SERVER_REJECTED_BAD_PROTOCOL: reason is the name of the protocol version used by the server.
- CEL_NET_SERVER_REJECTED_UNAUTHORIZED: reason is the text given by the server to explain why this player has not been authorized to enter the game.
- CEL_NET_SERVER_KICKED: reason is the text given by the server to explain why this player has been kicked from the game.

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

- physicallayer/network.h