Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Party Photon Unity Networking

Discussion in 'Multiplayer' started by tobiass, Aug 23, 2011.

  1. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Sounds like you are not willing to add features needed by your customers.
    In fact two masterClient in the same room is a BUG. You should really fix it.
    BTW, ok i move the discution to there:
    http://forum.photonengine.com/discu...ent-issue-with-inactive-tab-in-browser#latest
    hope its not a dead end, see you there.
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I never said we don't want to fix the issues you are encountering.
    This change is simply not as easy as it's description: "Never have two Master Clients" is easier said than done when one of those neither reacts to network, nor runs Update() when it's paused.
     
  3. StealThePixels

    StealThePixels

    Joined:
    Apr 2, 2015
    Posts:
    68
    Not urgent, i think i'll ship by this Christmas or in January 2016
     
  4. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    hi, i need help, i try to change appversion vrom 1.0 to 2.0 and show me room from version app 1.0 here is my script, plzz help me, i want to make an update to my game and i change gun, add new map , and i need to now show rooms vrom version 1.0 , here script
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ServerChose : MonoBehaviour {
    5.     bool connected=false;
    6.     int connectiontryings=0;
    7.     // Use this for initialization
    8.     //public string appversion = "v3.0";          //  mobile version nd change all  GameVersion  to  GameVersion
    9.     public string GameVersion = "1.0";     //  web version and change all  GameVersion to GameVersion
    10.     public GameObject lob;
    11.     public GameObject serverdialog;
    12.     void Update(){
    13.         if(PhotonNetwork.connected){
    14.             Debug.Log("conected");
    15.             serverdialog.SetActive(false);
    16.             lob.SetActive(true)    ;    }
    17.        
    18.     }
    19.     public void us (){
    20.         PhotonNetwork.ConnectToRegion(CloudRegionCode.us,GameVersion);
    21.        
    22.        
    23.     }
    24.     public void eu (){
    25.         PhotonNetwork.ConnectToRegion(CloudRegionCode.eu,GameVersion);
    26.        
    27.        
    28.     }
    29.     public void au (){
    30.         PhotonNetwork.ConnectToRegion(CloudRegionCode.au,GameVersion);
    31.        
    32.        
    33.     }
    34.     public void asia(){
    35.         PhotonNetwork.ConnectToRegion(CloudRegionCode.asia,GameVersion);
    36.        
    37.        
    38.     }
    39.     public void jp (){
    40.         PhotonNetwork.ConnectToRegion(CloudRegionCode.jp,GameVersion);
    41.        
    42.     }
    43.    
    44.    
    45.     public static void chooseserverondisconect(){
    46.         PhotonNetwork.Disconnect();
    47.        
    48.     }
    49.     void OnDisconnectedFromPhoton(){
    50.         ConnectMenu.chooseserve=false;
    51.         lob.SetActive(false);
    52.         serverdialog.SetActive(true);
    53.     }
    54.     //****************/
    55. }
    56.  
     
  5. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    You can't list rooms of other versions.
    PUN's game version is deliberately designed to completely separate players of different versions.
    If you want to mix versions, make up your own value and maybe send this as Room Custom Property. But of course, we can't give you any guarantees that client-versions will not crash each other.
     
  6. awaterpistol

    awaterpistol

    Joined:
    Sep 3, 2015
    Posts:
    25
    Is there a way to stop PUN accepting older connections and force them onto website to download latest update?

    Example: Say someone is exploiting my game, we release a patch and only a small number of people actually update. The majority of the people are still vulnerable to any exploits.

    Better Example: We'll be using the same DB to keep track of rank, weapon unlocks etc. If we can't force someone onto the latest patch, they can unlock everything for themselves and THEN upgrade.

    Is there a way to make the PUN server force older builds out?

    Whilst writing this I thought of PUN Server. If I switch to server edition, can I force the server to kick old builds offline?
     
  7. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    You can use Photon's Custom Authentication feature for that. With that, you don't have to modify and run your own Photon Servers but you still need one extra web-service to customize it:

    With Custom Authentication, you'd normally check a user's account, but your clients can send the version (with or without login and password) and your authentication web service can accept/reject clients based on the version.
    The response for Custom Authentication includes a message, which you can set in your auth web service. With the help of that, you can differentiate between actual auth errors and an outdated version being rejected.

    As an intro, read this:
    http://doc.exitgames.com/en/pun/current/tutorials/pun-and-facebook-custom-authentication
    For questions about the Custom Auth Service, please ask in our forum.
     
  8. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    this is my problem if i change appversion from 1.0 to 2.0 it show list of old room version 1.0 and i dont want , plzz help
     
  9. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
  10. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    man you ssend me all time read and read, but not solve my problem, i read and dont see what is my problem, list rom of old version v1.0 still show , my version now is v2.0 but is setup for nothing , is anybody here who know to solve my problem ?
     
  11. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Maybe you are changing this value in code? It's public, so the value set in inspector will override the value defined via code (it's used as inspector default value).
    Check if GameVersion is different in your builds, as you expect...
     
  12. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    thx i fixed
     
    Last edited: Nov 12, 2015
  13. CB-TV

    CB-TV

    Joined:
    Sep 21, 2012
    Posts:
    9
    I've read through a bit of this forum as I have a similar problem. Basically, I have two errors associated with UNetWeaver:
    and

    I do not have any PUM/networking/multiplayer assets and I have discovered the file which causes this error: the Utility/FOVKick.cs When I delete the script, the error goes away but I obviously need this script for the FPS controller.

    I do have another error:

    if that's linked to this but I'm not sure. I thought updating to the newest version of Unity would fix it but it hasn't. Any help?
     
  14. Zackhanzo

    Zackhanzo

    Joined:
    Jun 5, 2014
    Posts:
    65
    Hi guys, first at all, i dont know if i can post my question here...
    Its my first time using Photon so im kinda noob on this. I followed 2 tutorials from quill18creates and paladinstudios before posting this... but i cant find the problem.

    I got 1 player with: movement script, animator, photon view with the transform of the pj attached (Unreliable on Changes and PosandRot) ,character controller, mouselook and a photon animator view and an own script called NetworkChar.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class NetworkChar :Photon.MonoBehaviour {
    5.  
    6.     // Use this for initialization
    7.  
    8.     Vector3 realPosition;
    9.     Quaternion realRotation;
    10.  
    11.     void Start () {
    12.  
    13.  
    14.  
    15.     }
    16.  
    17.     // Update is called once per frame
    18.     void Update () {
    19.  
    20.         if (photonView.isMine)
    21.         {
    22.             //Input is moving the player
    23.         }
    24.         else
    25.         {
    26.             // get more accurate pos and rot
    27.             transform.position = Vector3.Lerp(transform.position,realPosition,0.1F);
    28.             transform.rotation = Quaternion.Lerp (transform.rotation,realRotation,0.1F);
    29.        
    30.         }
    31.  
    32.     }
    33.  
    34.     public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    35.     {
    36.         if (stream.isWriting) {
    37.             // Our player. Send his info
    38.             stream.SendNext(transform.position);
    39.             stream.SendNext(transform.rotation);
    40.  
    41.         } else
    42.         {
    43.             //Another pj. Recieve his pos
    44.             transform.position= (Vector3) stream.ReceiveNext();
    45.             transform.rotation=(Quaternion) stream.ReceiveNext();
    46.         }
    47.     }
    48. }



    And 1 global script on my scene with the typical photon connections.NetworkManager

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class NetworkManager : MonoBehaviour {
    5.  
    6.     // Use this for initialization
    7.  
    8.     public string verName;
    9.     public GameObject playerPrefab;
    10.     public Camera camera;
    11.  
    12.     TeamID[] spots;
    13.  
    14.     void Start () {
    15.  
    16.         spots = GameObject.FindObjectsOfType<TeamID> ();
    17.         Connect ();
    18.  
    19.     }
    20.  
    21.     // Update is called once per frame
    22.     void Connect() {
    23.  
    24.         PhotonNetwork.ConnectUsingSettings (verName);
    25.  
    26.         }
    27.  
    28.     void OnGUI()
    29.     {
    30.         GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
    31.     }
    32.  
    33.     void OnJoinedLobby()
    34.     {
    35.         Debug.Log ("OnJoinedLobby");
    36.         PhotonNetwork.JoinRandomRoom ();
    37.     }
    38.  
    39.     void OnPhotonRandomJoinFailed()
    40.     {
    41.         Debug.Log ("OnPhotonRandomJoinFailed");
    42.         PhotonNetwork.CreateRoom (null);
    43.     }
    44.  
    45.     void OnJoinedRoom()
    46.     {
    47.         Debug.Log ("OnJoinedRoom");
    48.         SpawnMyPlayer ();
    49.     }
    50.  
    51.     void SpawnMyPlayer()
    52.     {
    53.         if (spots == null)
    54.         {
    55.         }
    56.  
    57.         camera.gameObject.SetActive (false);
    58.         TeamID mySpawnSpot = spots [Random.Range (0, spots.Length)];
    59.         GameObject myPlayerGO=(GameObject)PhotonNetwork.Instantiate (playerPrefab.name, mySpawnSpot.transform.position, mySpawnSpot.transform.rotation, 0);
    60.         myPlayerGO.GetComponent<PlayerMovement3D> ().enabled = true;
    61.         myPlayerGO.GetComponent<MouseLook>().enabled=true;
    62.         myPlayerGO.transform.FindChild ("Camera").gameObject.SetActive (true);
    63.         myPlayerGO.GetComponent<CharacterController> ().enabled = true;
    64.     }
    65. }


    When i launch the game, i can see the 2 players. My own player on both instances (exe and unity3d) looks good, but the other player is blinking so fast, and i cant understand why.

    I tried removing this lines from NetworkChar:

    Code (CSharp):
    1. transform.position = Vector3.Lerp(transform.position,realPosition,0.1F);
    2.             transform.rotation = Quaternion.Lerp (transform.rotation,realRotation,0.1F);


    Works laggy but it works. But if i try to smooth the movement like squill18creates, paladinstudios or Marco Polo tut did, something weird-blinks appear....
     
    Last edited: Nov 18, 2015
  15. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Zackhanzo: Sure you can post your question here.
    It sounds like a typical issue when multiple updates are applied to the same object. Local ones and the remote ones.
    You need to double check if you have only 2 characters instantiated and if all scripts are enabled/disabled the way you intended to.
    Also make sure that the remaining scripts use "isMine" checks where needed. Input should only be applied to "your" local character. Lerping should only be applied to characters of other users (remote ones).
    In the Marco Polo Tutorial, it should be working, if you follow the instructions.
     
  16. Zackhanzo

    Zackhanzo

    Joined:
    Jun 5, 2014
    Posts:
    65
    Ya, that was the problem. I mixed quill18creates and Marco Polo tutorial and i did weird stuff on the scripts.
    Started another project, and i tried to do myself with that documentation and the project works flaweslly now.
    Thanks!
     
  17. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Zackhanzo: Good to read! Thanks for the update.
    everyone: have a nice weekend! :)
     
  18. TheArchitect485

    TheArchitect485

    Joined:
    Aug 5, 2015
    Posts:
    7
    Hi. I'm working on a multiplayer game in Unity 5.something.somthingfsomething and i've made I spawn system. When the Spawn function is called, I get this error:
    PhotonView with ID 1 has no method "Spawn" that takes 1 argument(s): Byte
    What really confuses me is that yes, that function does exist in all instances. I thought it might be the way it's being called, but it wasn't that either. Here's the code:

    public void StartGame()
    {
    if(PhotonNetwork.isMasterClient)
    {
    GetComponent<PhotonView>().RPC("Spawn", PhotonNetwork.playerList[0], PunTeams.Team.red);
    GetComponent<PhotonView>().RPC("Spawn", PhotonNetwork.playerList[1], PunTeams.Team.red);
    GetComponent<PhotonView>().RPC("Spawn", PhotonNetwork.playerList[2], PunTeams.Team.blue);
    GetComponent<PhotonView>().RPC("Spawn", PhotonNetwork.playerList[3], PunTeams.Team.blue);​
    }​
    }

    [PunRPC]
    void Spawn(PunTeams.Team team)
    {
    blah blah blah function stuff​
    }
     
  19. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I assume that PUN has an issue with sending the Team type. You should cast it to byte before you send it and then accept a byte in the RPC method, too.

    As long as you hard-code the player-index to some team, why do you need to send this at all?
     
  20. TheArchitect485

    TheArchitect485

    Joined:
    Aug 5, 2015
    Posts:
    7
    That is a good point, but I figured out A fix just by sending it as a string instead and then converting it in the actual function that sets the teams
     
  21. TheArchitect485

    TheArchitect485

    Joined:
    Aug 5, 2015
    Posts:
    7
    And another thing, the editor stops responding when I hit play do you know if that could be caused by PUN? (stack overflows, unity trying to output billions of errors, etc)
     
  22. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I am not aware of an issue with Editor Play mode. We even stop the connection when Unity re-compiles while you are in play mode.
    Could it be some other plugin? Or some clash of plugins?
     
  23. Zackhanzo

    Zackhanzo

    Joined:
    Jun 5, 2014
    Posts:
    65
    Hi again! Ive been working in some prototypes to see how photon works and all were good. But ive been trying to make a prototype of 2 players (1vs1) with a ball (Something like a small rocket league) and i got some issues.

    How can i instantiate just one GO for all the players?

    Right now i got 2 empty GO. 1 dealing with conections and a child dealing with this ball spawn.

    Code (CSharp):
    1. Void Update()
    2. {
    3.                  if (ball == 0 && photonView.isSceneView) {
    4.                 if (mm.gameStarted == true) {
    5.                     countDownSpawnFirstBall -= Time.deltaTime;
    6.                    if (countDownSpawnFirstBall<0)
    7.                     {
    8.                     countDownSpawnFirstBall=0;
    9.                     }
    10.  
    11.                     if (countDownSpawnFirstBall == 0 && loop==1 ) {
    12.                         pv.RPC ("BallSpawn", PhotonTargets.All);
    13.                         loop++;
    14.  
    15.                     }
    16.      
    17.  
    18.   }
    19.  
    20. [PunRPC]
    21.     void BallSpawn()
    22.     {
    23.         if (pv.viewID==99 && PhotonNetwork.isMasterClient==true)
    24.         PhotonNetwork.Instantiate (ballObject.name, this.transform.position, this.transform.rotation,0);
    25.     }
    Right now is spawning 2 balls, and i dont really know why. I didnt find something about this in the documentation and looking for something like this over the .net i just found how to instantiate bullets (and i already instantiate some bullets lol).
     
    Last edited: Dec 1, 2015
  24. aci4

    aci4

    Joined:
    Jun 3, 2015
    Posts:
    8
    Hello,

    I have two question before buy the PUN+.

    I am programing for PSVita, I would like to know if PUN+ works in Vita as well as in Android, PC or IOS. I think so but i prefer to ask for it.

    The second question is if the PUN+ works with Unity 5.1.2 or higher.

    Thanks in advance for your feedback,

    Rafa
     
  25. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    Hello tobiass and the rest of the Photon Team,

    I just want to say that working with PUN so far has been a pleasure. Most of the time with Unity packages I'm left wanting for features. With PUN every time I come up with something that "I wish it had...", a little search confirms that it is already a feature.

    I was able to integrate the multiplayer in about 8 hours to get everything in game working to a bare minimum level (I'll hopefully finish everything up in the next day or two). Amazing! Also, thanks to the great documentation, I took the risk of designing and coding the UI before I integrated PUN. Because of my full understanding thanks to those docs, everything worked as planned without any rewrites or changes.

    I couldn't be happier :)

    Thank you for the great product!
     
  26. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @aci4: We do support PSVita but we didn't test PUN with the latest version of Unity for Consoles. Please try to export the PUN Free package to the PSVita. It should work out of the box. Content-wise, the PUN Free and the PUN+ package are the same for Unity 5.
    If anything doesn't work, just drop us a mail at developer@exitgames.com, please.

    @nikescar: Thanks for the very nice feedback! It's fantastic to read it's working out so well for you. Looking forward to know your game :)
     
  27. aci4

    aci4

    Joined:
    Jun 3, 2015
    Posts:
    8
    Great!! When I finish to debug my game I will try it. If I have any trouble/question I will tell you.

    Thanks!!

    R.
     
  28. Superl0l

    Superl0l

    Joined:
    Nov 23, 2015
    Posts:
    9
    Hey Tobiass i have a quick question.
    I know that PUN is room-based, however is it possible to make a game with only 1 room, that will stay alive 24/7?
    Like a small-mmo, with maybe 15-20 players online ..
    I think that i've read somewhere that if the room stays up too long it will run out of memory, but what about closing the server when nobody is online and resetting the server every once in a while? (A reboot function)
    If its possible, since the game is rpg-like, i'd have to keep all the players stats,items, etc on a database. So if someone connects to the room, is there a way that he won't be the host ? I'd want to keep the data on the host's computer, and obviously there will be only 1 host.

    Thanks in advance!
     
  29. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Superl0l: We designed the basic logic of Photon for finite, room based games, which end, if there is no player active anymore. This got extended in Photon Turnbased, where rooms can get stowed away and loaded on demand, later on. The room exists as long as someone is in the room (active or inactive).
    I guess you could use something like that for your game. It's better to be able to save and load a state, than rely on the server permanently. Also, it's better to also assume that every client might lose connection and not run. Otherwise, your master would be the single point of failure.
    If you're fine with that, you could run a "host" (Unity build) along with Photon. Your clients could simply try to join a game and only the host would create one and keep the state. That's doable and easier but not failsafe.

    I would use the Photon Server SDK to modify the Room logic to keep the world state, save and load it, etc..
    Drop by in our forum, to discuss with the server guys.
     
  30. Superl0l

    Superl0l

    Joined:
    Nov 23, 2015
    Posts:
    9
    I will do that, thanks.
     
  31. killer_bigpoint

    killer_bigpoint

    Joined:
    Jul 11, 2015
    Posts:
    20
  32. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
  33. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    I have problem with latest Unity 5.3.0

    Code (CSharp):
    1. Assets/Photon Unity Networking/Plugins/PhotonNetwork/SocketWebTcp.cs(24,17): error CS0246: The type or namespace name `WebSocket' could not be found. Are you missing a using directive or an assembly reference?
    2.  
     
  34. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Demonith88: Please import the package again and make sure you got the websocket-sharp.dll in your project.
    It has to be setup for "Editor" usage exclusively.
    WebSocket does not work for any other exports. Only WebGL exports and in Editor.
     
  35. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    Where i can get websocket-sharp.dll
     
  36. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    It's in the PUN package. Re-import, to make sure you get it.
     
  37. elinbasol

    elinbasol

    Joined:
    Oct 9, 2014
    Posts:
    9
    Hi, guys how can i send a RPC from my GameManager, i was trying but it require the component PhotonView, then i add the PhotonView to my script, but it doesn't work because my manager is no instantiate by the network, then i try adding the PhotonView by script during run time and it doesn't work, the reason is that when I instantiated my player over the network, i customized the player with some parameter, and i need to send the RPC to the others player, and the modification or customization is doing by the manager no by the player, so any idea about how to solve that?
     
  38. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    You can add a PhotonView to any object in the scene (so you don't need to instantiate it at runtime).
    This PhotonView can be used by any script requiring one.

    If you use multiple scenes, you should probably add scripts to the GO so it's not destroyed on load (DontDestroyOnLoad()) and to make sure it's only created once.
     
  39. elinbasol

    elinbasol

    Joined:
    Oct 9, 2014
    Posts:
    9
    ok, i solve that step, now i have another problem, is that i set the parent of a transform by rpc, but the other player who join after cant see that, i use in the photon target the AllBufered option for example:

    photonView.RPC("LoadingPlayerFeature",PhotonTargets.AllBufferedViaServer);
    }

    }

    [PunRPC]
    voidLoadingPlayerFeature()
    {
    if(photonView.isMine){
    MaterialArray=newMaterial[1]{MaleSkinMaterial};

    if(Sex==0){
    MaleSex=true;
    PlayerIdentity=(GameObject)PhotonNetwork.Instantiate("Player/PlayleablePlayer",newVector3(18.53401f,5.69f,20.19398f),Quaternion.Euler(0.0f,356.3036f,0.0f),0);
    PlayerIdentity.name=Manager.Account;
    Player=(GameObject)PhotonNetwork.Instantiate("Player/Prefabs/Male/MaleGraphic",PlayerIdentity.transform.position,PlayerIdentity.transform.rotation,0);
    Player.transform.parent=PlayerIdentity.transform;
    Player.name="Player";
    PlayerIdentity.SetActive(false);
    PlayerIdentity.SetActive(true);
    PlayerIdentity.GetComponent<Animator>().avatar=MaleAvatar;
    PlayerIdentity.GetComponent<Animator>().enabled=true;
    PlayerIdentity.GetComponent<InputPlayerMovement>().enabled=true;
    PlayerIdentity.GetComponent<CinematicIkLogin>().enabled=true;
    PlayerRender=Player.transform.Find("Piel").GetComponent<SkinnedMeshRenderer>();
    Hair=Player.transform.Find("Hair1").gameObject;

    NOTE: it's a piece of the script
     
  40. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    You check isMine at the beginning of the RPC. That's only true for one player, right? Others won't execute the code after that.
     
  41. elinbasol

    elinbasol

    Joined:
    Oct 9, 2014
    Posts:
    9
    yes, before and now i try without isMine and happen the same thing, i added is mine because when others layer join to the room this code instantiate another player, and this code is supposed to work only with my player, because the others have this script too.
     
  42. Ardetiaproductions

    Ardetiaproductions

    Joined:
    Mar 4, 2015
    Posts:
    7
    I am having issues that some clients does not see other clients. Some clients still do tho, so I don't understand what happens.

    All gameobjects is instansiated with photonnetwork, but sometimes some clients is completely invisible (although not the other way around, as in the invisible player can see the normal player)

    Anyone have any idea how to fix this? Happens pretty often.
     
  43. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @elinbasol: I don't know where your scripts fail. It's hard to tell without checking the whole project, which would cost too much time.
    I just saw you use PhotonNetwork.Instantiate in the RPC. This means that everyone who runs that code, will network-instantiate a new character. The point is: PhotonNetwork.Instantiate replicates the instantiation on all clients in a buffered manner.
    This has potential to make your idea fail.
    Just use PhotonNetwork.Instantiate or do the RPC and a normal Instantiate.

    @Ardetiaproductions: That description is too vague, sorry. You might want to experiment with instantiation, as described in the Marco Polo Tutorial and other docs - independent from your current project. Just to get this right.
     
  44. tinman

    tinman

    Joined:
    Jan 8, 2011
    Posts:
    229
    @tobiass
    New to Photon.
    I would like to set up the following structure:
    My own dedicated servers. They run my game instances (eg each room is an .exe). These rooms register in the Photon cloud to be listed as rooms to connect to for my game when the players want to find a room.
    The game is synchronous multiplayer.
    How would I set this up? Do I need Photon Server? Or can I set everything up with Photon realtime?
    Thank you!
     
  45. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @tinman: If you have dedicated servers, you don't need Photon Cloud. You could run Photon with matchmaking and load balancing. We're working on a product that can run a .exe per room but unless you have serious reasons, you should avoid this setup. It might be expensive (you need CPU and memory and maybe even GPU. All of that make servers expensive in the sense that fewer users/rooms run on the same hardware).

    You could start with the Photon Cloud for convenience and see if that base logic is somehow working for you.
    Else, get and run the Photon Server SDK as described here.
     
  46. tinman

    tinman

    Joined:
    Jan 8, 2011
    Posts:
    229
    @tobiass Thanks very much. I would like dedicated servers for the reason that the game is synchronous multiplayer on mobile, and I'm afraid that having a mobile internet connection as well as a mobile CPU for the server-side checks will create lag for the rest of the players. However I thought of using the Photon Cloud in order to register the rooms so players can see them and connect to them. Does that make more sense?
     
  47. elinbasol

    elinbasol

    Joined:
    Oct 9, 2014
    Posts:
    9
    i find the main problem, the main problem is set the parent of the another prefab, it occurred because when i instantiate the player i set the variable, but it isn't set by network, however if i instantiate by RPC and set the variable, it doesn't work because everyone who run the code instantiate a new character and forget that is my character that is supposed to set the parent, so any way for solve that?
     
  48. Ardetiaproductions

    Ardetiaproductions

    Joined:
    Mar 4, 2015
    Posts:
    7
    Well, the issue will still be there.

    Issue more described:

    10 players join a room. Every player instantiate one gameobject prefab each, nothing happens wrong here.
    Every now and again 1 of those 10 players does not see one specific player, and can't interact in any way to that one player. The player that he can't see can interact without any issues on the player that is having the issue. The rest of the players does not experience the issue at all.

    Only fix I have found for now is that the invisible player rejoins.

    Easy description:

    One player becomes completely invisible for one or more other players. However the players having an invisible player is completely fine from the invisible players point of view.
     
  49. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    We released a new PUN version. This time, we fixed a few minor issues and the "obsolete" warnings in Unity 5.3. My favourite is the overhaul of the "Boxes Demo" with colors per player and more obvious use of RPCs. Hopefully good for beginners.

    v1.65 (16. December 2015)

    Fixed: Potential NullReference Exception when transfering ownership. The PhotonView which gets transfered might get destroyed before the transfer is complete and that case is now handled.
    Fixed: PUN Wizard for Unity 5, which incorrectly pointed out that you need PUN+ to export to iOS or Android. This was the case in Unity 4 but it's no longer true. Removed this note.
    Fixed: Automatic configuration of the demos, when you import PUN (with demos) into a new, empty project and have no saved (named) scene open. This is done once per Editor only. You can do this in the Editor Main Menu: Window, Photon Unity Networking, Configure Demos.
    Fixed: Compatibility with Unity 5.3. The new SceneManager class is re-implemented for our needs for older Editors and the code got adjusted. No "obsolete" warnings anymore.
    Added: Useful component to select a color per player (out of a configurable list of available colors). Check out: ColorPerPlayer.
    Updated: Boxes Demo. This demo now uses the ColorPerPlayer and ColorPerPlayerApply scripts to colorize each player's cubes. Also, it shows more clearly how RPCs work. There are more tips at runtime, too.
    Fixed: Friends And Custom Authentication Demo. A script was waiting for the client to join the lobby, which isn't done anymore by default. Now the UI is fixed to show when connected to the Master Server, where FindFriend() can be called.
     
  50. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    If you run your own, dedicated servers, you can run Photon on them for matchmaking and loadbalancing. It manages the rooms for you, as you say. Aside from that, you could decide if you can do your game-logic in Photon or if you want to spin up dedicated Unity instances as server, too, running on the same machines. It's technically sound and doable with Photon Squad, but can be expensive per player.
    To get hands on Photon Squad as soon as possible, mail to: developer@exitgames.com

    Read the documentation's section about "Manual Instantiation" and try to get that working for you in a simpler test project.
    Hope that helps.

    This is no known issue in PUN and might be related to timing and the logic when/how to instantiate stuff. Look out for exceptions (important) and try to find out if it's specific timing or something.