Photon Fusion

Photon Fusion - Multiplayer Network Solution

Download: Photon Fusion Download Page

Overview:

Photon Fusion is a new high-performance state synchronization networking library for Unity. With a single API, it supports many network architectures such as dedicated server, client-hosted, and shared/distributed authority.

It is built with simplicity in mind to integrate naturally into the common Unity workflow, while also offering advanced features like data compression, client-side prediction and lag compensation out of the box.

Fusion implements a robust tick-based simulation and state snapshots system with built-in reconciliation. This allow Fusion to work seamlessly with non-deterministic libraries like Unity PhysX.

Besides the cloud-based shared mode where each client has full authority of its own objects (like PUN before it), Fusion includes two full server-authority modes:

  • a strict Client/Server setup with dedicated headless Unity instances; or,
  • a player-as-host with one of the clients working as both server and client (Host);

Important Links:

Requirements:

  • Unity 2020.3 or up.

Supported Platforms:

  • Microsoft Windows
  • macOS
  • Android (including Quest)
  • iOS
  • Linux

Coming soon:

  • Nintendo Switch
  • Xbox One
  • Xbox Series X & S
  • PS4
  • PS5

Available Samples:

  • Fusion Dragonhunters VR [link]

  • Fusion Karts [link]

  • Fusion Razor Madness [link]

  • Fusion Tanknarok [link]

Release History

  • 1.0.0 Stable (Mar 17, 2022) [link]

Awesome. On the kart one, I checked the highlights but didn’t see mention of CSP. Is the Kart demo using client or server auth?

Hi,

The Fusion Kart demo works in ClientServer topology, so the Server is always the State Auth, while the Client performs the simulation prediction.


Ramon Melo
Photon Fusion Team

1 Like

I’ve used Photon Fusion beta and I can honestly say it’s the best networking solution for Unity out there. Great job guys!

5 Likes

Looks awesome!
Seams like the networking API my top-down shooter needs.
Good work.

