Search Unity

Multiplayer Chunks Problem

Discussion in 'Multiplayer' started by Martelement, Dec 27, 2018.

  1. Martelement

    Martelement

    Joined:
    Jan 26, 2018
    Posts:
    7
    Hello guys!
    First of all, I hope i posted in the right section (sorry if not...)

    I'm kinda new to Unity and I've been following tons and tons of tutorials to improve my skills on this software.

    Currently, I'm following Sebastian League's tutorials on Procedural Landmass Generation (just finished this video a few days ago : Youtube)

    Now I try to make this possible in multiplayer.

    To begin with, I have a Network Manager and a Player Prefab which allows me to connect as host or client with separate Cameras and Inputs (it means that me and my friend can connect, we will have our own player, camera etc...)

    So here's my point:
    - I have an objet in my scene called "MapGenerator" which contains one script called "Endless Terrain" (like in the tutorial)
    - The goal of this script is to generate planes (acting as chunks for the moment) around the player ("viewer" in the tutorial), and disable them when he is too far (working perfectly with one player)

    So I tried to adapt the code to make this multiplayer but I'm currently unable to make it works.
    What I've tried :
    • Have a list of viewers in my script and iterate through it to update each player chunks in the update method (didn't work)
    • Duplicate the "MapGenerator" for each object (kinda worked but costs performance and duplicates of chunks)
    • In the Update method of my players, taking the place of the viewer (for example we have 2 players P1, P2, viewer is P1, then P2 then P1 etc...) but it feels like hacking so I gave up
    After all of this, I checked the manual of Multiplayer and Networking in Unity but there is so much things that I'm unable to find what to use... (Network Behaviour with Commands, ClientRPC, SyncEvents?)

    I hope I'm clear in those explanations and thank you for reading (and maybe answering :D)
     
  2. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    You may want to try the new FPS Multiplayer to get another set of development that you can learn.
    https://unity.com/fps-sample

    Cheers and good luck to your project.
     
  3. Martelement

    Martelement

    Joined:
    Jan 26, 2018
    Posts:
    7
    I just finished building the game in Unity, but it is tough because it has so many things in it.
    But anyway thank for the advice i'm looking into it

    If you have more things, please tell me