Network Topologies
Network Topologies
Fusion supports three network topologies:

Within Fusion network topologies are called 'Modes'.
Dedicated Server
The server application is built from the Unity project and runs a full headless Unity build. The Dedicated Server has full and exclusive State Authority over all objects.
Clients can only modify networked objects by sending their input to the server (and having the server react to that input) or by requesting a change using an RPC.
Since dedicated servers are usually hosted on public static IPs there is no need for UDP hole punching or network relays.
The downside to dedicated servers is the cost of spinning up complete Unity instances for every game session. Photon does not provide servers for hosting a dedicated Fusion server application.
The Dedicated Server runs in the Fusion mode GameMode.Server
and the clients (players) run as GameMode.Client
.
Read more about Dedicated Servers
Client Host
In Client Host, one of the players machines is the Host acts as both a server and a client. The host has a local player, polls input for it and interpolates the rendering as expected of a client.
Overall, this mode is equivalent to a Dedicated Server but is much cheaper to run as no server hosting costs are incurred. However, this comes at the price of the state authority's trustworthiness. A rogue host can cheat.
The Client Host mode comes with built-in UDP NAT punch-through to enable direct connection between each client and the Player Host. If this fails, and Fusion cannot establish a direct connection, that player will connect through a relay. This is a sporadic occurrence and only happens to approximately 1 in 10 players. Although the relay introduces a potential source for additional latency in a Client Host game, it is rarely noticeable in terms of gameplay.
The Player Host runs in the Fusion mode GameMode.Host
and the other players run as GameMode.Client
. Fusion can be created with GameMode.AutoClientOrHost
, which makes the first player connected to a room start as GameMode.Host
and later players start as GameMode.Client
.
Single Player
Fusion allows the network code to run locally without changes. The logic is executed as in Player Hosted Server mode but without opening an external network connection. The game runs without alteration or special cases in the code. Fusion runs in GameMode.Single
in this case.
Shared Authority
In Shared Authority, authority over network objects is distributed among all clients. Each client initially has State Authority over objects they spawn, but are free to release that State Authority to other clients. Optionally, clients may be allowed to take State Authority at will. The Photon Room controls changes of state authority and holds a complete copy of the networked state. Fusion runs in GameMode.Shared
.
For those coming from Photon Unity Networking (PUN), Shared Authority is similar in many ways. Fusion more feature-rich, faster, and has no run-time allocation overhead.
Where Next?
Introduction
The start of the Fusion documentation is the introduction.
Choosing the Right Network Topology
We have a guide on choosing the best network topology for your game.
Tutorials
If you already have a good idea of what topology to use you can get started with the tutorials. Both Dedicated Server and Client Host have the same programming approach, so are covered by a single tutorial:
Back to top