Search Unity

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

Third Party Photon Fusion

Discussion in 'Multiplayer' started by ramonsmelo, Apr 5, 2022.

  1. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Weird how it's lot more expensive. PUN premium tier 0.29$/ccu, Fusion 0.50$/ccu.
     
  2. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    @tobiass said that the pricing page was wrong
     
  3. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Where? Said that only limits are wrong.
     
  4. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Oh.

    I guess that, since fusion offers more than PUN and bolt together, it will be more expensive.
     
  5. appsscity1

    appsscity1

    Joined:
    Feb 6, 2020
    Posts:
    20
    Hi ramonsmelo

    We have implemented photon fusion in our game and got below issue-

    Sometimes when we invoke StartGame method without passing a SessionID (Joining or Creating Random Room) on 3 or more devices these two Exceptions are invoked even though the StartGameResult.Ok flag is being true and the room is not created.

    Fusion SDK Version - Nightly 477

    Check attached logs.Please provide a solution for these because we are planning to release our game as soon as we can.
     

    Attached Files:

  6. sumitshresthaaitcentre

    sumitshresthaaitcentre

    Joined:
    Dec 21, 2021
    Posts:
    7
    can i use same dedicated host for multiple games instance ..please help me making the lobby cannot see how to make proper lobby from documentation .i need to see all the session .is session like a room??
     
  7. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Hi, we will need the complete logs from your peers to get a better idea of what might be happening. You can send them to developer@photonengine.com

    At first glance, you have some communication issues with the Photon Cloud, hence why you are getting a Timeout Exception there, meaning you can be trying to connect to a far Region from what you are at the moment, you are using a limited internet connection (maybe a mobile connection?) or even you have some kind of firewall in place.

    It's hard to conclude anything just from the error type.

    --
    Ramon Melo
    Photon Fusion Team
     
  8. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Hi,

    We suggest taking a look at the following tutorials:

    1. Fusion 101: https://doc.photonengine.com/en-us/fusion/current/fusion-100/overview
    2. Fusion Application Loop: https://doc.photonengine.com/en-us/fusion/current/samples/fusion-application-loop
    3. Matchmaking API: https://doc.photonengine.com/en-us/fusion/current/manual/matchmaking

    It should be enough to give you a better idea of all the topics you are asking for.

    Yes, you can run as many instances of your Dedicated Server as the Host Machine can handle.
    Each Unity instance maps to one Fusion Dedicated server.

    --
    Ramon Melo
    Photon Fusion Team
     
  9. sumitshresthaaitcentre

    sumitshresthaaitcentre

    Joined:
    Dec 21, 2021
    Posts:
    7
    can any 1 help me i need to make a multiplayer game but need to create many sessions from one instance of dedicated server please any help?>?
     
  10. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Hi,

    Take a look here (https://doc.photonengine.com/en-us/fusion/current/manual/multipeer) for more info on how to use the Multi-Peer Mode on Fusion.

    By using this mode, you should be able to run multiple Fusion Runners to serve different Sessions.

    --
    Ramon Melo
    Photon Fusion Team
     
  11. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    Hi,

    what's the equivalent to PUN2's RaiseEvent in Fusion? I need non-networked scene objects be able to react to network events (e.g. doors open/close).
     
  12. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    There is no particular equivalent, but the closest would be the use of RPCs to communicate arbitrary data.
    Keep in mind that RPCs should be used only for rare and occasional communication, as they are not part of the Game State and are not replayed for late joiners, for example.

    For the cases you are describing, you should just keep a "World State" NetworkObject created by the Server that in turn will be read by the clients in order to update their visual simulations locally.

    This will ensure that every client has the same state instead of relying on communicating every piece of the update via an RPC, for example.
    Our suggestion is the avoid using RPCs as much as possible.

    Fusion State Transfer model: https://doc.photonengine.com/en-us/fusion/current/manual/state-transfer
    RPCs: https://doc.photonengine.com/en-us/fusion/current/manual/rpc

    --
    Ramon Melo
    Photon Fusion Team
     
  13. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    Oh! That's very bad news!

    RPCs are definitely not a workable alternative, I never use them.

    What would be your suggested method of synchronizing the visuals of things like doors, item pickups, drops etc? In my case, I can't see how I can make them network scene objects, as my game is multi-scene/map and different clients can be in different scenes/maps, so they won't all have the same scene objects loaded at any one time. I guess this would also break the idea of your "World State" NetworkObject mentioned above.

    With PUN2 events, it didn't matter which scene the client was in as the "non-networked" scene objects only responded to events that applied specifically to them, which was the primary reason I didn't make them networked scene objects. I could also restrict sending of the events to only those clients that needed to receive them.

    As good as Fusion seems to be in other respects, not having a workable alternative to RaiseEvent seems like very big downside.
     
  14. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Give them a try then: https://doc.photonengine.com/en-us/fusion/current/manual/rpc

    You can do basically the same thing, send arbitrary data to specific Players or Network Objects for example.
    They are basically the same as ReiseEvent just with a different API.

    Not really, you can still have a global Network Object that reflects the state of a group of non-networked objects.
    Even if you use several different scenes, you can still use a similar approach, but you will need to create a mapping system between those objects and the scene, for example.

    This is still the suggested route.

    We also provide a sample project about dealing with multiple scenes:

    - Main Sample: https://doc.photonengine.com/en-us/fusion/current/samples/technical-samples/fusion-scene-loading
    - Doc Entry: https://doc.photonengine.com/en-us/fusion/current/manual/scene-loading

    --
    Ramon Melo
    Photon Fusion Team
     
  15. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    Hi, thanks for the links, and advice.

    The reason I have avoided using RPCs is due their dependency on the target being a networked object. My game will have 2-3 thousand scene objects that need visual synchronization, is Fusion geared towards handling that amount of networked objects? PUN isn't.

    I looked at the multi-scene example and this immediately caught my attention:-
    The Host / Server has to loads every scene, as it is the state authority of the session.
    Considering the size and quantity of scenes in my game, it will likely be impossible to have every scene fully loaded on anything other than a monster PC.
     
  16. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Fusion is made specifically for that type of cases.
    But you should make your project client/server if it isnt already, just to avoid preformance issues, plus you get server authority.
     
  17. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    One of the primary design goals was that it didn't require a dedicated server so players can host their own games and that it shouldn't kick everyone when the host leaves.
     
  18. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Fusion doesnt need dedicated servers, but if you are dealing with 200 network objects, the host will run at 2fps.
    Bandwidth wont be a problem.
     
  19. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    Thanks for your input, but I think you are fundamentally misunderstanding the reason behind my questions/comments.

    I already have a fully working implementation of my game using PUN2, but I was looking to port it to Fusion as that is Exit Games' recommended offering now.

    However, for my particular case it may not be the best choice, so I may just stick with PUN2.
     
  20. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Ramon, correct me if I'm wrong, please.

    If you create a world state object in Fusion, this will be kept up to date by Fusion itself very effectively:

    Let's say a door's state is one bool in that state, Fusion will detect changes to that bool and update everyone about that change - in a very effective way. The overhead here is much much lower than in PUN 2, even if you already use RaiseEvent very effectively and send all changes (e.g. in a tick) as a single RaiseEvent with just a few bits per change.
    So you would get rid of calling RaiseEvent individually but still end up with leaner network syncs.

    And you don't have to create one world state object. You could split state into several parts.
     
    ramonsmelo and Munchy2007 like this.
  21. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    Hi Tobias,

    thanks for your reply.

    I can see how things would work in your example, but it seems to me that if for example, I as a client open a door, all other players would be receive the new door state, even if they aren't in the same map as me or even never visit that map during the session. So every player will be sending door updates to every other player regardless of whether they need to know about those doors or not.

    As I have it set up in PUN2 currently, in the same example above, only those players in the same map and within range will be sent a state update, so it's entirely possible that nothing would need to be sent at all if I was the only player in the map at the time or no one else was near me.

    As players enter a new map and move close enough to the door, it will send its state to the new player, but only if it isn't in the default state.

    Just to be clear, I'm not just talking about a couple of doors per map, this also applies to the dozens of collectable quest items that are scattered all over the map as well as other intractable scene objects.

    It may well be that my unfamiliarity with Fusion isn't helping me see how I can achieve the same efficiency, but in any event, as I have achieved my goals with PUN2 and as your post in the Photon Unity Network thread answers my minor concerns about PUN2 going forward, I think the answer for me is to stay with it for this project.

    However, there are a lot of aspects of Fusion that are great, and for a different project I could see where it would beat PUN2 hands down.

    Thanks again for your time everyone.
     
    tobiass likes this.
  22. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Use the area of interest
     
  23. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Still there: https://www.photonengine.com/en-US/Fusion/Pricing
    Tbh I still don't understand why Fusion costs more than PUN if it's performs so much better. I guess that's a license price.
     
  24. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    And the fact it uses less bandwidth it means that you use less resources on the photon cloud server, which is cheaper for Exit Games... :rolleyes:
     
  25. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    In fact, it uses more resources on the server to enable the improved bandwidth, which you can use to allow more people into the same rooms. ;)
    And yes, it is also a license/tech fee, partially.
     
  26. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Can you give me a deeper explanation?
     
  27. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    What's the status of webgl support?
     
  28. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    WebGL support is released.
     
    r31o likes this.
  29. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Nice, that's something that can't be done using Epic's free relay.

    Found on your Discord that you may be hosting servers in the future. In terms of pricing is it going to be similar to PlayFab (low entry level, price per server hour) or Multiplay (high entry 1000$+)?

    I hope to see some kind of discount for licensing when paying additionally for servers. For now I'll stick to Mirror + Epic when not targeting webgl.
     
  30. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Photon will offer dedicated server hosting?
     
  31. NemoMong

    NemoMong

    Joined:
    Jul 8, 2021
    Posts:
    1
    Hi,
    I want to implement a Lobby where i can check the list of opened sessions.
    What's the max number of users that can enter the Lobby using Photon Fusion?
     
  32. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    There is no pricing or ETA for that to happen, this is future plan and nothing is confirmed yet.

    --
    Ramon Melo
    Photon Fusion Team
     
  33. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Please, take a look at our Matchmaking API Doc page for more information about how to use Session Lobbies.
    Link: https://doc.photonengine.com/en-us/fusion/current/manual/matchmaking

    The max number of players is limited only by the CCUs associated with your Photon AppID.

    --
    Ramon Melo
    Photon Fusion Team
     
  34. unity_91CE7A7504DECABB9553

    unity_91CE7A7504DECABB9553

    Joined:
    Jul 29, 2022
    Posts:
    4
    Hello
    I want to load a new scene after creating a room, and in the same way, all other players will connect to the room and load a new scene. Is there any way to load the scene from Photon Fusion or do we have to use the Unity load scene method?

    Also after loading the new scene I want the player to Spawn. So how can I do that?
     
  35. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Hi, please take a look at our dedicated page about Scene Loading in Fusion: https://doc.photonengine.com/en-us/fusion/current/manual/scene-loading

    --
    Ramon Melo
    Photon Fusion Team
     
  36. tskipurishvilimakrina

    tskipurishvilimakrina

    Joined:
    Nov 20, 2021
    Posts:
    7
    Have you found solution for this? I am having the same problem, animation doesnt play on the client side
     
  37. unity_91CE7A7504DECABB9553

    unity_91CE7A7504DECABB9553

    Joined:
    Jul 29, 2022
    Posts:
    4
    Hello
    Is there any way to sync position from the client/local player directly, rather than sending inputs to the Server player? Just like in PUN. The local player will update position and rotation to all other players.
     
  38. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    93
    - Up to 16 Peers per Room *
    Is there any way to bypass this restriction? I need a game with 20-30 players in one room. Is it posible with Fusion? If Fusion is not an option, then maybe Quantum? But this restriction is in Quantum pricing plan page as well
     
  39. Lukeesta

    Lukeesta

    Joined:
    Jan 7, 2016
    Posts:
    78
    The 16 peer limit only applies when running Fusion in Shared mode on the Photon Cloud. If you run Fusion in Host or Server mode you can have as many players in your room as the server supports performance wise. For more information about these modes you can checkout this page.
     
    tobiass likes this.
  40. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
  41. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Hi,

    Yes, you can use the Shared Mode in Fusion, and it will act similar to PUN in this sense.
    Each client has State Authority over its own Network Objects, and each one can update the Network Properties of those NO, and they will be replicated over the network, this also applies to the Transform of the NO.

    You can read more about it here:
    - https://doc.photonengine.com/en-us/fusion/current/manual/network-object/network-object
    - https://doc.photonengine.com/en-us/fusion/current/manual/state-transfer
    - https://doc.photonengine.com/en-us/fusion/current/manual/matchmaking

    --
    Ramon Melo
    Photon Fusion Team
     
  42. unity_91CE7A7504DECABB9553

    unity_91CE7A7504DECABB9553

    Joined:
    Jul 29, 2022
    Posts:
    4

    Thank you
     
  43. sumitshresthaaitcentre

    sumitshresthaaitcentre

    Joined:
    Dec 21, 2021
    Posts:
    7
    @ramonsme sir can yu tell me how to register prefabs before runner is started or before game is loaded
     
  44. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    Hi,

    All Network Objects must be pre-registered on the Prefab Table on the NetworkProjectConfig.

    You can read more about it here:
    - https://doc.photonengine.com/en-us/fusion/current/manual/network-project-config
    - https://doc.photonengine.com/en-us/fusion/current/manual/spawning

    We also suggest following Fusion 101: https://doc.photonengine.com/en-us/fusion/current/fusion-100/overview

    --
    Ramon Melo
    Photon Fusion Team
     
  45. MustafaAgabey

    MustafaAgabey

    Joined:
    Aug 19, 2022
    Posts:
    2
    Hi, is it possible to add NetworkBehaviors to the pre-registered prefabs in runtime? I am trying to add a new NetworkBehavior in runtime after spawn. with the AddBehavior<T> wrapper. It is working but I do not receive the FixedUpdateNetwork() calls on that new behavior.
     
  46. unity_91CE7A7504DECABB9553

    unity_91CE7A7504DECABB9553

    Joined:
    Jul 29, 2022
    Posts:
    4
    Hello
    I want to sync the child object position and rotation that is inside a prefab that has been spawned using a runner.Spawn method.
     
  47. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    No, as all the Networked data related to a NetworkObject must be declared within the NetworkBehaviors at compiler time, they can't be associated at runtime.

    Keep in mind that Fusion will only synchronize data that has changed, so even if it is declared within a NetworkObject, but does not change, it will not take bandwidth.

    About the AddBehavior, this is an extension method that does nothing more than call gameObject.AddComponent(), and it is used internally only.

    --
    Ramon Melo
    Photon Fusion Team
     
    MustafaAgabey likes this.
  48. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    You can just build a hierarchy of NetworkObjects, and spawning the root NetworkObject should be enough to synchronize all the children.

    You can read more about NetworkObjects here: https://doc.photonengine.com/en-us/fusion/current/manual/network-object/network-object

    --
    Ramon Melo
    Photon Fusion Team
     
  49. MustafaAgabey

    MustafaAgabey

    Joined:
    Aug 19, 2022
    Posts:
    2
    Is there some logic like in PUN for checking if NetworkObjects belongs to local player or any other player? Or better to ask if there is even something like ownership.

    Like photonView.IsMine in PUN.
     
  50. ramonsmelo

    ramonsmelo

    Joined:
    Jul 31, 2017
    Posts:
    39
    We highly recommend reading our docs.
    A few links related to your question:

    - https://doc.photonengine.com/en-us/fusion/current/manual/network-object/network-object
    - https://doc.photonengine.com/en-us/fusion/current/manual/spawning
    - https://doc.photonengine.com/en-us/fusion/current/manual/player
    - https://doc.photonengine.com/en-us/fusion/current/manual/state-transfer

    In the case of using Fusion in Shared Mode, which is similar to how PUN works, you would check if you have State Authority over the NetworkObject. In this case, using the NetworkObject.HasStateAuthority field (https://doc-api.photonengine.com/en...object.html#ae010f3f594c9db1fc65a8f0e7429ec99)

    This means any changes to the state by the local player, are synchronized over the network.

    --
    Ramon Melo
    Photon Fusion Team
     
    MustafaAgabey likes this.