Coming From Bolt
Introduction
This document will describe the major differences between Photon Bolt
and Photon Fusion
in terms of API, and how you can port sections of your Game written in Bolt into a Fusion project.
Bolt and Fusion share a lot of concepts, but the usage, API, and mainly the general behaviors are different.
Fusion Modes
What is very important to understand when coming from Bolt to Fusion is that Bolt only offers server/host topology while Fusion offers and additional Shared Mode which is fully client authoritative (Similar to Photon Unity Networking).
Most concepts that exist in Bolt are transferable to Fusion Host/Server Mode but NOT to Shared Mode.
This page explains how to migrate your Bolt knowledge to Fusion Server/Host Mode.
Differences
Here is a list of all major differences between Photon Bolt
and Photon Fusion
:
- On Bolt, the general API can be accessed via either the static classes
BoltNetwork
andBoltMatchmaking
, in Fusion that is done using an instance of theNetworkRunner
. - Fusion can run multiple peers from the same executable, while Bolt can run only one. This means that it's possible to run several clients from the same instance of the game. This is useful for testing and debugging purposes.
- Fusion has full support for Physics prediction and rollback by using the built-in
NetworkRigidbody
andNetworkRigidbody2D
components, on Bolt, this needs to be handled/implemented by the developer. The same applies when dealing withCharacter Controller
s, Fusion has theNetworkCharacterController
that works out of the box as a base implementation to move the player's character, while in Bolt, that also need a custom implementation.
Similarities
Here is a list of all major similarities between Photon Bolt
and Photon Fusion
:
- Fusion has the concept of a
NetworkObject
, which represents a UnityGame Object
that has networked properties used to synchronize data across the peers, Bolt has the same concept under the name ofBoltEntity
. The State of aNetworkObject
can be described on anyNetworkBehaviour
using theNetworked
attribute, in order to do this on Bolt, it is necessary to create and configure properties using theBolt Assets
window creating/editing aState
asset. More info. - All main SDK Events (start, shutdown, disconnect, among others), are handled in Bolt using instances of
GlobalEventListener
s, Fusion exposes this kind of event via the implementation ofINetworkRunnerCallbacks
associated with aNetworkRunner
. - Both SDKs have the concept of
State Authority
andInput Authority
, although it is calledOwnership
andControl
on Bolt, they have exactly the same meaning. More info. - Fusion is also a predict-rollback system, similar to Bolt. While in Bolt there are
Command
s sent by theController
of aBoltEntity
, in Fusion this is done sendingNetworkInput
s from a peer that hasInput Authority
over aNetworkObject
, but differently of Bolt, where the rollback (State reset) is done manually (within anExecuteCommand
with theresetState = true
), in Fusion that is automatically at the beginning of a new Frame before the call of theFixedUpdateNetwork
method. - For every controlled
BoltEntity
, Bolt calls theSimulateController
method on the respectiveEntityEventListener
associated with theEntity
. This is done differently on Fusion, as there are no multiple sources ofNetworkInput
(Command
onBolt
), and only 1NetworkInput
can be associated with a specificFrame
for allNetworkObjects
. This is done via the implementation of anINetworkRunnerCallbacks.OnInput
callback. More info. - The well-known Remote Procedure Calls (
RPC
s) on Fusion are calledEvents
on Bolt. They have very similar controls (who can send, who can receive, and reliability) but can be defined directly via code on Fusion, while in Bolt it is necessary to set them up using theBolt Assets
window. More info. - Fusion has a lot of built-in components that help with the synchronization of common types of data, one example of this is the
NetworkTransform
, which can be mapped to aTransform Property
on Bolt. Both are used to synchronize the position and rotation of aGame Object
while providing a smooth transition between snapshots, capable of interpolating between data points. More info. - Fusion is also capable of synchronizing only the desired set of
NetworkObject
using theArea of Interest
API. More Info. - On both SDKs there is the concept of a
Scene Object
, which is a pre-createdNetworkObject
associated with a Scene. When that particular scene is loaded, these objects are automatically attached to the simulation. - Another solution implemented on both SDKs is the
Lag Compensated Physics Checks
used mainly to detect collisions with Raycasts considering the lag between shooters and targets. More info.
Reference Table
Bolt | Fusion | Description |
---|---|---|
BoltNetwork, BoltMatchmaking | NetworkRunner | Main API entrypoint |
BoltEntity | NetworkObject | Represents a Networked Game Object |
BoltEntity State Properties | Networked Properties | Set of synchronized properties |
GlobalEventListener | INetworkRunnerCallbacks | General Event handling |
EntityEventListener | NetworkBehaviour, | Networked Game Object Event handling |
BoltNetwork.Instantiate() | NetworkRunner.Spawn() | Creates a new Networked Game Object |
BoltNetwork.Destroy() | NetworkRunner.Despawn() | Removes a Networked Game Object from the simulation |
BoltEntity.IsOwner | NetworkObject.HasStateAuthority | Signal if the peer can modify the State of a Networked Game Object |
BoltEntity.HasControl | NetworkObject.HasInputAuthority | Signal if the peer that can push inputs to a Networked Game Object |
Commands | NetworkInput | Control Structure used to predict on Client and alter the State on the Server |
Objects | NetworkStructs | Reusable data structures that contain Networked Properties and can be used in more than one State |
Events | RPC | Communication method used to transfer pieces of information that does not need to be part of the simulation |
Transform Property | NetworkTransform | Built-in support to synchronize the Transform (position and rotation) of a Networked Game Object |
BoltNetwork.LoadScene | NetworkSceneManager | API for switching/loading scenes in a synchronized manner |