1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. Unity 5.6 is now released.
    Dismiss Notice
  3. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice

Photon Unity Networking

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

  1. RF008

    RF008

    Joined:
    Oct 28, 2016
    Posts:
    20
    Try to use vpn it was simple
     
  2. MohammadAlizadeh

    MohammadAlizadeh

    Joined:
    Apr 16, 2015
    Posts:
    7
    Hi
    My photon cloud for some mysteries reason can't connect and gives me time-out error
    is there any restriction over Iranian users? i turned on VPN or Proxy but didn't work
    i could use it before (last year) and have fun with it but now says 'Peercreated' :(
    i'm using the latest version of Photon and Unity 5.4.0 p2
    Thanks

    unity log:
    Deeeeer.png
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    @Shivam_Dhoot: We don't have support for Proxys in Photon.
    You could potentially run a Photon server in the network instead of using the Cloud. Check out our Server SDK. Running a Cloud-compatible Photon Server does not require any compilation. A little setup is doing it.
    Of course, in the net, the ports have to be unrestricted. If you can't get that, I don't know if we can help.
    This week, I was off sick and busy. I hope you can figure out something with the Server .exe.
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    @MohammadAlizadeh: I'm sorry to say, but Iranian users are in fact blocked. The hoster for our cloud machines applies this restriction. I think you could get the Photon Server SDK and run a server locally for development.
    I hope you get your chance to make your multiplayer game.
     
  5. MohammadAlizadeh

    MohammadAlizadeh

    Joined:
    Apr 16, 2015
    Posts:
    7
    Uhh ok i got it..I'm using unity's Unet now, works great
    Thanks for reply
     
  6. RF008

    RF008

    Joined:
    Oct 28, 2016
    Posts:
    20
    Hello
    i need sample script for matchmaking based on ranks i need script where i can set some rank to user and check if it was in between say rank 5 - 8 or 9-12 etc.
    Ex player a have rank of 6 and player b was having rank of 8 then they need to join the game.
     
  7. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    42
    Hi,Would this be an appropriate place to post a Photon Multiplayer Car Test?
    Thanx,
    Steve
     
  8. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
  9. stvster

    stvster

    Joined:
    Mar 4, 2013
    Posts:
    42
    Thanx tobiass.
     
  10. zazoum

    zazoum

    Joined:
    Sep 3, 2011
    Posts:
    62
    Hello, new to Networking, my first multiplayer game, a top-down 2D shmup arena.
    I used PUN and everything runned smoothly eventually in my first attemps and tests except a thing. The shmup ships move around and one sees another move smoothly. But a small, a bit lag seems to be created a the game runs and gets bigger and bigger over time. This leads to jumps in the "other" ships' movement about at the 5 minute mark.
    I live in Greece and set up the preferences to EU Photon Server. I also tested this to different connections, so I don't think it is a "my" connection problem.
    The player observes only one script nested to the "other" ships gameobjects which is the following:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class NetworkCharacter : Photon.MonoBehaviour {
    5.  
    6.     Vector3 realPosition = Vector3.zero;
    7.     Quaternion realRotation = Quaternion.identity;
    8.  
    9.  
    10.     void Start () {
    11.    
    12.     }
    13.    
    14.  
    15.     void Update () {
    16.         if( photonView.isMine ) {
    17.  
    18.         }
    19.         else {
    20.             transform.position = Vector3.Lerp(transform.position, realPosition, 0.1f);
    21.             transform.rotation = Quaternion.Lerp(transform.rotation, realRotation, 0.1f);
    22.         }
    23.     }
    24.  
    25.     public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
    26.         if(stream.isWriting) {
    27.  
    28.  
    29.             stream.SendNext(transform.position);
    30.             stream.SendNext(transform.rotation);
    31.         }
    32.         else {
    33.  
    34.            
    35.             realPosition = (Vector3)stream.ReceiveNext();
    36.             realRotation = (Quaternion)stream.ReceiveNext();
    37.         }
    38.  
    39.     }
    40. }
    There are of course 2 other scripts in the ship, one for movement and rotation, and one for camera, but those are not observed.
    Anybody has an idea?
     
  11. zazoum

    zazoum

    Joined:
    Sep 3, 2011
    Posts:
    62
    Furthermore, are there series of up to date video tutorials that explain all the features of PUN? There are some in in Photon website as links, but they are from like 2014. Should I trust them?
     
  12. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    49
    Is Photon right for me if I want my players to:

    - Host their own dedicated server
    - Allow at least 100 players per server
    - Allow unlimited global players

    Is it still free at this point or is there a huge license cost?
     
  13. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    143
    I'd be interested in that as well.
    It's somewhat unclear to me what exactly we're paying for when we want to host our own servers...

    Also, does photon support [SyncVar] ?
     
  14. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    We submitted v1.81 to the store. It should be up in a while.

    v1.81 (16. March 2017)
    Updated: Basic Demo Launcher.cs: removed Log Level setup, it's now done in the Photon Settings.
    Updated: Chat Demo ChatGui.cs: removed running in background setup, it's now done in the Photon settings.
    Fixed: NetworkingPeer.cs: Fixed Scene Object OwnerShip transfer on late Join.
    Fixed: ColorPerPlayer.cs and ColorPerPlayerApply.cs for a more robust connection with PlayerRoomIndexing.cs instance.
    Fixed: Ownership handling when returning to a game.
    Updated: Setting the log levels via code will now override the logging settings ("Pun Logging" and "Network Logging") from the PhotonServerSettings config.
    Updated: Demo Hub scene to better highlight tutorial links versus links to online documentation.
    Updated: Link for PhotonAnimatorView trigger doc url.
    Added: Callback OnOwnershipTransfered. Called when a PhotonView Owner is transfered to a Player.
    Added: Callback OnPhotonPlayerActivityChanged. Called when a remote Photon Player activity changed. This will be called ONLY is PlayerTtl is greater than 0. Check PhotonPlayer.IsInactive for the player.
    Added: GetCustomRoomList(). Enables you to fetch a short, filtered list of room names from an "SQL lobby".
    Fixed: Basic Demo Launcher: Fixed 5.4+ SceneManager OnSceneLoad callback to not throw errors when coming back to the demo hub
    Fixed: ColorPerPlayerApply.cs: Disable routine was not safe and would throw errors
    Changed: WebGL exports will now use secure https "GetPing" requests. This enables Best Region for content on https hosting.
    Changed: The fallback thread to keep connections doesn't have to run when in offlineMode.
    Updated: The Photon assemblies to v4.1.1.9, which includes several fixes. E.g. "WouldBlock Exception" and "BlockCopy Exception". More info is in the release history file for the dll.
     
  15. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    @zazoum: The steering of a game affects how incoming position updates need to be smoothed. If the control is direct, you might want a character to "skip" to the latest known position, should it differ from the local one. If the control is smooth and slow, the interpolation can work with that.
    Sadly, we did not find the one awesome solution to cover all. You need to get behind it and experiment.
    About the tutorials: As usual, tutorial quality may vary quite a bit. The basics of PUN are still the same as 2013 but code might differ somewhat (due to renaming, new options, etc). If the tutorial isn't about something you already know, you should be able to learn something.

    @Zymes: If your players should host Photon, you need a "Redistributable License". Usually, those are for up to 50 CCU, so please ask us by mail: developer@exitgames.com. I'm not sure if we can cover the "unlimited servers and unlimited CCU per dedicated host" requirement.

    @dadude123: Well, you might be hosting Photon yourself but you sure didn't write it. So you're paying for software. It's not like you have to all the work ;)
     
  16. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    143
    I'm sorry you misunderstood me, I didn't word that right! I didn't mean to question the initial price, that one is fine! :)

    I was asking about that CCU limit (and the costs associated with increasing that limit). When I'm hosting my own servers and I don't use any sort of matchmaking or anything else that would cause any sort of traffic to the servers hosted by you guys, then does the CCU even affect me?
     
  17. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    49
    Photon looks very interesting compared to UNET but you guys need to work out a system/license or whatever for an approach where players can host their own dedicated servers like in ARK, Conan Exiles, Team Fortress, Blackwake, and many other games do. Not just a small session of ~4 players.

    This is the only sane solution for indie developers who can't host hundreds of dedicated official servers because of the sheer cost and instead have the community do it.
     
  18. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    @dadude123: Maybe I just didn't get your post yesterday. Thanks for the clarification! :)
    We are scaling the Photon Server price by CCU (even if you host it entirely) to be able to offer a cheaper solution for smaller games. If we didn't, there would only be one, probably medium-high price for licenses. Bigger CCUs also mean bigger projects usually and those tend to cause somewhat more support, etc..
    Some details:
    You can get a 100 CCU license for free and run your game on it. Whenever needed, you can buy additional licenses and or CCUs to expand. There are optionally one-time fees for the licenses or you can subscribe to them to lower initial costs of your game.
    With the Photon Server SDK, you get the full package: Matchmaking, Load Balancing on multiple machines (if needed) and extensibility via C# with a proper framework to customize if needed. It's not a combination with our Photon Cloud service.

    @Zymes: We offered "redistributable" licenses for quite a while but the demand was really low. Maybe it is because we didn't offer a service which does the server-listing (when customers host, the servers need to be found).
    That said: A team of us is working on Bolt and that might be a good fit for your case. It's hosted in-Unity and as long as you create a list of "servers", you can achieve what you described.
     
  19. RF008

    RF008

    Joined:
    Oct 28, 2016
    Posts:
    20
    Hi i am working on helicopter game similar to https://play.google.com/store/apps/details?id=com.extremedevelopers.battleofhelicopters
    this was made in photon unity i am trying to sync the player position but when i do that i am getting issue with jerkey movement i have tried lerp and some other options but all are having some sort of jerk movement in the game the game above is smooth i want to know how to send the player movement with out jerk i am thinking of sending player keyinput but that might go out of sync in the game i am looking for some sample script to move smooth.

    please provide me good starting point.
     
  20. yepfuk

    yepfuk

    Joined:
    Sep 23, 2015
    Posts:
    41
    I have a problem on my game. Player movements are very laggy. How can I solve this?

    Here is the script and PhotonTransformView component.

    Code (CSharp):
    1.  private void Update()
    2.     {
    3.         if (photonView.isMine == false)
    4.         {
    5.             timeToReachGoal = currentPacketTime - lastPacketTime;
    6.             currentTime += Time.deltaTime;
    7.             transform.position = Vector3.Lerp(positionAtLastPacket, realPosition, (float)(currentTime / timeToReachGoal));
    8.         }
    9.     }
    10.  
    11. public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo msgInfo)
    12.     {
    13.         if (stream.isWriting)
    14.         {
    15.             stream.SendNext(playerCurrentHealth);
    16.             stream.SendNext(transform.position);
    17.             stream.SendNext(transform.rotation);
    18.         }
    19.         else
    20.         {
    21.             int oldHealth = playerCurrentHealth;
    22.  
    23.             playerCurrentHealth = (int)stream.ReceiveNext();
    24.  
    25.             currentTime = 0f;
    26.             positionAtLastPacket = transform.position;
    27.             realPosition = (Vector3)stream.ReceiveNext();
    28.             lastPacketTime = currentPacketTime;
    29.             currentPacketTime = msgInfo.timestamp;
    30.  
    31.             transform.rotation = (Quaternion)stream.ReceiveNext();
    32.         }
    33.     }
    I also tried this, but nothing changes;

    Code (CSharp):
    1.  public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo msgInfo)
    2.     {
    3.         if (stream.isWriting)
    4.         {
    5.             stream.SendNext(playerCurrentHealth);
    6.             stream.SendNext(transform.position);
    7.             stream.SendNext(transform.rotation);
    8.         }
    9.         else
    10.         {
    11.             int oldHealth = playerCurrentHealth;
    12.  
    13.             playerCurrentHealth = (int)stream.ReceiveNext();
    14.  
    15.             transform.position = (Vector3)stream.ReceiveNext();
    16.             transform.rotation = (Quaternion)stream.ReceiveNext();
    17.  
    18.         }
    19.     }
    Thanks for advance.
     

    Attached Files:

    Last edited: Mar 19, 2017
  21. RF008

    RF008

    Joined:
    Oct 28, 2016
    Posts:
    20
    i have tried to use smooth movement form the video https://www.assetstore.unity3d.com/en/#!/content/17070
    but still there was jittery movement.

    any script that will over come my jittery movement is appreciated.

    i have tried this script but still i see jittery movement.

    @tobiass
    public void UpdateNetworkedPosition(){
    m_NetworkPosition = HeadPos;

    float pingInseconds = (float)PhotonNetwork.GetPing () * 0.001f;
    float timeSinceLastUpdate = (float)(PhotonNetwork.time - m_lastNetworkreceivedTime);
    float totalTimePassed = pingInseconds + timeSinceLastUpdate;

    Vector3 extrapolatedTargetPosition = m_NetworkPosition + transform.forward * m_Speed * totalTimePassed;
    Vector3 newPosition = Vector3.MoveTowards (transform.position, extrapolatedTargetPosition, m_Speed * Time.deltaTime);

    if (Vector3.Distance(transform.position , extrapolatedTargetPosition) > 2f) {
    newPosition = extrapolatedTargetPosition;
    }

    newPosition.y = Mathf.Clamp (newPosition.y, 0.5f, 50f);

    transform.position = newPosition;
    }
     
  22. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    196

    Few questions :
    - Is it jumping from places to places or too slow to reach it's target?
    - Is it a RigidBody or a simple GameObject?

    make sure you also validate network smoothing using the dedicated demo scene "DemoSynchronization-Scene", it will puunder different smoothing technics several cubes. This is your goto scene to pick up the one that suits your needs.

    Bye,

    Jean
     
  23. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    196
    As I just mentioned to @yepfuk make sure you check the demo scene "DemoSynchronization-Scene", it will show the basics smoothing technics available, if none of these are suitable, then you'll have to come up with a dedicated solution, but it's very unlikely that you'll need to go that route.

    else, can you describe what you are trying to move around, it will help knowing this to provide possible ways to improve the situation.

    Bye,

    Jean
     
  24. RF008

    RF008

    Joined:
    Oct 28, 2016
    Posts:
    20
    Hi thanks for the answer
    player movement over network was not that smooth we can see jerks i want seamless smooth movement.
    now player will move nicely with some slight lag when moving i dont want to see any lag at all i want a smooth movement
    i have tried lerp from the "DemoSynchronization".

    it will work but i want a very smooth movement, player should not see any lag at all, for the networked player.
     
  25. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    196
    Hi,

    there is a difference between "smooth" and "lag". Lag will always be, but smoothness depends on how you are going to deal with the lag.

    The very nature of networking synchronization implies a lag, it's not something you can avoid, and is inherent to any similar networking solution you'll implement. Depending on your player types of movement, you could extrapolate on the direction, speed and predict the likely position of the networked player and compensate lag this way, else a simple lerping interpolation will be the go to solution for a truly smooth movement, but yes, you will have the lag more noticeable.


    Depending on your game play, you could be studying TrueSync lock step system, which guarantees total synchronization for all players, but the solution is very different in terms of implementation. https://www.photonengine.com/en-US/TrueSync



    Bye,

    Jean
     
  26. yepfuk

    yepfuk

    Joined:
    Sep 23, 2015
    Posts:
    41
    Thank you for reply,

    - The characters jumping from places to places.
    - Players are RigidBody.

    I will check the DemoSynchronization-Scene again.
     
  27. Kamil-Says

    Kamil-Says

    Joined:
    Jun 30, 2014
    Posts:
    154
    Lol, stop crying like a baby. 5 years licence is still fine for $95. You gonna upgrade the subscription sooner or later after the release of the game. I have seen a lot big companys changing their subscription plans. It's bussiness, accept it.
     
  28. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    Please mail us to developer@exitgames.com. Include the invoice ID you got from the store and the email address of the Photon Cloud account to which you applied the purchase. We will help you.
     
  29. yepfuk

    yepfuk

    Joined:
    Sep 23, 2015
    Posts:
    41
    Hi guys,

    I kinda fix the lagging issue by using CubeInter example from the Demo Synchronization demo. Now, I want to ask a question about sendRate and the serializeRate. What is the differences between them and where is the best place to set this values in the code. I tried to increase the serializeRate from default(10) to 25 and got an error message ; "Error: Can not set the OnSerialize rate higher than the overall SendRate."

    Thank you.
     
  30. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
  31. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    5,986
    Hi there,
    I have a count down that I start at the beginning of my racing game. So, each player should see the count down at hopefully the (almost) exact same time. Otherwise, if one countdown (say on master client) finishes ahead of the client, this gives an unfair advantage to the master client.

    So, the issue is that there is a delay, of about a full 1 to 2 seconds.


    I am using this code... it is called from the Master Client, during a InvokeRepeating, running down from 3 to 0......
    Code (csharp):
    1.  
    2. photonView.RPC("countDown_network", PhotonTargets.AllBufferedViaServer, int_countDown);
    3.  
    I am wondering, is there a quicker method, or more balanced in time method?



    Thanks
     
  32. Kamil-Says

    Kamil-Says

    Joined:
    Jun 30, 2014
    Posts:
    154
    I would use Update timer instead of invokepeating. I would also implement game states controlled by master client. Example GameStates: Waiting,MatchRunning,EndOfGame. Set it as room propierties, not rpc.
     
  33. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    5,986

    Interesting. Ok, will investigate Room Properties. I thought Room Properties were settings set on entrance. Like number of players, goals to achieve etc.


    But thanks



    edit:
    I hate to ask, but would someone be able to help me create this scenario?
     
    Last edited: Mar 31, 2017
  34. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    5,986
    In entering a Lobby, I create a room, once 2 players are in lobby, both are sent to said room. This works fine, however a bit slow. I am wondering this....

    On btnPressed_playMultiPlayer()
    ///// I load a new scene (lobby).
    //// in Lobby I have my Lobby Manager. In my Lobby Manager, I connect to Photon. I am guessing this process is the most time consuming.

    Would it make sense to connect to Photon, even if I am not in the Lobby? So it can sit connected, in the background and should my player decide to play over the network, synching is much faster.
     
  35. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    If a Master Client should trigger some events / keep some state, make sure anyone else can take over when the current Master Client should suddenly leave the game. As with any client, there is no guarantee that the Master Client replies consistently, as the game can be closed, network can be lost, etc. In those cases, messages to the Master Client (and from) can be lost.
     
  36. F-R-O-S-T-Y

    F-R-O-S-T-Y

    Joined:
    Mar 22, 2013
    Posts:
    35
    Hey,

    Is there a roadmap for PUN somewhere or is this considered a finished product? Meaning that the only things we can expect are bugfixes.

    If it is a final product already, is it ever going to be open source? If not, then why?

    Cheers,
    Frosty
     
  37. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    5,986

    Hi, after initial tests on the iPhone 5, time between clients is reduced significantly. Maybe time to upgrade my iMac (2007). I think this was/is the fundamental issue, if not, will post.

    Thanks you
     
    tobiass likes this.
  38. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
  39. Kurtav

    Kurtav

    Joined:
    May 24, 2015
    Posts:
    22
    I want to share my work, I hope someone will be interested in her. The bots synchronization script spent many sleepless nights, my favorite script in my network activity =)))
    [​IMG]




    An effective synchronization of large PUN bots number movement.

    Document description: What does the message consist of? Packages, commands, limits, message queues.

    Network gameplay with bots example (based on the package SurvivalShooter (UnityEssentials example))
    -----------------------------------------------------------------
    Download pc build :
    https://drive.google.com/file/d/0BzmrMMw2JROCSE1aRlFGVW9wakk/view?usp=sharing
    Sent the package for moderation in early April(Release approximately April 15-30,price 5$)
    My account at Asset Store -https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=popularity/query=publisher:21589
     
    TooManySugar likes this.
  40. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    PUN v1.82 was just published. It's not radically different but we worked carefully on memory usage improvements.

    v1.82 (12. April 2017)
    Fixed: Memory allocation in OnSerializeWrite(), when the view doesn't write data to the stream.
    Removed: Conversion Wizard for very old Unity Networking projects of Unity 4.x. There is no automatic conversion possible for Unity 5.x "uNet" networking.
    Moved: hasVoice and hasChat values are now in the general PhotonEditorUtils as HasVoice and HasChat, available to more Photon editor-classes if needed. Also, make sure to use HasCheckedProducts.
    Added: RoomOption.DeleteNullProperties. When set to true, the server will delete Custom Room properties, when they are set to null as value. Defaults to off/false but can be really useful to keep the number of room-properties in check. This will become available on servers after the Easter holidays.
    Fixed: Room.SetCustomProperties() to delete keys with null as value (the client that was setting the custom props did keep the key/value until until it was updated). The callback OnPhotonCustomRoomPropertiesChanged still has the keys with null values. They just don't get stored in Room.CustomProperties anymore.
    Changed: Interest Groups IDs are now of type byte, as used by the Photon servers. It was an integer before but for the wrong reasons. This affects PhotonView.group, PhotonNetwork.SetSendingEnabled() and PhotonNetwork.SetReceivingEnabled(). The method SetReceivingEnabled is replaced by SetInterestGroups(). When you update, make sure to use the correct order of parameters.
    Changed: UtilityScripts folder. Some scripts were not useful and got moved or deleted. General clean up.
    Removed: PlayerVariables script content. It's completely replaced with the ColorPerPlayer script, which is more versatile.
    Added: Checks of mandatory configuration values for console exports to make sure no setting is missing. In doubt, look out for error logs or a NotSupportedException on connect.
    Fixed: The server selection "Best Region" now supports clusters, if sent by the Name Server. Clusters are optionally used by Exit Games as set of machines in a region. As before, PUN only stores the best region, not the cluster. The idea is that this automatically selects a fitting region (not a specific cluster).
    Added: PhotonNetwork.CloudRegion to make the currently used Cloud Region accessible. This is mostly to expose existing values and to make debugging a little easier.
    Updated: To Photon3Unity3D.dll v4.1.1.10 with some additional improvements in terms of memory usage.
     
  41. vARDAmir88

    vARDAmir88

    Joined:
    Sep 9, 2015
    Posts:
    9
    Updated PUN to version 1.82. When I join the room it disconnects me every 30-60 seconds (console says disconnected by timeout).
    PhotonServerSetting:
    Hosting - Photon Cloud
    Region - Eu
    Protocol - Udp
    Players - 1(Just me).

    If I switch protocol to TCP it works well. Fortunatelly I have backup for 1.81 that works great with UDP.
     
  42. Konst

    Konst

    Joined:
    Aug 26, 2013
    Posts:
    57
    same here
     
    Last edited: Apr 12, 2017
  43. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    5,986
    Hi,
    I am wondering the fastest way to get into a room.

    I have in my current set up, Open a new Scene, Lobby, it is here that I connect to Photon and wait for opponent. Synching sometimes take too long. Is there a quicker approach? Perhaps my software and hardware are old?
     
  44. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    72
    Yup, I get the same after upgrade to 1.82.

    Disconnected after 30 ... 60 secs:

    Code (CSharp):
    1. Timeout-disconnect! Command: CMD(5 c#:255 r/u: 4/0 st/r#/rt:31234/27/11734) now: 31265 challenge: 192f0fe
    2. UnityEngine.Debug:LogWarning(Object)
    3. NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1522)
    4. ExitGames.Client.Photon.EnetPeer:SendOutgoingCommands()
    5. ExitGames.Client.Photon.PhotonPeer:SendOutgoingCommands()
    6. PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:177)
    I noticed it while trying to integrate PUN into a vanilla project on my own, spent hours thinking I was screwing up somehow, thought I had to send my own keepalive packets or something, then tried it on a new empty unity project importing the whole PUN asset pack, the samples (which worked fine with version < 1.82) also suffered disconnect. So somethings been broken in 1.82.
     
    Last edited: Apr 13, 2017
  45. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,828
    We just updated PUN to v1.83, as critical fix for v1.82 (from yesterday).
    The timeouts many of you noticed are now fixed.

    Thanks for the report, @SiliconDroid and everyone else (on other channels).
    Sorry for the hassle!! This escaped testing.
     
    Konst and SiliconDroid like this.
  46. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    72
    Awesome!
    Glad it wasn't me screwing up this time ( as is per usual ) :D
     
    Konst likes this.
  47. Sask34

    Sask34

    Joined:
    Aug 1, 2016
    Posts:
    1
    Hey I'm having a problem after spawning some of my Players I suddenly got PEERCREATED on my connectionStateDetailed. Is there any issues regarding this?
     
  48. AllMightyNico

    AllMightyNico

    Joined:
    Jun 12, 2015
    Posts:
    14
    Dear Community,

    when I am connecting to the Photon Cloud I am getting an error:

    Operation failed: OperationResponse 229: ReturnCode: -1 (Unknown operation code 229). Parameters: {} Server: MasterServer
    UnityEngine.Debug:LogError(Object)
    NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1544)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)

    Can anybody tell me what this means?
     
  49. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    300
    Need a bit of guidance on how to add to the properties the AI bots specs.

    For the player I do:
    (..)
    PlayerPropHash[PlayerProperties.team] = MTB.team;
    PlayerPropHash[PlayerProperties.faction] = MTB.faction;
    PlayerPropHash[PlayerProperties.vehicleType] = MTB.vehicleType;
    PlayerPropHash[PlayerProperties.tier] = MTB.tier;
    PlayerPropHash[PlayerProperties.model] = MTB.model.ToString ();
    PlayerPropHash[PlayerProperties.skin] = MTB.skin;
    (...)

    I would like to do something somewhat similar for the bots but I do not know where to store the data.

    I was thinking of the room properties, but the kind of structure I need is a Key/Value where the value is a custom serializable class holding each property shown above. ( this is the way I do for offline AI bots).

    The thing is, can I use a custom class in the player properties? / in room properties?
    Should I add the AI data to the room properties?

    The AI bots will be set by the master client that creates the room in the first place, so maybe would be better to have the custom class in the player prefs instead?

    TX!

    EDIT:
    Just found this:
    https://www.assetstore.unity3d.com/en/?&_ga=1.249252743.1005980307.1488229456#!/content/1917
    Will check how it is built, yet I would like to keep my Vehicle specs structure, hope it is possible

    EDIT2: Checked angry bots but saw that bots are already in there on start and are not spawned.
    That said I realized that maybe I need not to add the bot data anywhere in the properties as I should do a photon instantiate of the gameobject and the specific properties such as team or could be sent via RPC
     
    Last edited: Apr 18, 2017
  50. Dog-Gamer

    Dog-Gamer

    Joined:
    Nov 9, 2015
    Posts:
    33

    I have a issue, followed a pretty great youtuber and got a error!
    Please help for I do not fully understand.
    Error:
    Code (CSharp):
    1. Assets/Scripts/Network/NetworkManager.cs(18,49): error CS0117: `RoomOptions' does not contain a definition for `isVisable'
    And here is my code:
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3.  
    4. public class NetworkManager : MonoBehaviour {
    5.     const string VERSION = "v0.0.1";
    6.     public string roomName = "VVR";
    7.     public string playerPrefabName = "Player_good";
    8.     public Transform SpawnPoint;
    9.  
    10.  
    11.  
    12.     void Start () {
    13.         PhotonNetwork.ConnectUsingSettings(VERSION);
    14.     }
    15.  
    16.  
    17.     void OnJoinedLobby(){
    18.         RoomOptions roomOptions = new RoomOptions() { isVisable = false, maxPlayers = 4};
    19.         PhotonNetwork.JoinOrCreateRoom(VVR, roomOptions, TypedLobby.Default);
    20.     }
    21.  
    22.  
    23.  
    24.     void OnJoinedRoom(){
    25.         PhotonNetwork.Instantiate(playerPrefabName, spawnPoint.position, spawnPoint.rotation, 0);
    26.     }
    27. }
    28.  
    29.