Skip to main content

Switch from Single to Multiplayer Mode

Key Problem

UploadSwitch from single-player mode to multiplayer mode and vice versa

Expected Output/Definition of Done

Able to switch from single-player mode to multiplayer mode and vice versa

Key Solution

To separate a single and multiplayer mode. Developer can modify the max player connected and the lobby name. Example below

NetworkRunner.StartGame(new StartGameArgs
		{
			....
      CustomLobbyName = _lobbyId, //your lobby name, can be used for filtering. e.g "SingleGame" and "Nultiplayer"
			PlayerCount = customProps.PlayerLimit, //max player connected
			....
		});

By adding a CustomLobbyName , you can join specific lobby filled with same lobby id

How to filter out Single Player Mode so it doesn’t show up in Lobby list?

To achieve that result you can use following function provided by Fusion

NetworkRunner.JoinSessionLobby(SessionLobby.Custom, lobbyId);

This will allow you to join specific lobby, after it successfully connecting, it will call OnSessionListUpdated() as callback. Make sure to add proper step after receiving session list

public void OnSessionListUpdated(NetworkRunner runner, List<SessionInfo> sessionList)
	{
		//do something here, like refreshin room list available to join
	}

Important note :

  • In Progress

    Server and Host mode, both is counted as one Player, so it’s contribute to PlayerCount