server | v4 switch to v3  

Peer State Machine

The MMO demo is discontinued and we don't offer support for it anymore. The current documentation and the sample provided in the SDK are left temporarily and will be removed in the next update. For MMO we recommend following examples of Das Tal or Albion Online.

A client peer has one of the following states:

  • Connected: Initial state after connecting, player has not entered a world.
  • WorldEntered: Player entered a world with operation EnterWorld.
  • Disconnected: Client disconnected.

This diagram shows all transitions:

Photon Server: MMO Peer State Diagram
Photon Server: MMO Peer State Diagram

The peer uses a different operation handler for each state. This allows operations to behave differently in each state. The following operation handlers are used:

  • State Connected: Photon.MmoDemo.Server.MmoInitialOperationHandler
  • State WorldEntered: Photon.MmoDemo.Server.MmoActorOperationHandler
  • State Disconnected: null

The client should always wait for the related operation response event after calling a state changing operation; the peer state and therefore the current operation handler (operation behavior) is not guaranteed until the response event is received. For operation EnterWorld it's the operation response, for operation ExitWorld it's the event WorldExited.

To Document Top