Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CRYENGINE handles all three cases, with a degree of programmer control. In addition, the host migration process is monitored so that if the new host quits, crashes or suffers a power loss, another host is chosen until either there are no more clients in the game or the host migration time-limit is reached (known as a multi-migration event).

Host

...

Migration is

...

Session Based

Host migration is session based, and each session can migrate independently (and concurrently). Sessions need to be created as migratable (or not) by supplying the CRYSESSION_CREATE_FLAG_MIGRATABLE flag to ICryMatchMaking::SessionCreate().

Host

...

Migration is a

...

Lobby Service

It is also a controllable feature of the lobby service; an individual lobby service can be configured to not support host migration (the default is to support it, via the eCLSF_SupportHostMigration flag) so that a game title can support host migration only on selected platforms if required (e.g. host migration only makes sense in a peer hosted environment; if one platform is using dedicated servers, then it can be prevented from migrating sessions). A lobby service can be queried for host migration support as follows:

...

where <lobby_service_type> is eCLS_LAN or eCLS_Online.

Determination of the

...

New Host

The determination of the 'best' host is decided by hints that are synchronised between all clients in a game. The criteria for determining the best host are as follows:

...

The hint list is maintained by the current host for as long as the session is active (and supports host migration), and propagated to all clients.

Host

...

Migration Console Variables

There are a number of console variables that can be used both to control host migration, and to show information about the hint list and status of each machine:

  • net_migrate_timeout - this is the total amount of time allowed for migration events to complete (default is 30 seconds). All migration(s) must occur for the session within this time frame or host migration will terminated.
  • net_automigrate_host - toggles whether automatic migration is attempted when connection to the host is lost (default is 1 = on). This can be used to guard sections of code when you don't want host migration to occur, but you still want the facility to be supported.
  • net_show_host_identificiation - toggles whether host identification is displayed on screen (default is 0 = off). This shows the status of any given machine in all its participating sessions, and will show either 'HOST', 'ANTICIPATED NEW HOST' or 'MEMBER'.
  • net_show_new_host_hinting - toggles whether the host hint list is displayed on screen (default is 0 = off). This shows the hint list of any given machine in all its participating sessions. The host will have a hint for every client in the game (excluding themselves), and each client will have a hint for each peer connected client (excluding themselves and the host). So, in a fully connected game with four participants, the host would see three hints (one for each client), and the clients would each see two hints (one for each client excluding the host).
  • net_hostHintingNATTypeOverride - overrides the reported NAT type (default is 0 = off; 1 = open, 2 = moderate, 3 = strict, 255 = unknown). This command is useful for creating, or repeating test situations. Obviously it doesn't actually change the NAT type, only what's reported in the hint, and is used to ensure a particular machine is either excluded as a host candidate (by reporting a more strict NAT type) or preferentially chosen (by reporting a more open NAT type).
  • net_hostHintingActiveConnectionsOverride - overrides the reported number of active connections (default is 0 = off). This command is useful for creating, or repeating test situations. Obviously it doesn't actually change the number of active connections, only what's reported in the hint, and is used to ensure a particular machine is either excluded as a host candidate (by reporting a lower number of connections) or preferentially chosen (by reporting a higher number of connections; up to 255).

Host

...

Migration Flow

The host migration process passes through a number of stages, and at each stage certain actions must be performed. To facilitate this, classes can register interest in host migration events by way of a listener interface pattern.

...

Each method returns a boolean, with true meaning 'all processing for this stage is complete', and false meaning 'more processing is required'. Only when all the registered listeners for a given state have returned true does the host migration process move onto the next state. This allows asynchronous tasks such as disconnecting or reconnecting to fully complete before moving onto the next state (the passed reference 'state' is guaranteed to be 0 the first time the listener is invoked, and will persist its value on subsequent invocations, until the listener completes - useful for controlling switch based state machines).

Game

...

Rsponsibilities for

...

Host Migration

CRYENGINE handles most of the work required to migrate a session to a new host, but the game will have some responsibilities.

...