Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Networking Lobby Example Beta Q&A

Discussion in 'Community Learning & Teaching' started by UnityGuillaume, Jul 17, 2015.

  1. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    I think it's not nessesary to use namespaces.
    namespace Portotype.NetworkLobby - is just gives info that you're using Lobby Asset?

    Anyway I'm wrong) could you please give some special namespaces? I only know
    namespace ExitGames.demos.UI
     
  2. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    NetworkLobbyManager - is it Callback Manager? Can I use one of these: IPunTurnManagerCallbacks, PunTurnManager, IPunCallbacks?
     
  3. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    iPunTurnManager is for turnbased games, this is not what you need. IPunCallbacks is not necessary ether since Photon also handles Magic callback like Unity ( like Start() for example, you haven't register it, yet Unity calls any of yoru component having that method).


    I think you are approaching this the wrong way. You need to first be educated with Photon as is before attempting to reverse engineer uNet and its lobby to Photon. uNet awnd its lobby are very complex, not at all easy to grasp and full of somewhat questionnable features and api, so in itself, it's already very hard to grasp, so if you are also learning Photon, this double the trouble :) as Photon while a lot more intuitive and straight forward than uNet is still dealing with complex networking features. So my suggestion is that you first learn Photon and check the examples, like I said Pun 2 beta has a lobby sample available, study it, and understand what is at stake, and then rebuild this within your uNet project.

    Basically, a possible approach is not to modify your unet project, but simply rebuild it from scratch based on its UX, as opposed to take a component and try to bend it from uNet to Photon, it's not going to work that easily if you don't master both uNet and Photon.

    Bye,

    Jean
     
    alarm656 likes this.
  4. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111

    You're quite right. Unity lobby is very complex. Unet lobby works not only with 4-5 scripts it is like a huge system. Yesterday I was trying to make clone of all Unet lobby scripts but tried to integrate Photon to all clone scripts. It doesnt works, I mean this is not right way. Today I'll try to focus only game scripts, but there are some main scripts like "Singleton" Ahh( so hard
     
  5. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111

    I think I need focus on these scripts only and + CardScript which is inside GameLogic folder
     

    Attached Files:

  6. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    Jean please could you help me with these:
    I'm focusing only Game scripts and this is from "Singleton" script which (I hope) outside of Unet Lobby.
    I think I'm on right way now)
    Login/Register new player/Photon connection/Menu/Lobby/JoinOrCreateRoom/LeaveRoom/BackToLobby/ works cool.
     
  7. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    Full
    Code (CSharp):
    1.  
    2. [SyncVar]
    3.     public int i;
    4.     public int rand;
    5.     [SyncVar(hook = "turner")]
    6.     public string Turn;
    7.  
    8.     public bool FirstTurn = true;
    9.     public bool FirstSpawnCards = true;
    10.     public bool isScore;
    11.  
    12.     public AudioSource timerSound;
    13.  
    14.     public void turner(string value)
    15.     {
    16.         Turn = value;
    17.     }
    18.  
    19.     [SyncVar(hook = "RoundTrumping")]
    20.     public string RoundTrump;
    21.  
    22.     [SyncVar(hook = "cardTrump01")]
    23.     public string CardTrump01;
    24.     [SyncVar(hook = "cardTrump02")]
    25.     public string CardTrump02;
    26.     [SyncVar(hook = "cardTrump03")]
    27.     public string CardTrump03;
    28.     [SyncVar(hook = "cardTrump04")]
    29.     public string CardTrump04;
    30.  
    31.     public void RoundTrumping(string value)
    32.     {
    33.         RoundTrump = value;
    34.     }
    35.     public void cardTrump01(string value)
    36.     {
    37.         CardTrump01 = value;
    38.     }
    39.     public void cardTrump02(string value)
    40.     {
    41.         CardTrump02 = value;
    42.     }
    43.     public void cardTrump03(string value)
    44.     {
    45.         CardTrump03 = value;
    46.     }
    47.     public void cardTrump04(string value)
    48.     {
    49.         CardTrump04 = value;
    50.     }
    51.  
     
  8. thisisadhi

    thisisadhi

    Joined:
    Oct 7, 2017
    Posts:
    4
    I Know I am very late to this, but if you use
    if(!isLocalPlayer)
    {
    return;
    }
    or alternatively
    if(LocalPlayer){
    All of your Code
    }
    Remember to use these pieces of code in your Update Function.
     
  9. thisisadhi

    thisisadhi

    Joined:
    Oct 7, 2017
    Posts:
    4
    When I Start a server and then press back it makes me go to the lobby. How do I fix this
     
  10. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    Is there any way I can replace the input field with Xbox gamertag?
     
  11. Dankworth

    Dankworth

    Joined:
    Nov 30, 2016
    Posts:
    1
    I've based my system off this one and im stuck on making the lobby return to lobby on all characters die. Im using LobbyManager.Instance.ServerReturnToLobby();
    It works with the host (lobby has that player) but A if I start it then the character doesnt spawn in game
    B if its more than the host the other players lose connection when ServerReturnToLobby is called. Any ideas why?
     
  12. HeyHouBenjo

    HeyHouBenjo

    Joined:
    May 10, 2018
    Posts:
    2
    Hi, how can I prevent this wonderful Lobby Manager to reload the Lobby scene when I cancel any Lobby? Everytime, if I start a Lobby via Matchmaker, Play and Host or Dedicated, and then leave that lobby, my whole scene becomes reloaded, which doubles my global GameManager with DontDestroyOnLoad and sets the scene back.

    I know this thread is old, but I hope you can help me