Search Unity

Third Party Photon Unity Networking

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

  1. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    I see, you are creating the PhotonView at runtime. In that case, you are not having the same issue that 82app was.

    Apologies I wasn't very clear there - that is a link to a particular post in another thread. You need to click the little up arrow to get to it. I'm not sure how else to create a clean hyperlink to a particular post. :oops:

    I'd be surprised if waiting for the next frame would work as a solution. Maybe it's worth a try but it would be unfortunate code complexity to add to your project. Particularly as you say that all other objects are working ok.

    In your code above, if you change the MobNPC on line 4 to another of your spawnable types (which I believe are working) does that fix the problem - or does it fail for that other type as well?

    Are you getting your problem in on-line or off-line mode or both?

    Having re-read your initial post, have you tried putting a conditional breakpoint (or add debug logging) inside the CreateSpawn method to see if the problem is either :
    1. Zero is being assigned to the ID in that method (i.e. from the calling code)
    2. Non-zero is being assigned but Photon is forcing the ID to zero
     
  2. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Haha my bad didn't realize that arrow did anything lol.

    Problem happens with online mode.
    I changed the prefab out with another prefab that is spawning with no error and the issue still remains.
    I just put a break here below and it creates a new photon ID that isn't zero
    Code (csharp):
    1.  
    2.         int id = PhotonNetwork.AllocateViewID();
    3.         Debug.Log(name+" id that was Assigned "+id);
    4.         photonView.RPC("CreateSpawn", PhotonTargets.AllBuffered, Position,Rotation, id, key);
    5.  
    So its assigning an ID and forcing it to zero
     
  3. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    Cool, so just to be clear, we know that the call site is sending a non-zero id.

    I wonder what the CreateSpawn method is receiving as an id though. In particular, is there a difference between:
    1. A local call to CreateSpawn (where I believe the RPC will just resolve down to a native in-process method call - but I could be wrong here).
    2. A remote call received across the network.
    Also, I would recommend debugging down in to the assignment to the viewID. It will take you through this Photon code:

    Code (CSharp):
    1.     public int viewID
    2.     {
    3.         get { return this.viewIdField; }
    4.         set
    5.         {
    6.             // if ID was 0 for an awakened PhotonView, the view should add itself into the networkingPeer.photonViewList after setup
    7.             bool viewMustRegister = this.didAwake && this.viewIdField == 0;
    8.             // TODO: decide if a viewID can be changed once it wasn't 0. most likely that is not a good idea
    9.             // check if this view is in networkingPeer.photonViewList and UPDATE said list (so we don't keep the old viewID with a reference to this object)
    10.             // PhotonNetwork.networkingPeer.RemovePhotonView(this, true);
    11.             this.ownerId = value / PhotonNetwork.MAX_VIEW_IDS;
    12.             this.viewIdField = value;
    13.             if (viewMustRegister)
    14.             {
    15.                 PhotonNetwork.networkingPeer.RegisterPhotonView(this);
    16.             }
    17.             //Debug.Log("Set viewID: " + value + " ->  owner: " + this.ownerId + " subId: " + this.subId);
    18.         }
    19.     }
    Keep an eye out in the debugger output window for any messages / exceptions etc. during this method. Maybe this will provide some clues.
     
  4. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    I placed a debug just now right before it assigns it and the id is 1034 etc..
    There is a warning I get actually
    Had to lookup view that wasn't in photonViewList: View (0)0 on Jaffa Cargo Ship Patrol (scene)
    Im thinking this is just saying it can't find a photon view id of 0 in the scene though.

    Code (csharp):
    1.  
    2.     [PunRPC]
    3.     void CreateSpawn(Vector3 Position,Vector3 Rotation,int id,int key){
    4.         Transform NewSpawn = Instantiate(Prefab, Position, new Quaternion()).transform;
    5.        PhotonView SpawnPhotonView = NewSpawn.GetComponent<PhotonView>();
    6.         Debug.Log(name+" id that was Assigned "+id);
    7.        SpawnPhotonView.viewID = id;
    8.  
    This seems like a impossible pipe dream. Maybe i should just try using a prefab with a Spawn component and photonview component already on it.
    Idk what debugging through photons code will accomplish for me.
    This issue should be easy to duplicate.
     
  5. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    Ah, so if I understand correctly, you have a scene object that does not have a PhotonView at startup. You are then adding the PhotonView at a later point during run-time.

    If that is correct, I just tried adding these lines into a scene object. This was executed after having initialised Photon, joining a lobby, then a room and at the point now of both players transitioning into the game scene.
    Code (CSharp):
    1.         var fred = gameObject.AddComponent<PhotonView>();
    2.         fred.viewID = PhotonNetwork.AllocateViewID();
    I saw no errors and this is what my Game Object showed in the Editor:
     

    Attached Files:

  6. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Thanks for all the replies Doug. I really appreciate it.
    Try doing this. This is exactly what im doing.

    Code (csharp):
    1.  
    2. GameObject SpawnGameObject = new GameObject("Spawn Controller",typeof(PhotonView));
    3. int viewID = PhotonNetwork.AllocateViewID();
    4.  
    5. GameObject CharacterGameObject = new GameObject("Character"); // This is actually a prefab in my project that already has a photonView component but lets create a game Object  with the component instead
    6. PhotonView fred = CharacterGameObject.AddComponent<PhotonView>();
    7. fred.viewID = viewID;
    8.  
     
    Last edited: Mar 5, 2018
  7. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    No problem. :)

    I've just tried this. Whilst I didn't see any errors and fred's viewID was again 1001, there was nothing visible in the scene or in the GameObject that my script is attached to.

    I have to confess I am a little unsure as to what a "new GameObject" call will actually do. All the objects I have created have either been scene objects or created from prefabs (using either Unity or Photon Instantiate calls).

    Are you creating new GameObjects and parenting them to current scene objects and then seeing them become visible in scenes that way or something like that?
     
  8. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    When you use New GameObject() it just creates a new game object in the scene and places it in the root of your Scene.
    Instantiate is for prefabs and Instantiate with Photon is for loading a resource.
    Interesting enough I used to think what you are thinking right now. That creating a new GameObject doesn't automatically place it into the scene lol. So that blew my mind like 6 months ago when I realized that.

    The only difference then from what im doing and in the example I just posted is Im using a prefab with Instantiate When creating the Character. So maybe that matters.

    Code (csharp):
    1.  
    2. public GameObject Prefab; // This preab will have a photone view component on it
    3.  
    4. GameObject SpawnGameObject = new GameObject("Spawn Controller",typeof(PhotonView));
    5. int viewID = PhotonNetwork.AllocateViewID();
    6.  
    7. Transform Character = Instantiate(Preab, new Vector3(), new Quaternion()).transform;
    8. PhotonView fred = Character.GetComponent<PhotonView>();
    9. fred.viewID = viewID;
    10.  
     
  9. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    Oh, my mistake - I obviously did not look hard enough! Indeed "Character" does get added to my scene with a viewID of 1001:
    upload_2018-3-5_23-9-10.png

    But you are creating a prefab that contains a PhotonView. Then using Unity Instantiate to create it in the scene and then apply the viewID to it.

    I have just tried that as well now. It still works with no errors. However, I am only compiling and running this inside the Unity Editor. The other side is just my standard binary running (I have a slow laptop and it takes ages to build the full exe). So maybe it is an issue with actual networked connections under this scenario?
     
  10. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    I'm gonna try using a prefab here in a bit.
    I guess I should make a new script and try my example out.
    I'm just running this in my editor as well.
     
  11. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    I think I'm on my way to solving this problem.
    If I PhotonNetwork.Instantiate a Spawn Prefab the error goes away. I tried to use just Instantiate but that didn't work.
    I can't figure out why though. I'm the only client connected.
    So i have to PhotonNetwork.Instantiate a photonView gameobject into the scene in order to use [PunRPC]
    I tested though it runs the CreateSpawn function.
    Unless you can't assign a photon ID to a PhotonView on a gameObject that wasn't Photon.Instantiated or loaded when the scene loads.

    Code (csharp):
    1.  
    2. GameObject SpawnGameObject = PhotonNetwork.Instantiate("Spawn",new Vector3(),new Quaternion(),0);
    3. int viewID = PhotonNetwork.AllocateViewID();
    4.  
    5. Transform Character = Instantiate(Preab, new Vector3(), new Quaternion()).transform;
    6. PhotonView fred = Character.GetComponent<PhotonView>();
    7. fred.viewID = viewID;
    8.  
     
  12. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi, yes, hopefully 2018 will not have the same issues as we had with 2017.

    basically, we had some issues with transferring large amount of data at a steady rate, that would be just fine with .net 3.5 but crash with a "Out of bound Network" odd error if using .net 4.6, we also add issued with connection initial phase.

    and if Unity 2018 bring 4.6 as a stable option, PUN will support this, and hopefully, there will be very little, and/or otherwise easy to fix problems.

    As always, it is very dangerous to adventure real world project using beta version of Unity, or even x.1 versions, I never do that. Indeed you are right, once you start with a new version of Unity, you can't go back, this is very true with this new .Net 4.6, porting it back to 3.5 is impossible, so make sure you weight the pros and cons of using .net 46 in a sensitive project ( I still develop and publish with Unity 5.5 for example...)

    also, I am not sure 2018.1 default option will be 4.6 are you sure about that? where did you read or get this? From what I see in 2018.1b8 , 4.6 is still experimental and not the default option.

    Bye,

    Jean
     
  13. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    I am just wondering - if that is the case, why did the call still fail when we tried that earlier test replacing the object with another object that was already working. Shouldn't making that replacement then have caused the ID to work properly?

    It would seems to be more likely something that is particular to the process that you are using to create this particular GameObject irrespective of the actual class that you are using?
     
  14. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429

    When you call PhotonNetwork.CloseConnection(Player), it now doesn't set him as inactive, which was not right, if you kick a player out, he has to leave the room fully.

    I think you possibly misunderstand the term, sorry if that sounds confusing :) "kicking a player out" in my wording is when the masterClient forcefully close the connection of a player in that room, that's all. it has nothing to do with turning off your tablet.

    Bye,

    Jean
     
  15. scvnathan

    scvnathan

    Joined:
    Apr 29, 2016
    Posts:
    75
    We've been using 4.6 since 2017.2, but only brought in Photon a couple of months ago. We've had no compatibility issues with it so far. And I agree, betas and x.1 in Unity are dangerous - I would never recommend anyone use them unless to specifically test something.

    re: 2018.1 + 4.6:
    https://twitter.com/jon_cham/status/968662242337198080

    Actually reading further down the thread, 4.6 will be the default in 2018.2, not 2018.1. Still, it will be marked as stable in 2018.1.

    Have you been in touch with the Unity developers about the 4.6 issues? As you can see in the twitter thread, he says they have no known issues remaining. Might be good to let them know about the problems with Photon given its such a popular networking solution.

    And thanks for the details about the where the issues are, now we know what to watch out for :)
     
  16. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Trying to get the culling code working and it does to some extent but I run into an issue with RPC's. When I issue this call it is never received. It works fine again when the networkcullinghandler is removed though. These objects are all created using group 0. PhotonTargets.AllViaServer should send to all anyway right?

    The problem is probably obvious to someone? I must be missing something here.
    photonView.RPC("getNewTarget", PhotonTargets.AllViaServer, photonView.viewID, targetphotonView.viewID);

    Update:
    It seems that "AllViaServer" does not work but if you use just "All" it does work. So I have changed to that for now and see if it affects other things.
     
    Last edited: Mar 8, 2018
  17. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    Hi Baraff,

    It seems that the only difference between All and AllViaServer is for the local client. Locally, "All" will resolve down to a local method call - meaning the local client will get the call ahead of all others. AllViaServer forces the call to go out over the network.

    Do you have some sort of timing issue? With "All" executing local code immediately, maybe something has gone out of scope or has changed by the time the "AllViaServer" call arrives at the local client?
     
  18. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Hi @Doug_B ,

    Not a timing issue. It is just that if I use "AllViaServer", which is what I had already been using prior to implementing the "networkcullinghandler" and works fine normally. It does not work when "networkcullinghandler" is used. The RPC is never fired, verified via debug.log. As soon as I changed to "All" it works again.

    I am not sure of other implications yet as I have not tested, but I generally always use "AllViaServer" in my code, so I am thinking that there may be a bunch of things that will not work unless I change them all to "All".

    PS.
    I did stumble upon this link, which may mean it has never been fixed or changed? http://forum.photonengine.com/discussion/8334/rpc-call-not-working-in-groups-for-allviaserver
     
  19. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    @Shadowing: What's the callstack for that error? If you assign 0 as ViewID, that's not going to work. You should use AllocateViewID() to get a non-used viewID and assign that. Send it in your RPC (for others to instantiate and assign). You could mail us details to: developer@photonengine.com.

    @X-rus: There is a BackgroundTimeout, which will keep your players from being inactive endlessly. This only applies to Android though, as iOS will kill the connection when an app goes to background. There's no way around that (aside from maybe becoming a IM app, which may keep a connection)...

    @scvnathan: We don't have a list of .Net 4.6 incompatibilities just yet. In general, I don't think we're running into bigger issues and can support .Net 4.6 soon.
     
  20. Kecske85

    Kecske85

    Joined:
    Apr 19, 2013
    Posts:
    8
    Hi!
    I would like to report a bug and urge you to fix it ASAP.

    Sending "too much" data in OnPhotonSerializeView() corrupts the stream, which results in all kinds of errors on the receiver side, most typically an InvalidCastException.

    To reproduce, add the following at the end of OnPhotonSerializeView() in CubeExtra.cs in the Photon demo and run the "Movement smoothing" demo :

    for (int i = 0; i < 100; i++)
    {
    //PhotonPlayer player = PhotonNetwork.player;
    //stream.Serialize(ref player);
    bool _bool = true;
    stream.Serialize(ref _bool);
    Vector3 pos = Vector3.zero;
    stream.Serialize(ref pos);
    Quaternion rot = Quaternion.identity;
    stream.Serialize(ref rot);
    }

    Sending only 10 batches of data still works, but somewhere between 10 and 100 it breaks.
    Pls fix!
     
  21. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    We deliberately didn't apply rigid limits, because different platforms have different capabilities, so it's actually hard to say what breaks when. As you do, you have to test and to make sure things work for your use case.
    I am sorry, that the issues due to this are so messy.

    If you have trouble making your ideas work, please mail us your intention and current approach. We will try to help you.
    Mail to: developer@exitgames.com.
     
  22. Kecske85

    Kecske85

    Joined:
    Apr 19, 2013
    Posts:
    8
    That's the worst excuse I have ever heard.
    Either fix it so it actually works, or put a huge red letter warning in the documentation that the amount of data you can send without running into bugs is limited and throw a proper error when it does exceed the limit.
     
    Last edited: Mar 12, 2018
  23. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    It's very important to understand that you should strive to send the minimal amount of data, so hitting the hard limit or navigating just below it is not recommended, both for a fluid network simulation, as well as for hosting costs.

    in your case, the idea of being able to synchronize hundreds of object is not going to work with a brute force approach such as the one you have implemented. This falls into a MMO type of network structure which is completely different than Photon Networking approach.

    What you could do is:

    - only send 10 objects position per stream and cycle through your hundreds of objects in chuncks.
    - have maybe a networkView per object and drastically reduce the sendrate on these with great smoothing and lerping. SendRate can be adjusted dynamically, so if an object is moving a lot, increase the sendrate, and reduce it if it becomes still or not moving much.
    - use network group and interest based maps to rule out objects that are far away or not within the range of the gameplay.

    Can you explain what is your goal with these hundreds of gameobject? are they bullets? ennemies? props?


    Bye,

    Jean
     
    tobiass likes this.
  24. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    598
    I don't see any reason for them to fix something because you don't know how to code your game.

    This :

    Sorry, but it's a poor code .... Everything is done in a bad way ...
    Bad code, bad network way, bad performance.

    Really not the way to do it properly.

    So before saying that to someone :

    See what you do first.....
     
    Jean-Fabre and tobiass like this.
  25. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Isn't it possible to just run a client on Linux build for headless mode and make it always the master client for Photon Pun? I don't see any reason why that wouldn't work.
     
  26. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648

    I'm confused here. He said he is having issues with just 100 or less objects. Not hundreds.
    This concerns me now when making my game :( I figured i could at least do 100. Which is all I need. Probably really only need like 50 max so i'll probably be ok. I was gonna use it for bullets to though. In which id would need more. I always like extra for head room too. Now it sees im gonna need to use RPC calls for that. I thought I read the limit was around 400 objects?
    what is the send rate?
    60 times a sec or what?

    Why even use stream if under objects are failing? Course who knows what this guys code really is lol. Or if his test is even accurate.
    If it fails under 100 objects might as well not use stream and just use RPC calls only. Stream seems a bit pointless to use.
     
  27. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    Yes, it's possible, however you would still need an OnPremise Server to run, so it would run on the same server as your headless Unity build acting as the master. PUN can only run against OnPremise Servers regardless if you run Unity build as headless or not.

    Bye,

    Jean
     
  28. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    For MMO, you need a different archietecture to be able to handle dozens/hundreds of network Objects active at the same time. PUN wasn't designed for this, and really practically max out at 20, 30 objects, without much headaches, after that, you are on your own pretty much :) but nothing prevents you from using the bare bone underlying LoadBalancing Framework used by PUN and implement your own networking system. This is what Albion has done:

    https://albiononline.com/en/home

    Albion runs on Exitgames OnPremise, the same server that run son Photon Cloud and power PUN. So IT IS possible to have hundreds of active network objects, but the amount of work to achieve this is well above the average or expert level, you need a tiny bit of genius and lots of hardwork to achieve this.

    If you want mmo the easy way, I think this solution has something to offer: https://assetstore.unity.com/packages/templates/systems/ummorpg-51212 it has great feedback and reviews which is a good sign, I never tested this myself though.

    On stream vs rpc: You have to realize that under the hood all of this become just single messages being sent, stream is just a prettyfier for constant value changes, to make easy for you to do that in Unity and component based architecture. rpc is the same, one off call is easy, but it all gets converted down the line into single messages, something that the LoadBalancing framework takes care off, so you can simply go straight for the LoadBalancing and work directly with it, implement your own layer on top dedicated to your Game needs.


    Bye,

    Jean
     
  29. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Thanks Jean. Ya the idea is just so a single user isn't serving everyone. I did build a little thing though that switches the master to the best client ping though. It would also prevent cheating to though.
     
  30. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Ya I own that MMO asset but its crowded with tons of other stuff and their Third person controller. I really want to just do instances though.
    I"ll just say what im wanting to do. Most of the game runs on web requests using php/mysql. Inventory, quests updates etc..

    When a player is not in a group
    I'm wanted like around 100 people in the same room where they can run emotes and trade between players. Emotes and stuff like that is just a single rpc call. NPC's and player weapon fire are not sync between players.
    So its really just movement that is now a issue. But I think now if i can batch it i can pull this off. Probably even more than 100? 100 would be fine though if I could achieve that. I would push people to another room to balance rooms out. Just wanted to have enough in a room so it feels populated enough.

    When a player is in a group
    If a player creates a group he will enter his own room and anyone joining his group will be in his room (Instance). Group max of 6 players. But in this room all NPC are in sync as well as weapon fire. But with a max of 20 to 30 it doesn't look like they can fight very many enemies at a time.

    But it sounds like I just need to limit the data being sent. I can shorten it by limiting it to where if 20 NPC's are running then no other NPC will send stream data for movement.
    Bullet fire. I'm using projectiles on all weapons. I was thinking maybe not syncing the projectiles. Just sync the direction the weapon is being fired in and when its being fired. But idk that idea really complicates things when things take damage. Clients would have to tell other clients when they did damage to something. Which could be fine maybe idk. Maybe sending projectiles in batches using lerp is a better idea for this.

    Stream is just between the server and the clients. The master client isn't involved in that right? Thats how I always understood it.

    It really sounds like Photon networking is only for a Player vs player game with no AI with out doing special logic.
     
  31. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429

    Hi,

    On MMOrpg asset. It doesn't matter if they have tons of features, leave them aside and use the core to achieve what you want, you don't have to use all their stuff I guess?

    I think you should experiment with the Chat Sdk, if positioning is something not critical to have in near realtime you can use the chat sdk to send position once in a while.

    AI is on top of Photon yes, but it's not just a player vs player no, it is a true multi player network system, so you can have your 4vs4 or 8vs8, or teams of 2 or 3 players playing in the same room. AI has nothing to do with this, for AI you need to plug another asset that will control players or NPC behaviors.

    If you have a proper budget, maybe you should check Quantum : https://www.photonengine.com/en-US/Quantum and ask the team if 100 players npc doable with quantum?

    Bye,

    Jean
     
  32. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    I don't use AI assets. I built my own. Plus all the AI assets use codeless behavior trees I don't want to use that crap. Would be a nightmare doing logic with that. Im already seeing massive performance issues with the opsive third person controller asset I use that I'm gonna have to make more efficient.

    What you mean AI has nothing be to do with it?
    The master client controls the AI and sends rpc calls to all other clients to keep AI in sync. You gotta tell other clients what AI behavior is gonna be for each AI? You gonna need stream the AI to keep thier positions in sync?
    One idea is to use rpc to send nav mesh data to ensure movement syn between clients.
    Like I said earlier if my rpc can sync AI as to where npc are aiming thier weapons then really bullets don't need be networked streamed.

    It's funny you mention photon chat. I already been considering sending vector positions with it.

    That MMO asset isn't a real MMO asset. It only works with a single scene. I would need a new game server instance for every single zone/planet/scene in my game. It's something I don't want to take on ATM.
     
    Last edited: Apr 3, 2018
  33. dragologic

    dragologic

    Joined:
    Oct 28, 2012
    Posts:
    16
    When I call functions to all clients like this
    photonView.RPC("Publish", PhotonTargets.Others);
    How can I know if every client execute this function?
    Can I have responce from client when done?
     
  34. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Turn logging on
    It will show all the RPC being sent

    If you are the client receiving a rpc it will show it in the log.
     
  35. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    RPC calls are 'guaranteed' delivery. As a general rule, you use them to know that all the specified targets will receive them. Probably the two most likely scenarios for this not to be the case are :
    1. A client dropping connection, or
    2. Running different versions (due to shortcuts used for RPC names).
    For point 1, you can detect dropped clients and act accordingly in that event. So if that call was not buffered then that client will possibly never receive that call (depending at what point it lost its connection). If this would cause an issue should the client reconnect, then you could consider making the call buffered. However, remember that there is an overhead to buffered calls, so use them sparingly.

    For point 2, you could either disable this shortcut, or, you could perform a run-time check at the beginning to ensure all clients are running the same version of your software.

    If this is an actual run-time requirement, you would have to make a return RPC. However, be mindful of the fact that network calls are typically best kept to a minimum.
     
  36. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    996
    Hmm, any Changelog for 1.9?
     
  37. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    @i42-Xblade: Yes! Now :)
    This is mostly a console-related update but loading scenes also got an update. We're focusing on a bigger PUN "2" release at the moment, which will have some breaking changes.

    What's new:

    v1.90 (10. April 2018)
    Added: PhotonNetwork.LoadLevelAsync() with LoadSceneMode.single mode support only ( LoadSceneMode.additive async loading requires keeping track of all loadings)
    Fixed: A WebGL build warning about unused code (minimal change).
    Fixed: Compile conditions for console-related code. Some of the code will not work in the editor.
    Updated: To Photon3Unity3d.dll v4.1.1.19, which contains a few important fixes. Mainly WSS and console related. See plugins\release_history.txt.
     
  38. alexchandriyaa

    alexchandriyaa

    Joined:
    Jan 18, 2017
    Posts:
    140
    am using photon am doing word battle multiplayer game here am generating 10 random letters player have to find the correct word among match making is working but the letters generated is different for all players bbut i need the same letters to be generated? can anyone give suggestions?? @tobiass
     
  39. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    You can set a Room Property with a "Seed" for the random character generation.
    You can also send this Seed to everyone in the room, via RPC (or RaiseEvent, for that matter).
     
  40. alexchandriyaa

    alexchandriyaa

    Joined:
    Jan 18, 2017
    Posts:
    140
    can you explain me with some sample lines of code??
     
  41. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
  42. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    I meant what you just said :) AI engine doesn't matter for the sake of synchronizing npc or players over the network, what matters if synchronizing the position and rotation, so in that regards, how position and rotation is computed doesn't matter. You don't need to stream any AI data actually, unless you have a deterministic AI, which is unlikely.

    Bye,

    Jean
     
  43. TheXWolf

    TheXWolf

    Joined:
    Dec 13, 2013
    Posts:
    85
    If I could get some input; I'm trying to decide which avenue to approach regarding implementation of server-client.
    I'm considering using PUN because of it's ease of use and cloud-like system rather than photon-server, but I want people to be able to host their own servers OR just start up a game an join friends.

    Would it make sense then to use pun and if someone wants to host just startup the room, but if someone wants to host a dedicated, run a headless version of the game that starts the room and have that client act as the master client? Or would that simply be inefficient and be better to use photon server?
     
  44. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    Yes, Photon Cloud runs on our OnPremise Server, which available here: https://www.photonengine.com/en-US/OnPremise

    So you can host yourself, and run the exact same client ( not connecting to the cloud but to your server, everything else works the same)

    Running a headless version of the game is a different matter, and yes it's possible too, but you will need to create the architecture yourself, PUN might not be the best ( tho, your headless would be the one creating the room, become the masterClient, and that's about it for clients basically...). You might want to use the RealTime SDK, which is the fundation for PUN, where you are free to organize yourself anyway you want, no PhotonView, no RPC, no MasterClient, just raw message operation.

    Bye,

    Jean
     
  45. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699
    Hi there,
    I want to build out real time, multi player that (hopefully) will be on Steam, Switch, Xbox and Playstation. I believe Photon is as good as any.

    What I am wondering is, is if I build my framework with PUN Free... can I easily transfer/swap in PUN Pro, if needed?
     
  46. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    @renman3000: You can use PUN Free for the release, even if you buy PUN Pro for the 100 CCU Plan that's included there. The files are actually identical by now (PUN Plus used to have native libraries for Android and iOS, back in the days but that's no longer needed).

    So: You can buy PUN Plus anytime and apply the 100 CCU Plan for your existing Photon AppId. No problem.
     
    renman3000 likes this.
  47. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699

    Great! Plan to apply to game for builds on Steam, Switch, Xbox, Play Station.... cool?
    Edit. Also CCU stands for? Obviously it is the amount of networking data via number of players, yes? Thank you.
     
  48. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    Yes: CCU = Concurrent Users. Players at the same time, which is a measure of how much network and servers are used and we base our pricing on this. For the CCU count, it does not matter which platform a client is on.
     
  49. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699


    Hi so just to be clear you support Steam, Switch, Xbox, and PlayStation?
     
  50. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072