Search Unity

Third Party What is Photon Offline Mode?

Discussion in 'Multiplayer' started by ChoicePath2, Oct 9, 2018.

  1. ChoicePath2

    ChoicePath2

    Joined:
    Oct 6, 2018
    Posts:
    7
    Hello!

    The documentation of Photon says that offline mode is a feature that allows you to re-use your multiplayer code into single player game mode as well.

    So what does this mean? Does it mean that multiplayer mode can change into singleplayer mode , or the multiplayer game mode has single player game functions when the player plays offline?

    Please explain what offline mode is.

    Thank you!
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    It's a flag you can set which enables you to play without going online but still use 99% of the same code that you would if you were playing it networked.

    Basically, it saves you a lot of time if you want to implement a single player mode for your networked game or if you want your game to be playable without an available internet connection.
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    The offline mode allows you to use the same (or very similar) workflow to "join" a game and arrive in a "room", no matter if you're online or offline.
    As @Munchy2007 says, it may be a time saver when you want to support multiplayer and singleplayer in one game. You just enable offline mode and you can use the same workflow to "create a room" and play (with 0 other players).

    Here's a doc for more details:
    https://doc.photonengine.com/en-us/pun/current/gameplay/offlinemode
     
    aqilnoor likes this.
  4. KushagraPratap

    KushagraPratap

    Joined:
    Sep 23, 2018
    Posts:
    1
    It also allows you to use PUN RPCs and other stuff when offline. Probably, calling RPCs would become like calling functions without needing to change the RPC calling code and such other changes that allow using the same code but that doesn't mean everything would work as expected so it's better to give a check for all features.
     
  5. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    For me, one of the more useful aspects of single player mode is that it allows me to attach a debugger and use it to single step through sections of code without it causing the game to disconnect.
     
  6. bat_hol

    bat_hol

    Joined:
    Nov 26, 2019
    Posts:
    1
    I'm in a GameJam and used Photon to make my game multiplayer but we now think about implementing a local multi how can i use photon offline to Localy add player and play with them?
     
  7. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    You can't have offline/lan only multiplayer with Photon.

    The offline mode allows you to play single player offline without having to change any of the multiplayer code.
     
  8. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Will PhotonNetwork.OfflineMode be any quicker do you think?
     
  9. Lukeesta

    Lukeesta

    Joined:
    Jan 7, 2016
    Posts:
    79
    What do you mean by quicker? It will have less latency (0) since it's a local simulation only.
     
  10. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    yeh, I mean will it use less cpu time doing the rpcs etc
     
  11. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    On average, it will use a little less CPU time, yes. There won't be re-simulations caused by loss or variable lag.
     
    radiantboy likes this.