Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

some question about multiplayer game with Pun2

Discussion in 'Multiplayer' started by Na50, Jun 19, 2022.

  1. Na50

    Na50

    Joined:
    Jan 21, 2022
    Posts:
    6
    Hi,

    I am looking into multiplayer game development with Unity and Pun2. I have some basic questions:

    - Is there a way I can create rooms that have no player as owner.
    I assume when a room is created by a player it will be destroyed when that player left the game right? Is there a way to avoid that? I mean once a room/game has been created I want it to stay and just finish based on some other criteria like time or when the game finished by itself etc.

    - Is it needed to have one scene per room in unity? Say I have few prebuilt scenes and I want one be used each time a room is being created. Should I instantiate a new copy of that scene in unity per each room that is being created?

    - do non interactable objects need any synching or network components? for example walls or objects in scene that do not move. should I add any photon component to them or they just need to be in scene like single player games and they will be available and work the same for all players?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,945
    Rooms can be created by anyone and they only get removed, when everyone left. The server for the actual room is a Photon (Cloud) Server.
    Clients can close a room (so nobody else can join anymore), so you don't need to worry about anyone joining very late.

    Clients can load any scene they like. You could also load multiple but PUN can only sync one scene (optionally).

    You don't need to sync static objects or those, which will be shown locally only.

    The PUN Basics Tutorial may be a good first iteration.
    Disclaimer: You will notice that PUN 2 is the oldest of our multiplayer solutions. Our state of the art multiplayer SDK is called Fusion.
     
    r31o likes this.