Topology vs. Input and State Authority
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on Fusion.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Topology vs. Input and State Authority
grandpa
2022-02-06 18:36:35
I've been setting up a new test project, and have gotten stuck on assets spawning without input or state authority being assigned to the host and client.
The topology of the project uses GameMode.AutoHostOrClient, and I can see from the Network Runner that the game is connected, and the sessions is configured to recognize that it is the host prior to assets being called to spawn.
When spawning assets, NetworkRunner.Spawn() is being used with 4 parameters, including a reference to the player reference to what should be the host player. The reference has also been tested using Debug calls to make sure that it isn't a null reference being passed.
I've been following the tutorial examples pretty closely, but I can't tell what combination of settings or assumptions are responsible for the fact that NetworkObject on the spawned asset shows [Player:None] for both the Input and State Authority.
What might be going wrong? I see very similar code with seemingly no meaningful difference being used in the example project, and that one properly sets at least Input Authority to a player index.
So my questions:
What are the combination of settings that are responsible for determining state authority besides the topology?
Why, when the property should be settable, can it not be changed while in GameMode.AutoHostOrClient?
Do objects need Input Authority if no network based inputs are being used to control the assets?
Any help would be appreciated. If any code snippets would be helpful, I'm happy to post it. I don't know where the problem might stem from so I don't even know what to share.
Comments
Hi @grandpa
We suggest taking a look at our dedicated page for Spawning here: https://doc.photonengine.com/en-us/fusion/current/manual/spawning
What are the combination of settings that are responsible for determining state authority besides the topology?
In the case of the ClientServer Mode, which is the one you are using when you start with the GameMode.AutoHostOrClient
:
- State Authority is always assigned to the Host.
Input Authority is assigned to the Player that you pass as an argument when calling the Spawn
- method.
Why, when the property should be settable, can it not be changed while in GameMode.AutoHostOrClient?
- State Authority can't be transferred, the Server/Host is always the state authority.
Input Authority can be transferred using NetworkObject.AssignInputAuthority
(https://doc-api.photonengine.com/en/fusion/current/class_fusion_1_1_network_object.html#aace7bdbf35dc87b4f0caa0efa067c023
- )
Do objects need Input Authority if no network based inputs are being used to control the assets?
From a Client perspective, only via the use of Input or RPCs you are able to change the State of a NetworkObject
.
As the Host is always the State Authority, the client sends inputs, so the state can be changed by the Host.
--
Also, the GameMode.AutoHostOrClient
is nothing more than a shortcut when you create Game Session, Fusion will automatically choose if the Peer will start as a Host (if it is the one creating the Session) or start as a Client (if it is the one joining an already created Session).
This GameMode does not change anything in the ClientServer
Topology, but it is just a utility GameMode
.
--
Ramon Melo
Photon Fusion Team
Thanks Ramon,
I did have a couple of follow up questions:
Does that mean that in this topology, that I shouldn't expect to see input authority assigned on the network object? When I spawn, I pass a playerref, and I've even tried to assign input authority to the network object after it's spawned, but it still doesn't show up.
Also, when state authority is held by the host under this topology, will that not be reflected explicitly in the inspector view of the network object?
@ramonmelo, just using the tag to make sure you see.
Thanks again.
@ramonmelo Having a similar issue, for some reason no matter what I've tried input authority is not being assigned to the network object. Are there any common errors that could prevent input authority from being assigned?
Hi @grandpa , @HunterK ,
Does that mean that in this topology, that I shouldn't expect to see input authority assigned on the network object? When I spawn, I pass a playerref, and I've even tried to assign input authority to the network object after it's spawned, but it still doesn't show up.
No, again, this is just a shortcut, instead of choosing which peer will be Host and which will be Client, Fusion selects it for you. The rest is exactly the same.
In ClientServer Mode, the Host spawns the players and gives Input Authority to the Clients.
Also, when state authority is held by the host under this topology, will that not be reflected explicitly in the inspector view of the network object?
No, if ClientServer Mode, the Server is always the StateAuthority, so it will just point to the None PlayerRef
, so the behavior and handling are the same if you are running a dedicated server or a host.
Having a similar issue, for some reason no matter what I've tried input authority is not being assigned to the network object. Are there any common errors that could prevent input authority from being assigned?
There should be no problem assigning the Input Authority Player, just pass it in the Runner.Spawn()
method and it should be set.
Take a look at our docs about the topic: https://doc.photonengine.com/en-us/fusion/current/manual/spawning
--
Ramon Melo
Photon Fusion Team
Back to top