Search Unity

Connect to server without moving to online scene?

Discussion in 'Multiplayer' started by Severos, Feb 6, 2016.

  1. Severos

    Severos

    Joined:
    Oct 2, 2015
    Posts:
    181
    Due to some changes in the design of the game(MMO) I'm making I have to redesign the login system, I have the general idea of how it work, but there are some stuff that I can't seem to understand.
    Currently I'm planning on doing this:

    Offline scene is used to update the game, so it's just a patcher, after everything is patched client connects to server (but nothing loads at all, and client is not ready), old GUI is replaced by a simple login GUI (2 inputs and button), when button clicked it reads the user/pass and send them using a NetworkMessage, if the server accepted the login, it sends back a list of characters of the player loaded from DB, then the player selects the character he wants to play and sends the ID back to server, finally server spawns player and tell client to load the online scene and sets it to ready.

    What I know right now is that I'll have to set auto-spawn player to false to prevent player from auto spawn, sending the user/pass, reply with the list, and send ID again is easy, also spawning the player is just instantiate object then spawn.
    My problem is on how to delay the loading of online scene and trying to enter the game and getting the states before selecting the player??
    Any ideas how to do that??
     
  2. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,124
    I guess if you don't set the scene in networkmanager and load it yourself later on it will solve it but why not drop NetworkManager and use NetworkClient and NetworkServer directly.

    In that way you are in control.
     
  3. Severos

    Severos

    Joined:
    Oct 2, 2015
    Posts:
    181
    No idea why didn't think of that... probably was too focused on something that I lost sight of it :/
    Thanks for the reply :D
     
  4. Severos

    Severos

    Joined:
    Oct 2, 2015
    Posts:
    181
    Small question, when using the NetworkServer I can't seem to find auto spawn player and OnServerConnect and all other methods, how would I handle new connections/spawning players and such? do I have to manually create all handlers for them?