I’ve been doing some basic testing to become familiar with Fusion before I start to migrate my [RPG ]( The Kingdom of Galanor, Playtest Available page-2#post-6944129)from PUN to Fusion.

Initial results look very promising, I set up a test for my character controller to check movement synchronization (using the supplied network position/rotation component) and at one point had 9 clients connected to the same room, all of which were moving pretty much constantly and it never exceeded 1 msg/s.

Something similar with PUN with the same quality of synchronisation using the built in components would have resulted in far higher msg/s count, probably in the 100s.

Anyhow, @tobiass the main reason for my post is to ask if there is an equivalent to PUN InstantiationData, I’m guessing there is, but I’ve been unable to find mention of it in the docs/examples.

Thanks :slight_smile:

Ok, I started with my game, first following the tutorial, and later changing the code to fit my game, and the first results are incredibly good, I love how easy to use is fusion and how good it works. But, I want to change the matchmaking code from the tutorial. I made so first tries to connect as a client to a random room by deleting the room name, get the StartGameResult and if the result is not OK I start a game (without name so fusion generates a random name) as host. When I press the button I see in the debug that failed to join a room, but it doesnt try to create one. Here is a simplified version of my code:

StartGameResult res = runner.StartGame(someArgs);//It will try to join a random room, since no room name has been specified
if(!res.Ok) runner.StartGame(someArgs)//No room found so creates a new one with random name.

I tried with shared mode, but the 2nd player spawned 2 instances, the 3rd one 3 and so on.
I havent touched the spawn code.

What Im doing wrong @tobiass ?
Should I use shared or hosted mode for a 1v1 top-down shooter?
If shared, the code of fusion 100 series works for shared mode?

1 Like

Hello, I downloaded Kart a while ago and thought it was an excellent multiplayer game pack, but I want to modify a part, it will count down three seconds when entering the game opening, press the forward button before the GO text appears to get a boost is so short , I think the timing is too difficult to grasp, so I want to modify the time to be longer (for example, pressing the forward key when the word GO appears, still allows the boost), I have sent a letter to Photon Team Japan, but can only give me suggestions, so I have seen similar code in KartController.cs(OnRaceStart), but no matter how I modify it, I can’t extend the time. I don’t know if you can give me modification suggestions, thank you!

Hi, yes, it is possible.
When spawning a new NetworkObject, just fill the OnBeforeSpawned() callback, it will be invoked before the NO is spawned and can be used to fill its state before it is synchronized on the network.

Take a look here for more info: https://doc.photonengine.com/en-us/fusion/current/manual/spawning#runner_spawn


Ramon Melo
Photon Fusion Team

1 Like

Hi, simple enough:

var result = await runner.StartGame(new StartGameArgs() {
  GameMode = GameMode.AutoHostOrClient,
  // ...
});

This will start your peer in either Host or Client mode automatically depending if it is creating or joining a Game Session.

If you start the peer at the exact same time, due to the Session creation being an asynchronous process, it can take a bit of time, then your client and end up creating new Sessions because the other one could not be found yet.
The Fusion 101 may require a few changes to work in Shared Mode, but the core implementation will still work.


Ramon Melo
Photon Fusion Team

2 Likes

That’s great, thanks for the info :slight_smile:

Thanks a lot! You saved me hours of searching!

@ramonsmelo How can I prevent automatic synchronization of scenes between host and clients. With PUN I used to set PhotonNetwork.AutomaticallySyncScene to false, but I can’t find the equivalent in Fusion.

Thanks

Hi,

Fusion does not even imply that scenes must be synchronized at all.

The SetActiveScene method only does the following:

  • sets an int that clients can read
  • the actual scene loading and matching of scene-bound NetworkObjects is done by the SceneObjectManager implementation (which is a sample class, that you can freely modify or implement differently).

You can totally ignore that method.

In production cases, we suggest you network which scenes should be loaded as a NetworkArray or any other form you choose, and you modify/create a SceneObjectManager implementation that attaches the network objects from the server scene + instantiates the matching right prefabs on the clients…

The mechanism how this works can be seen on the sample implementation as I mentioned.

1 Like

Hi perick, thanks for clarifying that. :slight_smile:

One question:
There is some way to prevent cheating in fusion or pun?

That is quite an open question, but this usually means Server Authority over the Game State, and this can easily be accomplished with Photon Fusion running in ClientServer mode, in which the client can only predict their game, but the truth about the game state always comes from the Game Server. It will help to solve most cases.

Take a look here for more information:


Ramon Melo
Photon Fusion Team

1 Like

Hi, I already used Photon PUN with success for a simple multiplayer game, a few years ago, and now I should start a bigger project, sort of 3D Chat-Metaverse like experience, with many users interacting in various ways in shared rooms.
So, i would pose some questions to better understand my potential options and costs:

  1. For my project I guess i should have a go with Fusion but exploring your website I see there’s at least another Unity option called Quantum, what are the main differences between it and Fusion? (Allow me to give you a little tip: a feature comparison table between all your products would be very, very appreciated :)).

  2. My virtual experience should rely on multiplayer support as well as voice/text chat, so is it possibile to subscribe to Fusion + Voice + Chat services and use them all together in the same app?

  3. Assuming the point 2. is true - as I guess - I would better understand what could be my costs. Should I simply sum all the costs from every service’s pricing page, or there’s some other formula to combine the prices? Could you possibly give me some practical, ballpark example: let’s say a first scenario with 50 people potentially interacting and chatting (voice and text) and another bigger case with 500 people or more.

Thank you for your attention!

Riccardo

  1. I dont know
  2. You can do it.
  3. Fusion price + voice price + chat price.

I might be wrong, but I think that is.

Also make your game run on a server, otherwise the host’s computer will die.

1 Like

Thank you anyway for the answer, hope the Fusion developers would confirm or rectify if necessary.
Another question that came to mind: does Fusion support WebGL too?

1 Like