How Network Decides Host?

I am creating a game which will be PvP, so, 1 player vs 1 player. So, 2 player max. The game, will randomly match players looking to play.

What I am wondering is, how the game will determine host and client.

So, is this a random decsion? Is it the player who looks for a game first? How does it work? How does the network determine, which player is Host and which is Client?

Thank you

You decide.

okkkkkk.

So, let say me and you decide to play.

You press play before me. What will happen is a cue to look for other players wanting to play. None exist until I press play. Now that the server sees you and i, it matches us ( I am assuming this is the process (coming from photon)).

I am not sure if it matters, but then at this point, where two players are assigned to a room, is the host client role decided in the background automatically?

Perhaps I am not at the point yet where I have come across this in the tutorial.

In Unet system, client can host.

If no rooms are availables on matchmaking server (on Unet server) : your first client, who want a room, have to create it.
It’s not “Automatically”, you have to see if a room is available and if not : create it and become a host.

BUT

Imagine you want to host some rooms(to prevent cheat or whatever) on a professional server. Developer will launch some servers, this servers host the game and your client will connect to them.

I haven’t tried yet the second solution (no money/knowledge for that ^^).

edit…
I think I just found what I want, the NetworkLobbyManager.

//original

Right, thank you. I actually just started a related thread here…link

But what I am wondering is how do I a) set the room requirements (number of players), b) know those requirements are met?

I can not see anything in the official docs.