Search Unity

Third Party Photon Unity Networking

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

  1. b4c5p4c3

    b4c5p4c3

    Joined:
    Jan 4, 2013
    Posts:
    537
    I'm interested on this info too.
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @Parallaxe: The Photon doc page is outdated, sorry. No matter where you buy it, it's "limited" to 60 months.
    We had to set a expiry for the offer for legal terms, more than anything else. We hope it's still a fair offer.
    If that helps: You can buy it now but start the 100 CCU usage later, when you're about ready.
     
  3. Fulby

    Fulby

    Joined:
    Jan 15, 2016
    Posts:
    5
    I just bought PUN+ in the sale and applied it to the Realtime app on photonengine.com. I'd like to add another for Voice so they have the same CCU, is this possible?

    Thanks,

    Fulby
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
  5. Fulby

    Fulby

    Joined:
    Jan 15, 2016
    Posts:
    5
    No problem, I thought the add-on was for any Photon package, my mistake (on the page "Your Applications for Photon Voice" there's an option to add a PUN+ coupon which is presumably wrong?). On the page you linked I click on "Select App" and it takes me to a page with "Sorry, but the page you were trying to get to does not exist."?

    Thanks,

    Fulby
     
  6. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @Fulby: I see the same error page you got from the pricing page.

    I think the button to apply a PUN+ purchase is misleading. The coupons are per product (and obviously the button isn't). Thanks for the heads up.
     
  7. Fulby

    Fulby

    Joined:
    Jan 15, 2016
    Posts:
    5
    Thanks for the confirmation :)
     
  8. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Hi. I have a nice lobby, people choose the room with specific map of their liking and they join.
    They have a panel where they choose their faction.

    I now only know to spawn them after n seconds after they join the room.

    Things I do not how t do:

    How can I make the master client decide to launch the game for all players? or make it autospawn for all player when room is full?


    How do I spawn the players in specific spots like could be a race start grid so that they do not overlap?

    I quoted that answer because I think is related but I can not see the light at all.

    Thanks!
     
  9. JimmyRage

    JimmyRage

    Joined:
    Oct 21, 2015
    Posts:
    3
    Hi TooManySugar,

    For the first option you can create another panel which is only displayed to the master client. This panel contains something like a 'start game' button which calls your function to actually start the game.
    For the second option you might use the OnPhotonPlayerConnected callback function which tells you whenever a player joined the current room. The master client can now check the playerCount of the current room and decide if he starts the game.

    I assume that the player object (character, racing car or something else) is already created in that case.
    An option to achieve this is to change the custom room properties. This is done by the master client only. The master client defines the start order by adding necessary informations to the custom room properties. Whenever they are changed, there is a matching callback functions called on all clients (OnPhotonCustomRoomPropertiesChanged). Within this function the client can set the player object's transform as stated in the updated custom room properties. Therefore I recommend you reading through the matchmaking tutorial over here
     
    Last edited: Jun 2, 2016
  10. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Thanks Jimmy!

    1st)Thae start game button would be call an RPC method right? and RPC that calls triggers the spawn process.

    2nd) If the playerList content order is consistent all along the other players, that is certainly a solution !
     
  11. JimmyRage

    JimmyRage

    Joined:
    Oct 21, 2015
    Posts:
    3
    Well, I checked on this today and sadly it is not the same for every client, so this doesn't work. Sorry for the false statement, my mistake.

    This is one option you have. Also think about calling PhotonNetwork.RaiseEvent as another option in this case instead of RPC. For example you can define two event codes whereat one is for transmitting the spawn position to the players and the other for actually starting the game. It might be also possible to handle both steps with just one event.
    Keep in mind that using custom room properties is still a valid option. Using them you can add a property which determines the state of the game, e.g. started/paused/finished.
     
    tobiass likes this.
  12. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Tx Jimmy!
    I'll get back to the networking issue veyr soon as I'm killing some bugs in other sectors but I believe in a couple of days I'll be there, I'll tell you how it goes!
    The other option yousuggested looks the way to go.
    (OnPhotonCustomRoomPropertiesChanged)

    Master client on hitting the start game button, closes the room, lists players in the room, asigns them an spawn spot and ups this to the room properties, still have to figure out how to up this to properties as its been a while since I messed with Photon but if it possible certainly looks like a solid solution.

    edit: closes the room no! meaning launches the game! omg what was I thinking!
     
    Last edited: Jun 2, 2016
  13. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Just an offtopic question, feel free to ignore. Where you banned from the forum? Because you know plenty of photon and just 1 message on your record of posts...
     
  14. JimmyRage

    JimmyRage

    Joined:
    Oct 21, 2015
    Posts:
    3
    No, I wasn't banned. I just started my forum activity yesterday :D
     
    tobiass and TooManySugar like this.
  15. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I've annother question but is less tricky.

    I've a game mode that once time limit is reached I want to end the game. Ok, not a big issue but my questio is what would be the cleanest way to do.
    Master player manages this locally so when the timer in its local play reaches the limit sends RPC or use a time that is shared betwen all players, I do not recall nicelly the name but I think it was something like servertime. The first approach is safe enough right? because even if master player leaves, the property passes to another player. But may be checking in and Update if player is Master Client is a totall overkill...
     
  16. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Regading the GameOver based on time I came up with this.

    This code is within update:
    Code (CSharp):
    1.         //TIMEMODE GAME OVER CHECK
    2.         actualRoundTime += Time.deltaTime ;
    3.         if (timeLimit !=0 && actualRoundTime >= (timeLimit*60)){
    4.             //offline
    5.             if(oflineMode)if(    gameIsOver == false) GameOver();
    6.             //online
    7.        
    8.       else{if(PhotonNetwork.isMasterClient )   if(   gameIsOver == false) photonView.RPC ("GameOver",PhotonTargets.AllViaServer);}
    9.  
    10.         }
    edit: I made the gameover for online an rpc, previously was not, fail, I choosed via server withc I asume is safer as if the rpc is otherwise is a chainflow someone might disconnect. Witch I do not know if it s possible but just in case...

    The documentation suggests this, bust as Iwas coding non networking stuff I did not whant to mess much with properties and so on witch I do not remember much atm and are stuff managed by other script.

    "Another good use case for Custom Properties is to store a room's "start time". When the game begins, store PhotonNetwork.time as property. That value is (approximately) the same for all clients in the room and with the start time, any client can calculate how long the game is running already and which turn it is. Of course, you could also store each turn's start time. This works better if the game can be paused. See class InRoomRoundTimer in the PUN packages."

    I think it will work fine enough.
     
    Last edited: Jun 5, 2016
  17. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    I wonder if Time.deltaTime could give you wrong results, when one player's game becomes inactive / paused.
    You might want to base this on Time.realtimeSinceStartup.
     
  18. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I'm trying to update the room properties so that they show in the lobby room list.

    In particular I want to update an Status property I've created that shows if people is room is / waiting/ playing/

    So users can decide if they whant to join an existing game (in case that allow to join is started) or join a game whre players are awaiting more to come.

    Also I want to use this status to allow/deny room Join.

    ///////////////////////////////////////////////////////
    I tried to update room properties the same way I did with my player custom properties.
    Code (CSharp):
    1.  
    2.  
    3. ExitGames.Client.Photon.Hashtable RoomPropHash;
    4. void Start () {
    5.      RoomPropHash = new ExitGames.Client.Photon.Hashtable ();
    6.    }
    7.  
    8. public void LaunchButton(){
    9.  
    10.      RoomPropHash[RoomOpts.Status] = "Playing";//actualizamos la property de la room.
    11.  
    12.      //other code here
    13.      }
    14.    }
    edit: I just recalled that player number updates ok. I'll check ....
     
  19. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I've been unable to update the custom room property, I dont know if it is even possible as I found no info on this topic.

    edit this sounds promissing.

    PhotonNetwork.room.SetCustomProperties(Key, Value)


    edit2: ok! done:

    Code (CSharp):
    1.     //--------------------------------------------------------------------------------
    2.         if (RoomPropHash.ContainsKey (RoomOpts.Status)){  
    3.             Debug.Log ("la key ya existe");
    4.             RoomPropHash[RoomOpts.Status] = "Playing";
    5.         }
    6.  
    7.         else{
    8.             RoomPropHash.Add (RoomOpts.Status,"Playing");//    for the case you suspect key could not exist
    9.         }
    10.         //--------------------------------------------------------------------------------
    11.         PhotonNetwork.room.SetCustomProperties(RoomPropHash);
    12.         Debug.Log ("roomproperties " + PhotonNetwork.room.customProperties[RoomOpts.Status].ToString());
    13.         //--------------------------------------------------------------------------------
    14.  
     
    Last edited: Jun 6, 2016
    tobiass likes this.
  20. Wawro01

    Wawro01

    Joined:
    Apr 23, 2014
    Posts:
    44
    Any news about IPv6 support ?
     
  21. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    Sure.
    It's in PUN since v1.69 :)
     
    hopeful likes this.
  22. dan-kroymann

    dan-kroymann

    Joined:
    Feb 5, 2013
    Posts:
    17
    I have a slightly tricky room joining scenario that I'm trying to figure out if/how it can be supported in Photon. When you initially launch our game, you are auto-joined into a random instance of our social hub scene (for reference, think the tower in Destiny). Avatars are milling about with people joining and leaving all the time. From the hub, you can choose from a list of activities to play, which causes you to leave the hub and join to a random instance of the target activity. So far, this fits into Photon's room model very cleanly.

    Now here's where it gets a bit more complicated. While in the hub, you can meet other people and decide to form a party that will then remain together as you leave the hub and go to different activities. In order to have everyone in the party join the same room together when they switch activities, I need to know the name of the destination room before leaving the current room so that it can be shared via RPC with the other members of the party. As far as I can tell, I can't query for an up-to-date list of rooms from a lobby while still connected to a room, which means I'm stuck creating a new instance of the activity for my party (which everyone in the party then joins via JoinOrCreateRoom). This in turn means that if I'm in a party, my party can never match into a room with other parties.

    What I'd really like is a way to maintain some level of network connection to a group of people while going through the room switching process. My ideal scenario would be to have one person in the group handle calling JoinRandomRoom() (followed by CreateRoom() if that fails), passing in the expectedUsers array so that the appropriate slots are reserved for the rest of the party. As soon as a room has been located, they can then send the name of the room to the rest of the party and everyone else can join. Now obviously this is a fairly dramatic departure from the Photon network model, so what I'm hoping for is something that achieves effectively the same result while working within the confines of the current network model.
     
  23. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    A new version is coming!

    PUN v1.70 has a fresh tutorial (with online docs), less memory consumption and is fixed for Windows Store compatibility (8.1 and Windows 10 Universal).

    v1.70 (8. June 2016)
    Changed: Serialization methods from MemoryStream to StreamBuffer. This is a light wrapper for a byte[] which provides access to this array. That was not allowed in the Windows Store compatible API. To update, just replace MemoryStream with StreamBuffer in your custom type serialization.
    New: PUN Basics Tutorial, available within the Demo Hub.
    Updated: Input for some demos now also works with controllers (RPGCamera, RPGMovement and JumpAndRunMovement support this now).
    Fixed: Ownership of a PhotonView no longer gets updated when anyone (aside from the owner) sends updates for it. This could cause issues when the (new) owner of an object got outdated updates from another (older) owner.
    Fixed: PhotonViewInspector. When ownership gets transferred for scene objects, this shows correctly in the inspector at runtime.
    Fixed: PhotonAnimatorView. removed warning thrown during trigger caching checks.
    Changed: Delta compression will now re-use some memory, which should be more effective.
    Changed: Aggregation of internal OnPhotonSerializeView()-updates is more effective. More memory is being re-used.
    Updated: To latest Photon3Unity3D.dll v4.1.0.5. It will no longer fail Windows Store Certification and has several improvements throughout.
     
  24. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @dan.kroymann: In short: You can elect a "leader" per group and use the FindFriends feature to figure out which room he ends up in. The leader could also reserve spots in a room for expected players (so there is enough room for them to join). This is based on userIDs.
    For room-independent communication, use Photon Chat (extra service but a separate connection and independent from rooms).
     
  25. dan-kroymann

    dan-kroymann

    Joined:
    Feb 5, 2013
    Posts:
    17
    FYI - Yesterday I implemented my own system (using the PhotonVoice code as a guide) that leverages a parallel Photon network connection (referred to as "party network" from here on). When someone in a party chooses to switch activities, they send everyone in the party an RPC telling them to connect to the party network and auto-join a private room for them to communicate in. The leader then leaves the room in the main Photon network, goes through the process of joining/creating a room for the new activity, and then sends a message via the party network telling the rest of the party members about the room name. As soon as the leader sends this message they disconnect from the party network, and as soon as the other party members receive the message they also disconnect from the party network (to avoid unnecessarily burdening our CCU). This seems to work great, but now that I'm reading your reply, I'm realizing that FindFriends() could totally work for my needs and avoids the rather heavy weight solution I implemented... At least I can say that I learned more about the bowels of Photon as a result of my code spelunking :)
     
  26. dan-kroymann

    dan-kroymann

    Joined:
    Feb 5, 2013
    Posts:
    17
    @tobiass: Alright I replaced my original implementation with a version that uses the FindFriends() API. Now I'm running into a timing problem that I'd love your insight on. When the party leader leaves the room to switch activities, everyone else in the party leaves the room and uses FindFriends() to learn where the leader has gone. As soon as the party members learn what room the leader joined/created, they attempt to join it via PhotonNetwork.JoinRoom(). The problem that I'm hitting is that the JoinRoom call is frequently failing with error 32758 (Game does not exist). If I wait a couple of seconds before calling JoinRoom, then it seems to always succeed. I'm not a big fan of inserting arbitrary sleeps into my code without really understanding why they're there. Can you explain the behavior I'm seeing, and is there a better way I can avoid getting the failures?
     
  27. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    Any advice how you guys keep info about temporary elements/states in the scene when new player join?
    For example, in my case, I got supply boxes which spawn depending on scene state. So I need to keep all data about that supply state (opened/used/falling/what is inside and other) and let new player get that info and reproduce. If that is a way, I got 2 questions here:
    1. If object was already instantiated using PhotonNetwork.Instantiate method, how can I instantiate the same object instance in new player client? Of course I can spawn it locally, but PhotonNetwork.Destroy will not affect it after it will be called by MasterClient.
    2. How to keep that supply box info? Make serializable class with serialized position and rotation + enum about current state or may be there is a better way?
     
  28. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @dan.kroymann: You can call JoinRoom() again, should it fail for the first attempt (and if you attempt to follow a friend). The error means that this operation call failed but it's not getting you into a unstable state. It's a response that you should expect.
    Alternatively you could use JoinOrCreateRoom(). Unlike CreateRoom(), you can't directly set room properties at creation time, but you should be able to get into any room, no matter if it exists or not.

    @novaVision:
    1. When using PhotonNetwork.Instantiate(), joining players will also instantiate the object on join.
    2. I would probably try to use Custom Properties. It depends a bit on how many such states you want to keep but props could cover quite a lot of object states, if you keep the key strings short. I would minimize the data you store per object. Rotation is probably not even needed. Maybe position is clear by positioning spawn points in the level.
    I would use IDs per item-spawnpoint and then put the state into custom props.

    How many items are you talking about? How are they generated / placed?
     
  29. JakeOfSpades

    JakeOfSpades

    Joined:
    Aug 22, 2015
    Posts:
    44
    Does Photon/PUN support WebGL for hosting and joining network matches?
     
  30. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    PUN does support WebGL exports and there are a few games out, using it.
    Nitpicking: PUN does not support hosting the games. You connect to a server, which connects all players and does a few extra tasks. Matchmaking is supported. Automatic region selection by pinging them, isn't there yet.
     
  31. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    Thanks for reply.
    I got quite complicated case, because my box is rigidbody object and lands to random point on the ground affected by random force. After several tries I have decided to use PhotonRigidbodyView (that give most smooth falling).
    To decide that state trouble, I decide to catch OnNewPlayerConnected callback inside the box managers components. That trigger "SendStateUpdate" method inside each active box, and each box send RPC targeted to new player. I don't think that is the best solution (I was thinking about custom properties also) but I will not have more then 6-8 boxes at 1 time, so that should not affect on network performance.
     
  32. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Is there a recommendation for fastest workflow with Photon? Building and then testing for small features could be time consuming.
     
  33. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    It doesn't sound so bad either. In the end: It's a game and when it's working it should be fine.

    It can be cumbersome. Sadly, there is no shortcut to avoid it entirely.
    Whenever possible, I am doing one build and continue working in the Editor. Sometimes you can keep one client running while connecting and disconnecting in the Editor several times, tweaking code and values.
     
  34. dan-kroymann

    dan-kroymann

    Joined:
    Feb 5, 2013
    Posts:
    17
    @tobiass I recently noticed that calling PhotonNetwork.ClearExpectedUsers() does not seem to do anything. I stepped through the logs and verified that the internal SetProperties operation initiated by ClearExpectedUsers() completes successfully, but nothing else seems to happen. I never receive an updated set of room properties with the expectedUsers field set to NULL, and the room's current player count (from the perspective of the matchmaking lobby) never goes down as I would have expected it to. Is this a known issue?
     
  35. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @dan.kroymann: You are right. This is a known issue for the time being. We will look into this.
    Is this blocking you? In doubt, we can come up with a workaround.
     
  36. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @dan.kroymann: There is a workaround for this. You can send a empty list of expected players instead of sending a null value. This should work as expected. The client maybe isn't updating but this will update the server.
     
  37. dan-kroymann

    dan-kroymann

    Joined:
    Feb 5, 2013
    Posts:
    17
    This was a blocking issue for us, but the workaround works great! The main issue that it was causing for us was that the player count from the lobby's perspective was not going down correctly, and over time we would end up with rooms that were almost completely filled up by phantom players. But as I said, the workaround works great.
     
  38. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    Hi there,

    I'm developing a serious game, with some decent amount of investment in it ($ and manpower). It's a racing game, and we need realtime multiplayer.

    Started out with Unity's own networking system, but that is proving itself as a tough task. I cannot seem to find a way to have networking being hosted by our own servers, to be distributed around the globe. The nly way I can have control over that, is by using the Unity Masterserver stuff, which even Unity advices against, claiming that's legacy.

    I must run the game in a authoritative server manner.

    What can photon provide me? What are the pros of it? What would be the process? What are the costs?

    Appreciate any help. Maybe @tobiass can help me out on this one.

    Regards,
    Klein
     
    Last edited: Jul 1, 2016
  39. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    Today we released a new update. We did a few renamings but those are listed below and the now "obsolete" naming should work still. There is a fix that avoids some blank messages being sent, so an update is recommended. Also new: More regions to select in the PhotonServerSettings!

    v1.73 (11. July 2016)
    Fixed: NetworkingPeer.RunViewUpdate(), which was sending messages, even if no new updates were written. This got introduced in v1.70 and caused more messages than necessary.
    Changed: Some variable and field names. PeerState is now ClientState.
    Renamed: mAppId is now simply AppId. mAppVersion is now AppVersion.
    Renamed: networkingPeer.server is now networkingPeer.Server (uppercase, being public).
    Replaced: Most checks of PhotonNetwork.connectionStateDetailed being PeerState.Joined (or not) with checking PhotonNetwork.inRoom.
    Added: Regions to the PhotonServerSettings: "sa" South America (Sao Paulo), "usw" USA West (San José) and "cae" Canada East (Montreal). If you're using the "Best Region" setting, make sure to include/exclude them as needed.
    Fixed: NetworkingPeer:SendMonoMessage() null check before sendmessage to a GameObject that could be null.
    PunTurnManager API:
    Changed: GetRemainingSeconds() becomes .RemainingSecondsInTurn
    Changed: TurnDuration is now a float and defaults to 20
    Added: IsOver() properly implemented
    Added: OnTurnTimeEnds interface callback properly implemented
    Fixed: RpsCore edited to account for PunTurnManager api changes and additions.
     
  40. Joits

    Joits

    Joined:
    Jul 12, 2016
    Posts:
    29
    Hi there,

    I'm developing an application which allows one user (master) to see what other people are watching inside a VR environment using the Gear VR, but i have a problem with the data transfer from client to the master.

    Right now i'm instantiating a camera for each client connected to the game, however i cant receive any data from the stream. Also as i'm planning to use it as a master/slave approach only the MasterClient is interested in the data stream.

    I.e. Master connects and creates a room, then for each player connecting spawn a "slave" with a camera that receives the rotation data of the VR headset and apply's it to a camera which only the master client is able to see.

    Any tips on how one would implement such an application?
     
  41. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    I think I don't understand what you want to do exactly. Why apply updates to a camera on clients, if they can't see that?

    If you want to send the rotation data, you can add a PhotonView to that camera and sync position and rotation. That's a common task.
    If you want to apply the updates to another object, you can simply run a script that copies and applies the values from the "master camera" to any object / camera you want to behave the same...
     
  42. rusildo

    rusildo

    Joined:
    Oct 10, 2014
    Posts:
    18
    Last edited: Jul 16, 2016
  43. unitynosf

    unitynosf

    Joined:
    Jun 9, 2014
    Posts:
    23
    Hi all;

    one question - I have the rally pack bought and thinking about finally getting down and implement multiplayer in my games. Did some with GooglePlay Game Services but did not like it much, P2P is, much like it's message broadcast - unreliable :D

    So, do I need a PUN+ now to use code samples from Rally or is the free version enough, for start?

    Also, I'd like games to be controlled by server as real server, not some "main" player, as I'm in mobile games and it's tricky. Is that possible with free version?

    Thanks for time and help.
     
  44. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    free enough for start. + will only give you more player support to be playing on the server at the same time. 100 at the time I bought. For the rest, it is the same.
     
  45. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Hello. I'm back with my spawn all teh player at a time ordered in their specific spawnspot.

    I had no time to implement before and now is the last thing left.

    for what I understand reading the docs and my previous post is that the player

    player id is unique and the same across all the clients.

    My only doubt is that if it starts in 0 o 1 and it keeps growing as players get into the room.

    Because if so it would be safe enought to us the player ID to spawn in spawnspot[player.ID];

    As I've allways more spawnspots than players.

    What you think shouldn´t break right?
     
  46. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @X-rus: Will try to put it in. We're working hard on several topics and some refactoring. But it's not forgotten.
    You do have a patch for this, right?

    @unitynosf: The Photon Cloud does not allow you to run your own server-side logic. For that, you can run your own Photon Server with a Server Plugin. But keep in mind that this is more effort and causes costs. Better do more work to prevent hacking on the client side.

    @TooManySugar: The PhotonPlayer.ID is unique per room. In each room, these so called actor numbers start at 1 and go up, never being re-used.
    Take a look at the ColorPerPlayer script or just experiment with your way.
     
  47. dan-kroymann

    dan-kroymann

    Joined:
    Feb 5, 2013
    Posts:
    17
    @tobiass: I'm seeing a number of cases where our players are timing out the initial connection to Photon. Our telemetry data shows that this is happening more frequently than I would like, and there are now a couple of forum threads where people are asking about this issue. Can you clarify exactly which protocols/ports Photon uses (our game has UDP specified in PhotonServerSettings), what the initial connection handshake process looks like, and any suggestions you might have for helping our users troubleshoot this? I've already given the rather generic response of "check your router and firewall", but I'd prefer something a bit more specific and actionable.
     
  48. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    @tobiass tx, super clean way to spawn all the player at a time, no more spawn overlap! :).

    //--------------

    I suggested time ago something easy to implement that would help to keep people with a pirated copy looking for a new build often enought to piss them.

    I wish there was in the photon website control panel an option to set the a "actual version" like string that when players connect with connectusing xxxx, the xxx do match otherwise ha a callback funcion like "versionMismatch(){} to prompt users for an update. So they restart Steam and get the fresh build.

    Paying for the bandwith of cheaters does note let me sleep fine :)
     
  49. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    i updated from 1.7 to 1.73 and get this error msg now if i try to connect with
    PhotonNetwork.ConnectUsingSettings ("0.1");

    Code (CSharp):
    1. AddComponent with MonoBehaviour is not allowed. Create a class that derives from MonoBehaviour and add it instead.
    2. UnityEngine.GameObject:AddComponent()
    3. ExitGames.Client.Photon.SocketWebTcp:Connect() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/SocketWebTcp.cs:79)
    4. ExitGames.Client.Photon.TPeer:Connect(String, String)
    5. ExitGames.Client.Photon.PhotonPeer:Connect(String, String)
    6. NetworkingPeer:ConnectToRegionMaster(CloudRegionCode) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:650)
    7. PhotonNetwork:ConnectUsingSettings(String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1284)
    The SocketWebTcp.cs part:
    Code (CSharp):
    1.         GameObject websocketConnectionObject;
    2.         public override bool Connect()
    3.         {
    4.             //bool baseOk = base.Connect();
    5.             //if (!baseOk)
    6.             //{
    7.             //    return false;
    8.             //}
    9.  
    10.  
    11.             State = PhotonSocketState.Connecting;
    12.  
    13.             if (websocketConnectionObject != null)
    14.             {
    15.                 UnityEngine.Object.Destroy(websocketConnectionObject);
    16.             }
    17.  
    18.             websocketConnectionObject = new GameObject("websocketConnectionObject");
    19.             MonoBehaviour mb = websocketConnectionObject.AddComponent<MonoBehaviour>();
    20.             // TODO: not hidden for debug
    21.             //websocketConnectionObject.hideFlags = HideFlags.HideInHierarchy;
    22.             UnityEngine.Object.DontDestroyOnLoad(websocketConnectionObject);
    23.  
    24.             this.sock = new WebSocket(new Uri(ServerAddress));
    25.             mb.StartCoroutine(this.sock.Connect());
    26.  
    27.             mb.StartCoroutine(ReceiveLoop());
    28.             return true;
    29.         }
     
  50. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @sumpfkraut: It's (now) a known issue in Unity 5.4 and will be fixed in PUN v1.74.
    Please check out the "accepted answer" in this thread:
    http://forum.photonengine.com/discussion/comment/29510/#Comment_29510

    @TooManySugar: The version checking is a good idea. At the moment, you would have to do this via Custom Authentication. You can setup a server which validates users according to their sent version. However, this means to run a http based service for this.

    @dan-kroymann: Please mail me some details. Without some details, I can only give you general answers, too. Is the start of the game especially busy? Do you load/sync a lot of values when players join? Where exactly do they get timed out (before initial connect or after they connected to some server initially)?! And: Which PUN Version are you using, which Unity version and which servers (Clou? Regions?)... Mail to: developer@exitgames.com