Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Photon Unity Networking

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

  1. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    The 500 messages is per room, and isn't a cap as such, it's a recommendation for performance reasons.

    Also, your calculation for 50 players sending messages at 10 per second is a little off. each client would be sending 10 messages per second to every other client. So unless I'm mistaken the message per second count would be in the order of 25,000 for 50 players in the same room each sending 10 messages a second to everyone else.

    For an FPS game, I believe the recommendation is max 4-8 players per room for PUN. But for other game types the player count for each room could be much higher, with a bit of interest management and optimization. For example my multiplayer RPG game will support up to 50 players per room and stay within the 500 msg recommendation.
     
    TokyoWarfareProject likes this.
  2. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    564
    @tobiass

    Hello,

    Do you know what the raise event code 201 mean?

    I have checked the doc here https://doc-api.photonengine.com/en/pun/v2/class_photon_1_1_realtime_1_1_event_code.html but the 201 is not listed.

    It must be an internal photon event.

    I get a warning message "RaiseEvent(201) failed. Your event is not being sent! Check if your are in a Room" everytime that i leave a room that contain players in it and i try to find out where this come from. This message come just before the OnLeftRoom call

    Thank you.
     
    Last edited: Mar 11, 2022
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Fusion. ;)
    For FPS and new projects, we would recommend checking out Fusion. It's a bit more complex to start with but the results are more precise and clean.

    It's the event code PUN 2 uses for the updates via OnPhotonSerializeView().

    The warning is not an issue, when you leave a room. It just shows that there still was some update that should be sent but then gets dropped (as RaiseEvent won't work when you leave/disconnect).

    How do you leave the room?
     
    roka and Munchy2007 like this.
  4. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    Good point, I keep forgetting about Fusion!

    But now you've reminded me about it, I've started to consider migrating my work in progress RPG from PUN to Fusion, but I have a couple of questions.

    1) I see that the maximum peers per room is 16, (I believe that's the same as PUN, and I'm guessing can be increased on request), but the target player count for Fusion is advertised as 200, so why is the default peer maximum so low?

    2) I see the recommended message count per room is still 500, how does this fit in with the target player count of 200? To support that many players per room (or even half that say), would I still need to roll my own networking optimizations and trickery to stay within the 500msg count (as I have done with PUN), or does the engine already have methods built in that will do the job adequately?

    Thanks :)
     
  5. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Because the pricing page for Fusion is a copy of another pricing page.
    Fusion is not meant to have this limit. Currently, I can't say if it will have a limit below 200 or not but 16 is definitely too low.

    The plan is that you don't have to do this or have to do very little of the trickery. This doesn't mean you can do whatever you want and we magically guarantee that everything will be alright. To have 200 players in a fast paced FPS is still going to take some sort of conservation.
    It will depend on the actual projects and expectations, how much of a limitation there is going to be.

    Sorry for the vague reply. This is not just a yes/no topic.
     
    Munchy2007 likes this.
  6. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    Okay, that's good to know.

    No apology needed, I wasn't expecting yes/no answer, but from what you've said and knowing the requirements of my game it does sound like the built in methods could very well be sufficient for my needs.

    Thanks for getting back to me, I shall do some experimentation. :)
     
  7. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    564
    Thank you for the information.

    I leave the room by doing :

    1 - PhotonNetwork.LeaveRoom();
    2 - I wait after the OnConnectedToMaster ()
    3 - I set PhotonNetwork.isMessageQueueRunning = false
    4 - I load my lobby scene
    5 - when i'm in my lobby scene, iI set PhotonNetwork.isMessageQueueRunning = true

    The warning message happen between the steps 1 - 3
    I also got this warning after switching from PUN1 to PUN2.Never got it in PUN1 with the same system. Anyway, everything is fine, this message do not make any problems.

    Thank you again.
     
  8. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    You're welcome! Let us know how you do. :)

    Yes, the message is harmless.
    I will look into avoiding it, when we update PUN 2 at some point. Glad to see you updated from the outdated PUN Classic!
     
  9. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Just in case you missed it:
    Our next gen networking solution Fusion is finally released!

    It comes with much more precise tick based timing, proper authority, client side prediction, lag compensation and support for Host Migration. It is a huge step up from PUN. While some approaches are a bit more complex early on, it enables better results than ever.

    We did a couple of samples for it, so we finally have a nice VR project again:
    Fusion Dragonhunters VR

    Two more samples in the Asset Store:
    Tanknarok Multiplayer Demo
    Karts Multiplayer Demo

    More samples and docs here.


    Join our Discord to find the Fusion Community.
    Let me know if you'd like a thread like this for Fusion specifically!?
     
  10. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    I think it would be a good idea.
     
  11. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    787
    +1 for the custom thread
     
  12. hadrien23

    hadrien23

    Joined:
    Oct 9, 2019
    Posts:
    12
    @tobiass I had issues with PhotonView being still referenced by Photon after switching back and force between edit and play mode with no domain reload. (Project Settings > Editor > Enter Play Mode Options "on").

    The PhotonNetwork.RegisterPhotonView() method is checking photonViewList to prevent creating new photonViews with an already used ID, but the list itself is not cleared in the PhotonNetwork.StaticReset() method.

    I added a call "photonViewList.Clear()" and it fixed the issue. I don't see any side-effects so far.

    Sharing for info and others who might have the same issue.
     
  13. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    284
    Yes we need a separate Fusion thread please
     
  14. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Thanks for the feedback.
    The Fusion thread is up! Some good info in there, samples listed, etc.
    Hope to see you there :)
     
    Munchy2007 likes this.
  15. dan_ginovker

    dan_ginovker

    Joined:
    Jun 13, 2021
    Posts:
    41
    Will Photon development still be a priority, or is Fusion the future?

    If the Fusion migration guide offered a drop in solution it would be easy to switch, but we've built a lot with Photon and have other priorities :p
     
  16. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    You can consider PUN 2 in LTS mode: It likely won't get new features but we'll support existing projects and of course the Photon Cloud will continue to run them!

    That aside, Fusion and Quantum are going to be the projects that will get more updates and features. Both are miles ahead in terms of networking and synchronization.

    Yes, an automated migration would be awesome but not feasible for us. More likely we'll extend the doc for Fusion "Coming from PUN".
     
  17. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    109
    Hey there!

    I am experiencing some weird behaviour that i cannot explain, I could use some assistance in tracing what the issue might be.

    https://gyazo.com/c4dfc1d5ee085d678df968514e34d87a

    I get 2224 calls for DispatchIncomingCommands and 16k instantiation calls per frame and i have no idea what can cause this.

    I have put debugs in PhotonNetwork.Instantiate and PhotonNetwork.InstantiateRoomObject (i dont use instantiatesceneobject) and there's nothing that appears to be wrong, like, im not instantiating anything in any update or fixed update. What could it be instantiating 16k times and why?

    https://gyazo.com/effa13077011cca01b122f20a153614f

    As you can see in the above photo this dispatchincomming commands causes high number instantiations which im not sure where they come from, creating massive spikes but also increasing normal cpu time as they come always, not only during the spikes. I mean there are 255 instantiation calls in one frame and 59 dispatchincomingcommands calls in one frame like not in the spike but outside of spike. In spike it's even more.

    This happens when there are more players in the room, like more than 3 players. I tried with 2 players and the calls are normal. This is what the calls with one player in the room looks like: https://gyazo.com/e7e970ac19d186c5b6531c64137b7e83 It looks normal, 1 call per frame and no instantiation.

    Can you point me in the right direction on how to trace the cause of this weird behaviour?
     
    Last edited: Apr 28, 2022
  18. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    This is super odd. Never had a case like this.
    You may need to find which client sends this many events that result in instantiate calls and why.
    As the profiler doesn't name PhotonNetwork.Instantiate, my guess is that this is a regular Unity Instantiate call?
    Attach the debugger. You could put a breakpoint with condition on DispatchIncomingCommands (break e.g. when X were dispatched already). Then debug into the next best call and have a look.
     
  19. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    564
    I just upgraded my two game to use PUN2, so i really hope that we will be able to use it for years again.

    Fusion look promising but it do not support webgl at the moment.
    Do you know if it's planned to add the webgl support and if yes do you have any estimated date?

    Thank you.
     
  20. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    PUN 2 will be around for quite some time but it's unlikely we'll add new features. So for a current project it may be fine. In the long run, Fusion or Quantum is what we'd suggest.

    I can't say when it's ready but we are working on WebGL support for Fusion. It's coming.
     
    roka likes this.
  21. soumya_alphpi

    soumya_alphpi

    Joined:
    Mar 3, 2021
    Posts:
    6
    Hello everyone, I am a VR developer and trying to do character selection in photon network with google VR but it is not happening Can anybody guide me?
     
  22. gamescorpion

    gamescorpion

    Joined:
    Feb 15, 2014
    Posts:
    132
    I know it's a very old post but wanted to share our solutions here with the community =>

    For anyone experiencing this issue => Exiting receive thread (inside loop). Server: XXXXX

    Here is the solutions that have worked for our team:

    1. Check to see if the scene that you are loading is not MASSIVE in size.

    2. Check to see if the scene being loaded is not sending/receiving data in the first frame (Wait a while before sending/receiving sync information with Photon).
    TO TEST AND SEE IF THIS IS THE CASE:

    1. Create a FULLY EMPTY dummy scene in unity and add it to the build settings

    2. Connect to Photon and try and use that EMPTY scene to see if works (Which it most likely should). This will alert you that your issue lies in the scene you were trying to load (Due to one of the above items OR something else in that specific scene).
    Hope the above solution helps out others going through the same issues!

    Nav Gupta => Former Unity 3D Live Help Expert Team Member and now Founder and CEO of Chaarmi Worlds Inc. making the future metaverse!! Check us out at Chaarmi.com!
     
  23. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    @tobiass

    Hi, I've just found out that Fusion doesn't have an equivalent to RaiseEvent, and as I use it extensively to synchronize scene object visuals between clients (bearing in mind that clients can be in different scenes from each other, so using NetworkSceneObjects isn't workable), it doesn't look like I'm going to be able to port my game from PUN2 to Fusion.

    This being the case I'd like to ask if you are intending to fix any bugs that might become apparent and also keep PUN compatible with future versions of Unity? (I'm aware that you won't be adding any new features and that isn't a problem), or is the current version of PUN2 pretty much final?
     
    Last edited: Jun 23, 2022
  24. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    You can consider PUN 2 being in LTS mode.
    New Unity LTS versions will be supported (it's rarely an issue) and we'll look into any bugs and either fix it or try to find a workaround. We have to find a balance to not introduce bigger breaking changes (for existing projects). There might be things that we can't fix or change but if PUN 2 is by and large working for you now, we'll keep that up.

    I replied in the Fusion channel to your worries. Don't feel pushed to Fusion, I just thought this may be a good opportunity to show how it's different and how it solves the problem without you coming up with clever events for state.
     
    Munchy2007 likes this.
  25. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    Thanks for confirming your intentions to keep PUN2 compatible with LTS version of Unity.

    I've made a more detailed reply to your post in the Fusion thread, but the upshot is I've decided to stick with PUN2 for my current project, at least for the time being.
     
    tobiass likes this.
  26. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    Hi @tobiass

    Is there any chance that the Update function in PhotonStatsGui.cs could be changed to this, so that it works with the new input system as well as the legacy input system
    Code (CSharp):
    1.         /// <summary>Checks for shift+tab input combination (to toggle statsOn).</summary>
    2.         public void Update()
    3.         {
    4. #if (ENABLE_LEGACY_INPUT_MANAGER)
    5.             if (Input.GetKeyDown(KeyCode.Tab) && Input.GetKey(KeyCode.LeftShift))
    6.             {
    7.                 this.statsWindowOn = !this.statsWindowOn;
    8.                 this.statsOn = true;    // enable stats when showing the window
    9.             }
    10. #else
    11.             if (Keyboard.current.tabKey.wasPressedThisFrame && Keyboard.current.leftShiftKey.isPressed)
    12.             {
    13.                 this.statsWindowOn = !this.statsWindowOn;
    14.                 this.statsOn = true;    // enable stats when showing the window
    15.             }
    16. #endif
    17.         }
    The asmdef file in the UtilityScripts folder will also need to be given a reference to Unity.InputSystem

    It's not a major issue if you can't, it's just it would save me having to redo the changes if you do any updates in future.

    Thanks :)
     
  27. psyhama

    psyhama

    Joined:
    Sep 4, 2018
    Posts:
    20
    Hi, @tobiass
    We're investigating the case that Photon Cloud become unstable on high traffic.
    But there's a mystery.

    When half to one year ago, we're experiencing difficulty when there's much traffic in a room. The server disconnects clients on high traffic.

    But recently, when we experiment with some high traffic, the server no more disconnects clients. Instead, the server refuses to accept new users joining the same room for some time.

    So could you give me any clue for this behaviour change?
    Is there any changelog/release notes of Photon Cloud service?
     
  28. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Thanks for the heads up and code. Is it possible to reference Unity.InputSystem in the asmdef, if the new system isn't active?

    You'd need to get in touch via mail and provide more details. High traffic is not well defined and we'd like to know your AppId, client SDK version, etc. Basically provide us with the relevant info and we can check.

    There is no changelog for the Photon Cloud, no. We try to keep changes non breaking but we also had cases, where we needed to protect the servers against dangerous use cases.
    If this is a change we did in the recent past, we may be able to elaborate.
     
  29. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,701
    Errrm! No, it appears not. So feel free to disregard my request, unless you can think of a different solution.

    In the meantime, I will just make my own version of the stats GUI, separate from the PUN package and use that instead.

    Thanks :)
     
    tobiass likes this.
  30. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    406
    Hi there! What is the best Photon solution for multiplayer card game like poker and so on?
     
  31. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Card games are always a bit tricky. They may require timing (despite being mostly turn based) and you need to hide most of the info from the clients.
    It depends a little on how competitive it will be and if cheating protection has high prio.
    I think I would use Photon Realtime on the client (mostly RaiseEvent) and build a Server Plugin to host the logic of a game.
     
  32. Per-Morten

    Per-Morten

    Joined:
    Aug 23, 2019
    Posts:
    90
    Hi, I'm trying to reduce GC allocations by switching over to using ByteArraySlice when sending events as suggested here: https://doc.photonengine.com/en-us/pun/current/gameplay/optimization
    However, when I try to use ByteArraySlice in the following manner I just get an exception.
    Code (csharp):
    1. var pool = PhotonNetwork.NetworkingClient.LoadBalancingPeer.ByteArraySlicePool;
    2. var slice = pool.Acquire(MeasurementChangedEvent.SerializationByteSize);
    3. slice.Buffer[0] = 255;
    4. slice.Count = 1;
    5. PhotonNetwork.RaiseEvent(NetworkEvents.MyEvent, null, _removeFromCacheOptions, SendOptions.SendReliable);
    6. PhotonNetwork.RaiseEvent(NetworkEvents.MyEvent, slice, _addToCacheOptions, SendOptions.SendReliable);
    Code (csharp):
    1. Exception: cannot serialize(): ExitGames.Client.Photon.ByteArraySlice
    2. ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, System.Boolean setType) (at <f453158ca4a441daa57033eee0bc497e>:0)
    3. ExitGames.Client.Photon.Protocol16.SerializeParameterTable (ExitGames.Client.Photon.StreamBuffer stream, ExitGames.Client.Photon.ParameterDictionary parameters) (at <f453158ca4a441daa57033eee0bc497e>:0)
    4. ExitGames.Client.Photon.Protocol16.SerializeOperationRequest (ExitGames.Client.Photon.StreamBuffer stream, System.Byte operationCode, ExitGames.Client.Photon.ParameterDictionary parameters, System.Boolean setType) (at <f453158ca4a441daa57033eee0bc497e>:0)
    5. ExitGames.Client.Photon.PeerBase.SerializeOperationToMessage (System.Byte opCode, ExitGames.Client.Photon.ParameterDictionary parameters, ExitGames.Client.Photon.EgMessageType messageType, System.Boolean encrypt) (at <f453158ca4a441daa57033eee0bc497e>:0)
    6. ExitGames.Client.Photon.PhotonPeer.SendOperation (System.Byte operationCode, ExitGames.Client.Photon.ParameterDictionary operationParameters, ExitGames.Client.Photon.SendOptions sendOptions) (at <f453158ca4a441daa57033eee0bc497e>:0)
    7. Photon.Realtime.LoadBalancingPeer.OpRaiseEvent (System.Byte eventCode, System.Object customEventContent, Photon.Realtime.RaiseEventOptions raiseEventOptions, ExitGames.Client.Photon.SendOptions sendOptions) (at Assets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs:967)
    8. Photon.Realtime.LoadBalancingClient.OpRaiseEvent (System.Byte eventCode, System.Object customEventContent, Photon.Realtime.RaiseEventOptions raiseEventOptions, ExitGames.Client.Photon.SendOptions sendOptions) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2189)
    9. Photon.Pun.PhotonNetwork.RaiseEvent (System.Byte eventCode, System.Object eventContent, Photon.Realtime.RaiseEventOptions raiseEventOptions, ExitGames.Client.Photon.SendOptions sendOptions) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2311)

    I'm running PUN 2.34.1 and Photon Lib 4.1.6.4. Any ideas on how to investigate this further or what could be wrong?
     
  33. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    The serialization protocol is likely 1.6 but only 1.8 supports this.
    Make sure the LoadBalancingClient.SerializationProtocol is SerializationProtocol.GpBinaryV18.
    Your version is a little dated overall. Would recommend updating to 2.41, which then also uses the 1.8 protocol by default.
     
    Per-Morten likes this.
  34. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    107
    Has anyone had luck networking between a Mac and a PC - If I play my game Mac to Mac, or PC to PC there are no issues. However, if I try to play between mac and PC, I get a lot of errors in the form

    RPC method not found on object with PhotonView

    Often the method referenced is not on the object with the photon view id, sometimes they are RPC methods that are system methods that I have never used like ClickRPC

    Example:
    RPC method RPCClick() not found on object with PhotonView ID 43 - but I never use that method and it is not on or called by the object with ID 43

    Any help appreciated.
     
  35. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Cross platform is fully supported and there are no known issues for this. You could verify this by building one of our samples for PC and Mac...

    You need to make sure you build the same project and RPC list for both platforms. Make sure prefabs are also the same.
     
  36. MrGreenish

    MrGreenish

    Joined:
    Oct 20, 2019
    Posts:
    28
    How do I add PUN2 (free) as a dependency in a package.json file?
    I got this atm but it's throwing an error: com.photon-engine.pun-2-free (dependency): Package [com.photon-engine.pun-2-free@2.40.0] cannot be found

    This is what I have at the moment:
    Code (CSharp):
    1. "dependencies": {
    2.         "com.unity.textmeshpro": "2.1.6",
    3.         "com.photon-engine.pun-2-free": "2.40.0"
    4.     },
     
  37. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    There is no PUN 2 package in the UPM, so I think it's impossible to define this dependency.
    PUN 2 will show up in the Package Manager, when you got it from the Asset Store but as far as I know, that doesn't work as dependency.
     
    MrGreenish likes this.
  38. MrGreenish

    MrGreenish

    Joined:
    Oct 20, 2019
    Posts:
    28
  39. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    409
    That happened to me too sometime in the past. There was a bug that caused Photon to add default RPC's on top of the RPC list which caused older versions received RPC's index to mismatch of RPC with the new version as all indexes moved by an amount.
    Sorry I don't remember what was causing it or how I fixed it.
     
  40. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    107
    Thanks. That is very helpful.

    Thanks. I pulled over the project again and rebuilt on the Mac. Same story. If I run the game on the Mac, and join with the PC, I am getting this error on the PC:

    Code (CSharp):
    1. RPC method 'NewMoney()' not found on object with PhotonView 43. Implement as non-static. Apply [PunRPC]. Components on children are not found. Return type must be void or IEnumerator (if you enable RunRpcCoroutines). RPCs are a one-way message.
    2. UnityEngine.Debug:LogErrorFormat (UnityEngine.Object,string,object[])
    3. Photon.Pun.PhotonNetwork:ExecuteRpc (ExitGames.Client.Photon.Hashtable,Photon.Realtime.Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:640)
    4. Photon.Pun.PhotonNetwork:OnEvent (ExitGames.Client.Photon.EventData) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2201)
    5. Photon.Realtime.LoadBalancingClient:OnEvent (ExitGames.Client.Photon.EventData) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3353)
    The NewMoney RPC method does not exist in any script on the object with ViewID 43.

    If I start a game on the PC and join with the Mac, I get this error too:

    Code (CSharp):
    1. RPC method 'ClickRpc()' not found on object with PhotonView 43. Implement as non-static. Apply [PunRPC]. Components on children are not found. Return type must be void or IEnumerator (if you enable RunRpcCoroutines). RPCs are a one-way message.
    2. UnityEngine.Debug:LogErrorFormat (UnityEngine.Object,string,object[])
    3. Photon.Pun.PhotonNetwork:ExecuteRpc (ExitGames.Client.Photon.Hashtable,Photon.Realtime.Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:640)
    4. Photon.Pun.PhotonNetwork:OnEvent (ExitGames.Client.Photon.EventData) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2201)
    5. Photon.Realtime.LoadBalancingClient:OnEvent (ExitGames.Client.Photon.EventData) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3353)
    6. ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:899)
    7. ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:565)
    ClickRpc is a method I don't use, it looks like a system method.

    Any thoughts on how to run this down are appreciated.
     
  41. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    409
    It's definitely the issue I mentioned. Find "PhotonServerSettings" scriptable object in the project. Select that and under RPC's dropdown remove default ones.
     
    MonkeyPuzzle likes this.
  42. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    107
    Thank you! I didn't find that before. I am also retooling to have all my enemies instantiated by Photon. I can see why that is helpful as view IDs become kind of a mess. I will report back with findings.
     
  43. Johan_Liebert123

    Johan_Liebert123

    Joined:
    Apr 15, 2021
    Posts:
    473
    Is it possible to change a game from pun2 to fusion?
    I've been looking into fusion for a bit, even though my project is been going for quite long now, In my opinion I reckon using fusion would be a much better networking api to use. Though would it be a good choice to change it with a pre existing project, is it worth editing all scripts and changing it to fusion? Or starting the project again, or not changing it at all?
     
  44. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    Changing from PUN to Fusion requires you to re-write bigger parts of a networked game.
    If you are unhappy with the current solution or are stuck with results that don't meet your expectations, I would recommend the switch. Same, if you are just interested in the new, improved tech.
    The results you will achieve are just much better with Fusion.
    There is a high level migration doc for developers coming from PUN.
     
    Johan_Liebert123 likes this.
  45. Nest_g

    Nest_g

    Joined:
    Jun 18, 2019
    Posts:
    33
    Photon have a unfair pricing by ccu peaks?, if you game have in a month only a day with 500 ccu and other 29 days with 0 ccu you collect a 500 ccu monthly subscription?
     
  46. ayrton2389

    ayrton2389

    Joined:
    Oct 25, 2013
    Posts:
    26
    I'm having some frustrating issues with Photon Unity Networking Classic.

    I can't seem to be able to build my project for UWP. I'm using the latest version of PUN Classic, and Unity 2019.4.4f1.
    I even tried to create an empty project, download just PUN Classic, and build a scene, but i'm getting the same error i get in my own project.


    Code (CSharp):
    1. Assets\Photon Unity Networking\Plugins\PhotonNetwork\NetworkingPeer.cs(836,51): error CS0246: The type or namespace name 'PingWindowsStore' could not be found (are you missing a using directive or an assembly reference?)


    I tried switching to UWP in build settings, and building with the default settings for Photon3Unity3d.dlls.
    I also tried excluding WSAPlayer from NetStandard2.0 folder .dll, and including it in the Metro folder .dll, with SDK set to UWP and ScriptingBackend set to IL2CPP. Same error both times.

    Any ideas what i'm doing wrong, @tobiass , or what is going on?
    Reproducing this issue is pretty easy, just create an empty project, download PUN Classic, switch to UWP and try to build any scene. Am i missing something? :|
     
  47. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    We book servers mostly on a monthly basis. If we have to prepare those for 500 CCU at any point in the month, we need the machines to cover the worst case.
     
  48. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,941
    I think I can take a look at this next week (Tuesday). Maybe I find a workaround.
    Maybe the relevant code just needs to compile for NETFX_CORE, instead of UNITY_WINRT (which is used in that section for reasons I don't recall). Might be worth a try to just comment out the line that causes the issue.

    PUN Classic is quite old and we discourage using it since years. Can I ask why you stick to it? Old project?
     
    Last edited: Sep 23, 2022
  49. ayrton2389

    ayrton2389

    Joined:
    Oct 25, 2013
    Posts:
    26
    Sticking with PUN Classic was not my choice, it's an older app built by another team in the company, and i was tasked to port it to UWP in the near future, even though i haven't worked on that app before. I also work part-part time (10h a week) for this company, as a second job, so i'd like to avoid replacing all the networking stuff.

    I managed to actually build the app by replacing PingWindowsStore with PingMono, but i haven't had the chance to actually test the app to see if anything breaks because of this change, or if it works as it should. After waiting more than an hour packaging the app in Visual Studio, i got some certificate signing error, it was already mid-night, so i wasn't able to pack it again and wait all that time to test it. Gonna give it another go this weekend, though.
     
  50. Gabe851

    Gabe851

    Joined:
    May 13, 2017
    Posts:
    22
    PUN Classic being PUN 1 right? Is it still ok to use PUN2 for new projects that are not ambitious networking-wise? I'm looking at making a project that is just 1v1, slow pace, not an FPS or even a game with player avatars, and each player has a bout 10-20 formation type units they can move around slowly and only need to sync their transforms and a few bits of state. No need for client prediction, or any aiming/fps stuff, and it can tick slowly.
     
unityunity