Search Unity

Networking Lobby Example Beta Q&A

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

  1. wokamoka

    wokamoka

    Joined:
    Jul 3, 2012
    Posts:
    10
  2. wokamoka

    wokamoka

    Joined:
    Jul 3, 2012
    Posts:
    10
    @UnityGuillaume, please do you have any updates on this topic?

    Is there new features in the last version of this asset (version 1.4 from May 5th 2016) ?
    Thanks
     
  3. CGDever

    CGDever

    Joined:
    Dec 17, 2014
    Posts:
    156
    I have worked with in the game lobby. I want to connect the player to the free space in the lobby.
    I have no idea how to do this, anybody please tell me.
     
  4. asalas77

    asalas77

    Joined:
    Mar 24, 2016
    Posts:
    6
    Can you tell me how to pass information from LobbyPlayer to Game Player? Things like player name and id.
     
  5. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255
    i only download and import and error.

    upload_2016-6-3_10-37-53.png
     
    F1R3_H4WK and Dotby like this.
  6. VisualTech48

    VisualTech48

    Joined:
    Aug 23, 2013
    Posts:
    247
    Is there an tutorial how to send and recive data with Javascript?
     
  7. mnenad

    mnenad

    Joined:
    Dec 7, 2015
    Posts:
    18
    Hi, I just downloaded this NetworkLobby asset and it runs perfect :) thank you! I just got stuck at the particular point when I wanted to add multiple player prefabs... Is there a way I can make the Clients choose from, let's say playing a soldier or a tank/ mage or warrior or whatever player prefab they want to use. I am quite new to Networking but I did my very best to find a suitable solution... but nothing worked yet. I would be really thankful for some advice! Cheers
     
  8. Dotby

    Dotby

    Joined:
    Nov 12, 2013
    Posts:
    32
    LobbyManager.cs

    Code (CSharp):
    1.  
    2. //public override void OnMatchCreate(MatchInfo matchInfo)//CreateMatchResponse matchInfo)
    3. //{
    4. //base.OnMatchCreate(matchInfo);
    5. //            _currentMatchID = (ulong)matchInfo.networkId;
    6. //        }
    7.  
    8.         public override void OnMatchCreate (bool success, string extendedInfo, MatchInfo matchInfo)
    9.         {
    10.             base.OnMatchCreate (success, extendedInfo, matchInfo);
    11.             _currentMatchID = (ulong)matchInfo.networkId;
    12.         }
    13.  
    14. ************************
    15.  
    16.         public void OnDestroyMatch(string extendedInfo)  //BasicResponse extendedInfo)
    17.         {
    18.             if (_disconnectServer)
    19.             {
    20.                 StopMatchMaker();
    21.                 StopHost();
    22.             }
    23.         }
    LobbyServerEntry.cs
    //just comment all error points

    And many other similar errors. I was able to translate them into a new api. You also should be able to.

    P.s: ...mess in the api documents and assets. It is improper treatment with developers.
    I hope this is only because it is beta.
     
    Last edited: Jun 11, 2016
  9. tdneren2

    tdneren2

    Joined:
    Sep 29, 2013
    Posts:
    14
    In the sample scene: should that, in such case of using/building-upon the Meteoroid example, be NetworkLobby.unity or NetworkSpaceship.unity where the empty gameObject should be placed? (None of the scenes have gameObjects/empty-gameObjects in the heirarchy on beforehand - they are only instantiated as prefabs). And (while again using the Meteoroid example) would the "setup/player/whatever" script be the (equivalent to the) LobbyManager.cs script?

    Alternative performance approach: As the first asking user I just want to make the user able to choose between different types of avatars (fbx-models), so when you are writing "- in the Start Function of your player/setup script, instantiate the right prefab and set it as child of your gamePrefabObject " I guess I could put my three avatar models under the same empty gameObject/prefab and render.enable myself out of the challenge/problem, but would that become expensive performance-wise?
     
  10. tdneren2

    tdneren2

    Joined:
    Sep 29, 2013
    Posts:
    14
    " ... As well as the first asking user above I just want to make ..."
     
  11. tdneren2

    tdneren2

    Joined:
    Sep 29, 2013
    Posts:
    14
    There appears (all-in-all) to be very little documentation to how the LobbyManager.cs works. With my two previous posts (right above) in mind I tried to, in stead, use the list of 'Registered Spawnable Prefabs':
    http://s31.postimg.org/mnse0c097/Gameplayer_Prefab_versus_Player_Prefab_Reg_Prefabs.png
    As one can see I have set in the "72_02" prefab in the Game Player Prefab (that in this case, unfortunately, does not appear to be easy while pursuing making into-a-list of avatars/models -> cf also "prefab index" suggestion above), but I have no clue how to use (and if I can use) the 'Registered Spawnable Prefabs'.
    What is the difference between the 'Player prefab' and the 'Game Player Prefab' slots?
    How do I access that 'Registered Spawnable Prefabs' list?
    And/or can I make a script-or-function that combine those two in a smoother way that you suggested UnityGuillaume?
     
    Last edited: Jun 15, 2016
  12. tdneren2

    tdneren2

    Joined:
    Sep 29, 2013
    Posts:
    14
    (Ok - will be my last post for now ...not spamming! >> still very relevant)

    By some sort of deductive reasoning, I came to the conclusion that 'you all' [sort of] work with this topic having done this tutorial-series: http://unity3d.com/learn/tutorials/...ion-simple-multiplayer-example?playlist=29690 (found many simularities) .... that is all good/super/fine etc. What I am aiming at is; that the very sporadic documentation does not lead the common up-starting Unity-MP-developer in that direction/that-specific-good-start-apporach. Again (and-all-in-all) I consider myself to (rightfully) be a little confused -> Note: I am already extremely grateful that these tutorials exist, and yet I still hope that; upcoming tutorial-material will merge the Meteoroid-asset-store example with the 'Introduction-to-MP-tutorial' series above :)
     
  13. EDevJogos

    EDevJogos

    Joined:
    Jul 24, 2014
    Posts:
    75
    I'm using the unity LobbyManager to setup the Master server connection. When i create a server and try to connect on it from the same computer, it works, the Server List is updated with the one i've created, but when i tried to do the same from diferente computers in diferente locations the server list always shows up empty.

    Print screens attached: As you can see on the print "samecomputer" it connects, but only with the build on the same computer, someone from another place, don't see this server created.
     

    Attached Files:

  14. rizwanbabar693

    rizwanbabar693

    Joined:
    Jul 15, 2016
    Posts:
    17
    I need help.
     
  15. Alzan

    Alzan

    Joined:
    Sep 2, 2012
    Posts:
    81
    I updated the Networking Lobby Example asset to work with 5.4. If granted permission from Unity, I can post my updated package here.
     
  16. Fletcherstger

    Fletcherstger

    Joined:
    Aug 11, 2016
    Posts:
    3
    Is there any way that I can access the lobby manager script from another script.
    I would just do getComponent<> but it isn't working for some reason.
     
  17. msbalfe

    msbalfe

    Joined:
    Apr 12, 2016
    Posts:
    2
    Will this be updated to include a NetworkDiscovery option for local games?
    Or does anyone have a LobbyNetworkDiscovery script they could share?
     
  18. VenUk

    VenUk

    Joined:
    Jan 30, 2014
    Posts:
    10
    I'm using the Network Lobby asset from the Asset Store I've created a game that I want to rotate around a list of levels. When starting the players are there and everything is fine. However when the current level is completed and I need to go to the next level in the list; I change the play scene to "MyNextLevel" call the function ServerChangeScene("MyNextLevel") and the level loads fine but no players are present. How can I solve that? There are no player prefabs in the list of objects in the game.
     
  19. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Hey, months have passed. Are there any updates on the issue that the Network Lobby currently forbids hot-join by design?

    Still, this seems like a significant design flaw as some games will need both a lobby and hot-join support.
     
    Last edited: Nov 4, 2016
  20. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    For me everything seems to work, I can connect with a built version to the in-editor version.
    But the standalone-player will always get removed after a short while (30-50s max). It gets removed in the Editor as well but both games continue without returning to the lobby. There is no exception or anything in the Editor. When just running inside the Editor, it will just not display the player at some time but still have the object in Hierarchy. That's a bug if you ask me. 5.4.2f2
    When returning on the host, the client will also return to the lobby. What is going on here?

    Another problem is that the NetworkBehaviour class cannot use generic parameters (trying to use that with a Singleton). Any best practises on that?
     
    Last edited: Nov 9, 2016
    CGDever likes this.
  21. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    988
    If you are matchmaking, why would you need a name? Also "Create" sounds more like you are exclusively hosting a server rather than potentially joining an existing server through other matchmakers, too. Am I misunderstanding how Matchmaking works?

    This is also confusing - I'm more thinking about League of Legends matchmaking - why would matchmaking create a server list? Wouldn't there be a greater chance, while matchmaking, to JOIN a server (rather than create one)?

    Thanks @UnityGuillaume
     
  22. Max_Bol

    Max_Bol

    Joined:
    May 12, 2014
    Posts:
    168
    This is a really good demokit for learning networking with lobby via Unet!
    Thanks a lot for the load of work you have done on it!

    Now, I would like to explain some part to some of those who were asking questions that remain still unanswered.

    First, anything related to the customization has to pass through 1 single gameobject for each remote player which act as the player prefab. That's a limitation of Unet by design. All remote clients can only communicate to the host's server through 1 single Network Identity and that means through 1 single game object. When I explains it, I like to give out the idea where a scene is like an army. The Host's server is the command center and the host's client (which is within the same machine/app) is the commander. Every remote clients have control over only 1 soldier while the command center has controls over the battlefield and only the Host's client can give order to the command center. The only way the soldiers (remote client) can communicate to others soldiers is through the command center so a call is made toward the server and the server distribute its own order to the other soldiers.
    So, in the case of something like a customization menu in the lobby, you will have to include, within the Lobby Player Prefab (which has a Network Identity) a function that will be able to communicate the "results" of your option to the server which will transmit it to the other client. There's thousands of ways of doing it and the complexity of the customization you're aiming for will determines which one benefits your game better.

    For example, I'm currently working on a Action Brawler with a small bit of RPG elements. Each players has a total of 10 possible customization selections in the lobby which includes things like class, race, equipment, teams and even controls source (as the game project aim to allow up to 4 players in the game, but with the possibility of having up to 4 players on the host client or 3 players on remote client and 1 on the host client. So 4 players max, but with the possibility of multiple players onto 1 client.) Whenever a player change an option, I'm sending a string based integer value to the server which transfer the string value to all the client and that string value is "cut" in pieces back into different int which determines the choices visible to other clients. (I also make use of that string to "keep" the player selections in memory so that they doesn't have to constantly re-customize the same thing when the quit and re-enter the lobby.)

    This is possible because my project involve no random stats or features, but a fixed "equipment" list a bit like Demon/Dark Soul or Soul Calibur where each item are predetermined with a name and unique stats/effects.
    If you aim for something more "drop" oriented (like Diablo/Torchlight), you will have to create your own generator system that will be able to "convert" an ID string into inventory items value(s). (Remember you can use number AND letters and strings can go up to 255 characters, but I suggest you stay below 100 unless you want some hug hit on the frame whenever you load and convert a bunch of those.)

    The most common misconception of devs who haven't studied Networking with Unet enough is that they think that because a "name" or a UI is specific to a player, that player client should take controls of it, but that's wrong and simply impossible without tons of useless work-around. The way of doing this is so that the server (host) handle as much as possible and the remote player only gets their immediate controls on their gameplay-based asset.
    So, for example, if you have a scene where each player controls a character. Remote clients should have the UI, but its Network Identity should NOT be set to local authority. The server (host's side) should be the one who update the UI variables. So, remote client are usually only receivers with really little sending capacity. UI, environment elements (which affect gameplay) and even projectiles are all handled by the server.
    What the remote client handle is :
    • Controls related actions.
    This is usually sync by the Network Transform and Network Animator components or your own version of it. It can also be things like call sent to the server that "order" (command) it to create something somewhere (like a spell effect or a bullet.)
    • Display what is received from the server.
    Do not mix it up. While the server controls the "data" that constantly changes, each client do have an "instance" of each thing visible. So each client has their own "assets" and they are not just "streamed" in their whole. What's streamed from the server is the sync values such as transform and animation values or even int/float.
    When the server receive a command, it will transfer the "result" to all clients.
    • Manage local-only assets.
    Not everything has an Network Identity. For example, static elements of the environment which only act as source of collisions doesn't have to be sync. It's also the same thing with debris from explosions or particles effects. Unless those have clear gameplay effects, having them a bit different between each client is not a problem. Physics are, after all, managed locally for assets that doesn't have any impact on gameplay. I could give the example of a soccer game. The ball and AIs are controlled by the server. Remote players (and host's client if he's part of the game) controls 1 soccer player each. Things like the ground, animated spectators and even environmental effect (cloud shadows, wind on clothes/flag, screens, etc.) will be handled locally on each client. If it's a level where parts unlock as the player advance, the the server handle and sync the part that should not varies between clients and doesn't even know the rest exist.

    So, for example, you want to give to the player the ability to shoot a bullet or cast a spell. You will do so by creating a function that will take the player's position and orientation then send it to the server. After, the server (host) receive the command, it will start a new function (based on the value received) that will order each client to create the spell or bullet on each connected client. Then, on each client, the spell or bullet instance is created from an existing prefab and it should have its own behavior script and Network Identity. This also means that while all client instantiated this "prefab", the one who controls it is still the server. Note that while it has to be a prefab that exist on all clients, you can still make uses of a kind of databank/list of assets and/or values that gets modified when the prefab is created.

    Kinda like this:
    1) Player A press cast spell. A script on his own character makes his client sent a command "CmdCastSpell(int SpellID, Vector3 Pos, Vector3 Dir);
    By then, only Player A and the server is "aware" of the action.
    2) The server then call a local function that includes NetworkServer.Spawn(prefab) (prefab based on the int SpellID from the command) and create the "spell effect" on all clients.
    3) As soon as the spell effect is instantiated, its position is updated based on both Vector3 from the command.
    4) If anything is "hit" from the server/host's client perspective, ClientRpc attributed functions are called based on what should be done.
    5) After the spell effect has "finished" its stuff, its scripts (which is under the server's control) call a function that includes NetworkServer.Destroy(This); so that it can be removed from all the client.

    If you notice, even if that spell was casted by the Player A, the server handled how it instantiates, what it affects and when it's removed from the scene. The only thing the Player A script does is tell the server "Create "this" there and handle the rest".

    This is how you manage stuff in Unet. It's always a 4-step process: Remote Client command, Server Receive, Server Translate and Calls, all (host and remote) Clients Receive and do.
     
    Last edited: Dec 5, 2016
    deLord and Munchy2007 like this.
  23. camfred

    camfred

    Joined:
    May 31, 2015
    Posts:
    2
    There appears to be a bug with the networking lobby. Please correct me if I'm mistaken. The issue is that Network Lobby Player sits as a child of objects that get destroyed on scene load. This makes the DontDestroyOnLoad() call fail (with a error) and the the OnLobbyServerSceneLoadedForPlayer () never gets called by the client. There's some discussion of it here:

    https://forum.unity3d.com/threads/lobbyplayer-to-gameplayer-networklobbymanager.349614/

    and here:

    http://answers.unity3d.com/questions/986772/player-prefab-on-lobby-managers.html

    finally there's this helpful page:

    https://abrgame.blogspot.de/2016/01...fferent-player.html?showComment=1467227533786

    Hoping this helps anyone else who's struggling to get it to work.
     
    MrLucid72 likes this.
  24. Uranus89757

    Uranus89757

    Joined:
    Jun 20, 2016
    Posts:
    2
    Have you got any conclusion or solutions about "hot join" in middle of the Networking lobby game?
     
  25. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    988
    It's more than bugs -- anything involving UNET, HLAPI, Host Migration, or the lobby aspect of Unity is more or less abandoned. Even the "Tanks" demo recently swapped to Photon O____o beware of UNET -- there are many broken promises and 0 support. Our team had to swap to Photon at the last second and lost 2 months of coding. While 2 months of UNET coding didn't get anywhere in the lobby, we got Photon working in 2 hours. Really.

    More info here.
     
    jinnindo likes this.
  26. hycwong

    hycwong

    Joined:
    Apr 13, 2017
    Posts:
    1
    I have found an issue for collaborating.
    Since I am working on a project with classmates, when my classmate compiles the game, it works. However, when I compile the same code on my own Unity, its networklobby cannot create a room.
    I have no idea why...

    p.s. we are using matchmaker to create and search rooms
     
  27. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Are you sure you are both using the same version of Unity?

     
  28. k0zm0z

    k0zm0z

    Joined:
    May 12, 2017
    Posts:
    1
    this will be a late reply but entering my reply for other users:


    I customized LobbyManager.OnLobbyServerSceneLoadedForPlayer
    (GameObject lobbyPlayer, GameObject gamePlayer) to pass data from lobbyplayer to the game player.


    Code (CSharp):
    1.        
    2.  
    3. public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer)
    4.  
    5.         {
    6.             //This hook allows you to apply state data from the lobby-player to the game-player
    7.             //just subclass "LobbyHook" and add it to the lobby object.
    8.  
    9.             if (_lobbyHooks)
    10.                 _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer);
    11.  
    12. //this is the custom part I inserted
    13.             gamePlayer.name = lobbyPlayer.GetComponent<LobbyPlayer>().playerName;
    14.  
    15.  
    16.             return true;
    17.         }
    18.  
     
  29. JesHal

    JesHal

    Joined:
    Jan 22, 2013
    Posts:
    3
    Is "hot join" still unsupported in Network lobby game? All FPS games (e.g. Halo, Call of duty) support hot join, so I don't really understand why Unity thought it was a good thing to leave it out.
     
  30. Cakeszy

    Cakeszy

    Joined:
    Jun 7, 2017
    Posts:
    4
    Hello,

    I am having a problem with the Network Lobby Example that I am struggling to figure out.

    Getting into and playing a game from the Lobby Manager works fine, but when I call 'SendReturnToLobby()' at the end of the game, it doesn't work correctly. The Host returns to the lobby as the only player in the lobby. It looks like the Host creates a new Lobby Player for some reason, and this is the only lobby player in the lobby. The pre-game lobby players are destroyed on the Host.

    The Client returns to a lobby with the two pre-game lobby players (Host and Client) from the initial lobby, along with the newly created Host lobby player in the lobby. This newly created Host lobby player is the only one actively linked on the Client side (colors and name change correctly). The Client is not able to change their name/color or interact with the lobby in any way.

    I have not been able to find the cause of this problem, and any help would be greatly appreciated!

    Thanks
     
  31. mrdavletdinov

    mrdavletdinov

    Joined:
    Jun 25, 2017
    Posts:
    4
    dont work on
    Unity 2017.2.0b4
    Выпущен: July 20, 2017

    work only first time and then dont create a game
     
  32. Stamperino

    Stamperino

    Joined:
    Feb 23, 2017
    Posts:
    6
    For anyone else who happens upon this, 2017+ versions of Unity have many problems with Unet, every example project and scene will not work correctly after the first run, as in, going back to lobby and trying to play again. Colors will be not be set, button states will revert, call orders of instances act differently. Piled bugs cause cmds and rpcs not to fire.

    Even minor things that never got fixed from the start like returning to lobby and seeing the "Join" button text color is still cyan.

    My complaints about these issues were removed from the asset store reviews twice, shows you how much care goes into the networking api.

    My advice, avoid it. You'll spend more time doing trail and error to figure out all the little nuances (like me, 3 and a half weeks just to shoot lasers at doods). Just go get Photon from the asset store, its actually straightforward. I nuked my Unet project and caught up in 4 days. I'm not even a good programmer.
     
    MrLucid72 and Cakeszy like this.
  33. Cakeszy

    Cakeszy

    Joined:
    Jun 7, 2017
    Posts:
    4
    Can I ask what resources you used to switch from Unet to Photon? I am in a similar situation and would love to get some guidance from someone who has already done it. Any help would be greatly appreciated, thanks!
     
  34. yolamu

    yolamu

    Joined:
    May 19, 2017
    Posts:
    1
    I have been trying to create a lobby chat for like a week straight, its been hell!!! does anyone have an idea on how to implement chat in the lobby? and is hot join supported yet? :confused:
     
  35. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi, I confirm this is totally inacceptable. my fan kicks in immediatly. and if I run the HIghRoad Engine asset using uNet as well, all is well and perfectly silent, computer is happy... so something is definitly wrong with this sample unfortunatly.

    Bye,

    Jean
     
  36. lauraaa

    lauraaa

    Joined:
    Dec 30, 2016
    Posts:
    16
    I also confirm this as well on my 1 year old Macbook pro retina. Fans run crazy.

    And about hot join the in-progress game, is there any update and reason on this?

    In the latest script NetworkLobbyManager.cs on Bitbucket, it still have the scripts and comment about "cannot join game in progress" in the override OnServerConnect function. But on the latest manual on NetworkLobbyManager, it stats that it has "Option to prevent players from joining a game in progress". Anyone knows where this "Option" is?

    And if I want to enable the hot join myself by editing the OnServerConnect, is there any tip on doing this properly?

    Any guidance appreciate, thanks!
     
    Last edited: Jan 30, 2018
  37. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    988
    As someone that swapped to Photon from the abandoned UNET module, I know this may seem crazy when used to UNET's lack of documentation, but .... the docs and demos are INCREDIBLY documented in Photon. Even in-line. UNET will have 0 to 5 words in-line (in Visual Studio when you start typing a function and wait a second for a tooltip) that offer 0 direction, but Photon will have like FIVE PARAGRAPHS!! Even with real-world use on how/when to use them.

    Simply look at the QuickStart, then everything else is found in-line. Quickstart is @ https://doc.photonengine.com/en-us/realtime/current/getting-started/quick-start

    Sad to see UNET still doing poor after all this time while Unity, as always, puts in new features and moves on to the next fluff feature that draws in new monthly seat subs.
     
    Jean-Fabre likes this.
  38. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    How to migrate this asset to Photon?
     
  39. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    It's not an easy task to migrate the uNet lobby to Photon using existing code, as it is radically different in terms of implementation within uNet and Photon. However this is possible, and we have currently a work in progress that is pending for release where I did port a project that use the uNet lobby to Photon.

    The bottom line is that there is no Lobby within Photon where you have a pointer to your players, you must be inside a room already, for all your players to be able to interact and see each other, so the "lobby" as a uNet definition is different as how Photon defines it. You will need to create an abstracted system within a Photon room that will mimic the behaviour of uNet Lobby ( picking name, color, ship types or players options for the game). Your game will only start when this lobby process has taken place, so when a player enter a room, it doesn't mean the game started, it only means you are now able to communicate with other players, which means you can create a lobby system where other players will see your name changing or your ship choice, it will be also the place where one player ( the one that created the room likely) will be able to select the track or level in which this game will take place.

    The "joining" process ( moving from the lobby ot the game itself) will be simply fake basically, which just a series of RPC call and checks like is everyone ready? once the game owner decides to go, another RPC is call and will start a timer on each client, maybe load the right level and instantiate the right setup for each players and the game will start.

    Hopefully, this is not too cryptic, and once the work currently pending on this will be out publicly, I'll post again ( hopefully I'll remember :) ) so that you refer to it as to check out a complete project that is fully compatible with uNet and Photon.


    Also, I would also check out the PUN 2 beta release, it features a new demo which does implement a lobby system like the uNet one. But its not an attempt to reconcile both variants, it is designed from the ground up with just Photon in mind. So some concepts might be difficult to apply in an attempt to port a uNet lobby to Photon, but nonetheless I recommend you check it out.

    https://forum.photonengine.com/discussion/11165/pun-2-beta-early-access-december-2017
    the demo is "DemoAsteroids"


    Bye,

    Jean
     
    alarm656 likes this.
  40. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    Thank you Jean. Yes I know that it's not easy task. But recently I got project which is multiplayer and has crash bugs. After exploring project I understood that multiplayer made by using Unity Networking and It has some Host Migration problem. Exploring further I discovered that project also has used this Unity's Networking Lobby Asset. I tried to ignore all Menu/Lobby codes and created new ones with Photon. Now my custom photon connection and lobby/Create Room/Join Room are ready. When I discovered further in actual game scene scripts uses and gets and sets more variables and access from this Unity's Netwrking Lobby Asset. So now I desideed to explore this asset.
    There is a script calls "Lobby Manager" it gets some info from Networking Lobby Manager which is a (only red) component.
    using UnityEngine.Networking;
    using UnityEngine.Networking.Types;
    using UnityEngine.Networking.Match; -- What are they(
     
  41. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    For now I'm just copy pasting all scripts.
     

    Attached Files:

  42. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    To check what "using UnityEngine.Networking.Match;" implemented, simply comment that line, and compile, you'll see what Unity lost in the process.

    A less radical variant is to check the doc: https://docs.unity3d.com/ScriptReference/Networking.Match.NetworkMatch.html but then you'll have to guess where this could be used... so Varint one will get you there faster :)


    Bye,

    Jean
     
    alarm656 likes this.
  43. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111

    Unfortunately "Lobby Manager" prefab is in Game scene. Don't destroy on load. because scripts which is in Game scene works together with this Lobby Manager.
     

    Attached Files:

  44. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    The lobby Manager will always be there yes. But it doesn't matter in the end, since you will refactor and get rid of it.

    Bye,

    Jean
     
  45. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    Thank you. One probles less) What to do with namespace?
    namespace Portotype.NetworkLobby
    {
    }

    and NetworkLobbyManager? Just replace with PunBehaviour?
    public class "My script" : NetworkLobbyManager
    {

    }

    Do I need use?
    using ExitGames.Client;
    using Photon;
    Thanks)
     
  46. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    Yes, I'm going to get it rid. But GameScript in Game scene uses "Singleton" script. And Singleton scripts uses LobbyManager:) But today It seems me I'm started to understand a little bit)
     
  47. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Yes, NetworkLobbyManager will become eventually something linked to PunBehavior, you could turn it into a dedicated Component, but necessarly, could be a mix of classes and components.

    If you are using Photon, you will need to be declaring the right namespaces for you to use, but you should work the other way around. Find out what function you need from pun, and then checjk out its namespace and make the use declaration for it.

    Bye,

    Jean
     
    alarm656 likes this.
  48. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    the key will be to use Room Custom Properties and Player Custom Properties, which will let you share the data amongst all client. So the name and color of players should be saved in Player Custom Properties, and game related options such as the track or level will be likely either solely handled by the masterClient or saved in the Room custom properties for all players to check it out when needed.

    Bye,

    Jean
     
    alarm656 likes this.
  49. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    I think I could do something if I can replace NetworkLobbyManager with Photon's. Which is on place Monobehaviour
     

    Attached Files:

  50. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    For now it is going all right! Thank you very much!
     

    Attached Files: