About ending a game and disconnection

  1. 1 What's the proper way to quit a session? Do I call `BoltNetwork.ShutdownImmediate();` directly or is there any recommended way to let server and clients get notification properly?
  2. 2 After ending in question1, are all the players in the room not counted as CCU?
  3. 3 What's the callback links for ending session? I need to design a strategy to judge win/lose and prevent quitting game on purpose, so I need to know all the ending game related Bolt behaviors. I know `BoltShutdownBegin` on both sides will get called if the server call `BoltNetwork.ShutdownImmediate();`. What about other following cases?
    - a - A client calls `BoltNetwork.ShutdownImmediate();`
    - b - Server lose internet connection or app is killed by player.
    - c - A client does `b`.
  4. 4 How does a server know that a client loses connection? And how does a client know that the server loses connection(the player whose app also act as server closes on purpose)?

Thank you!

Comments

  • Hi,
    1 What's the proper way to quit a session? Do I call `BoltNetwork.ShutdownImmediate();` directly or is there any recommended way to let server and clients get notification properly?

    We don't recommend using "BoltNetwork.ShutdownImmediate", but instead "BoltNetwork.Shutdown", as this will make the Server shutdown, but also send a Disconnect command to the clients, so they also shutdown naturally.

    You can treat this using the "BoltShutdownBegin" callback.

    - https://doc.photonengine.com/en-us/bolt/current/gameplay/global-callbacks
    - https://doc-api.photonengine.com/en/bolt/current/class_bolt_network.html#a68730f5af4b8ae0e6ff058493c6c1803
    2 After ending in question1, are all the players in the room not counted as CCU?

    Yes, once you shutdown, you will be disconnected from the Photon Cloud until you start Bolt again.
    If there is no connection with Photon, no CCU is counted.
    3 What's the callback links for ending session? I need to design a strategy to judge win/lose and prevent quitting game on purpose, so I need to know all the ending game related Bolt behaviors. I know `BoltShutdownBegin` on both sides will get called if the server call `BoltNetwork.ShutdownImmediate();`. What about other following cases?

    First of all, we suggest that you override all callbacks on both sides (server and client), and check their calls when you are playing your game, that is the best way to learn about how they work.
    - a - A client calls `BoltNetwork.ShutdownImmediate();`

    You will get "Disconnected" on the Server after the Connection Timeout.
    - b - Server lose internet connection or app is killed by player.

    You will get "Disconnected" on the clients followed by the "BoltShutdownBegin".
    - c - A client does `b`.

    You will get "Disconnected" on the Server after the Connection Timeout.

    --
    Ramon Melo
    Photon Bolt Team
  • @ramonmelo Thank you for the advice and answers! I'll do as you said, override every call backs and do tests to get a better understanding :)