Search Unity

Adding Multiplayer for a Survival Game

Discussion in 'Multiplayer' started by Skyfall106, Jan 10, 2018.

  1. Skyfall106

    Skyfall106

    Joined:
    Mar 5, 2017
    Posts:
    132
    Hey! SO I have used multiple assets from the asset store to create a game but I have a problem. I want to implement multiplayer into my game and at the moment I need it to be basic. I Have a simple Main Menu with a Play game button which currently takes you to the game scene. How can I implement multiplayer into my game using this button and while in game when I exit to main menu it switches back to the main menu scene and leaves the server. Since most likely people around the world would join and wouldn't be on my local IP how can I make them join from my computer for example. Thanks for the help
     
  2. Skyfall106

    Skyfall106

    Joined:
    Mar 5, 2017
    Posts:
    132
  3. Skyfall106

    Skyfall106

    Joined:
    Mar 5, 2017
    Posts:
    132
    Bump again. Can anybody help me?
     
  4. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    210
    Get Photon, watch some tutorials.

    You can still use your play button like it is right now, but you'll need to write a script that joins a room when the scene is loaded.

    Then, spawn the player using a prefab, disable all components of non-local players, and modify all your scripts so they are networked.
     
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You're asking a very complicated question that doesn't have a simple answer beyond watching tutorials for you to understand how networking systems work. It isn't just something you drop in, add a few lines of code, and then are done.

    You're going to have to do several things, such as figuring out how you want to allocate players to different servers, what data do you want to be local and what data do you want the server to be in control of, how you want to fetch data that the server is in control of so that the clients have access to it, etc.
     
    00Fant and Ryiah like this.