Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question MLAPI while still supporting Local/Couch coop multiplayer

Discussion in 'Netcode for GameObjects' started by julcreutz, Aug 22, 2021.

  1. julcreutz

    julcreutz

    Joined:
    May 4, 2021
    Posts:
    27
    How would I go about supporting both local (couch coop) AND online multiplayer?

    Seeing as NetworkManager singleton's client is only meant to be one player, would I need to seperate implementations for local/online multiplayer?
     
  2. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    Yeah at the moment you would need a separate implementation. We've removed the singleton restriction and with our next release you might be able to run multiple NetworkManager instances in the same application. But it won't be a fully supported workflow and might have some limitations.
     
  3. julcreutz

    julcreutz

    Joined:
    May 4, 2021
    Posts:
    27
    Gotcha.
     
  4. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    You can do it by separating the concepts of "player" from "character" so a player (representing a connection) owns and controls multiple characters.
     
    luke-unity likes this.
  5. HeliocentricStudios

    HeliocentricStudios

    Joined:
    May 29, 2014
    Posts:
    1
    Sorry for bumping quite an old thread but I was wondering if any progress has been made for this?

    I have a test project which is working fine in single player and online co-op using Netcode for GameObjects but I want to test local co-op before going forward any further.

    If not Neto_Kokku's workaround seems interesting and I'll likely attempt that if this is still the best current setup.
     
  6. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Hi @HeliocentricStudios , AFAIK there are ways to connect multiple players from the same machine (we use these in our automated tests), but it requires workarounds too and, in the end, would probably be more complicated than what Neto suggested.

    I'd start the game as a Host and create 2 "local" players. Easier said than done, but it's a starting point.