private IEnumerator Start() { PlayerPrefs.Save(); CoopTreeGrid.Init(); LoadSave.OnGameStart += this.OnGameStart; yield return(CoopPeerStarter.PrefabDbResource); if (!CoopPeerStarter.Dedicated) { CoopLobby.Instance.SetServer(SteamGameServer.GetSteamID()); } BoltConfig config = base.GetConfig(); config.serverConnectionLimit = ((!CoopPeerStarter.Dedicated) ? (CoopLobby.Instance.Info.MemberLimit - 1) : SteamDSConfig.ServerPlayers); if (CoopPeerStarter.Dedicated) { BoltLauncher.SetUdpPlatform(new DotNetPlatform()); BoltLauncher.StartServer(SteamDSConfig.EndPoint, config); } else { BoltLauncher.StartServer(SteamGameServer.GetSteamID().ToEndPoint(), config); } try { BoltNetwork.AddGlobalEventListener(CoopAckChecker.Instance); } catch { } yield break; }
private void Awake() { this.ResetDSFlags(); UnityEngine.Object.DontDestroyOnLoad(base.gameObject); if (LoadAsync.Scenery) { Blur blur = (!LoadAsync.Scenery) ? null : LoadAsync.Scenery.GetComponentInChildren <Blur>(); if (blur) { blur.enabled = true; } } BoltLauncher.SetUdpPlatform(new SteamPlatform()); TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(false, ControllerType.Keyboard, "Default"); TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Keyboard, "Menu"); TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Joystick, "Menu"); if (!SteamManager.Initialized) { if (GameSetup.IsMpServer) { this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } else { this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser); } this.SetLoadingText(UiTranslationDatabase.TranslateKey("STEAM_NOT_INITIALIZED", "Steam not initialized", this._allCapsTexts)); return; } this.RefreshUI(); if (GameSetup.IsMpServer) { this._hostGameName = PlayerPrefs.GetString("MpGameName", this._hostGameName); this._hostMaxPlayers = PlayerPrefs.GetInt("MpGamePlayerCount", this.GetHostPlayersMax()).ToString(); this._hostFriendsOnly = (PlayerPrefs.GetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1) == 1); this._lobbySetupScreen._gameNameInput.value = this._hostGameName; this._lobbySetupScreen._playerCountInput.value = this._hostMaxPlayers; this._lobbySetupScreen._privateOnlyToggle.value = this._hostFriendsOnly; this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } else { CoopLobbyManager.QueryList(this._showFriendGames); this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser); } if (AutoJoinAfterMPInvite.LobbyID != null && (CoopLobby.Instance == null || CoopLobby.Instance.Info.LobbyId.ToString() != AutoJoinAfterMPInvite.LobbyID)) { CoopLobbyInfo lobby = new CoopLobbyInfo(ulong.Parse(AutoJoinAfterMPInvite.LobbyID)); AutoJoinAfterMPInvite.LobbyID = null; if (GameSetup.IsSavedGame) { this.OnClientContinueGame(lobby); } else { this.OnClientNewGame(lobby); } } }
void Awake() { // Set Bolt to use Photon as transport layer // this will connect to Photon using config values from Bolt's settings window BoltLauncher.SetUdpPlatform(new PhotonPlatform()); }
IEnumerator Test0() { if (staticData.boltFree == true) { BoltLauncher.SetUdpPlatform(new PhotonPlatform()); } BoltLauncher.StartServer(listeningPort); yield return(null); }
public void ChangeMasterServer(string regionToken) { BoltLauncher.SetUdpPlatform(new PhotonPlatform(new PhotonPlatformConfig { AppId = "8e1f090e-e0ff-4166-9ebe-6693470ecc07", // your App ID Region = PhotonRegion.GetRegion(regionToken), // your desired region UsePunchThrough = true, // enable the punch through feature RoomUpdateRate = 5, // session update rate RoomCreateTimeout = 10, // timeout when creating a room RoomJoinTimeout = 10 // timeout when joining a room })); }
void Awake() { // Set Bolt to use Photon as transport layer // this will connect to Photon using config values from Bolt's settings window BoltLauncher.SetUdpPlatform(new PhotonPlatform()); // Optionally, you may want to config the Photon transport layer programatically: // BoltLauncher.SetUdpPlatform (new PhotonPlatform (new PhotonPlatformConfig { // AppId = "67d57778-0998-44f2-8c74-8f9544bda46e", // RegionMaster = "usw" // })); }
private void Awake() { CoopPeerStarter.Dedicated = false; CoopPeerStarter.DedicatedHost = false; UnityEngine.Object.DontDestroyOnLoad(base.gameObject); this.PrefabDbResource = Resources.LoadAsync <PrefabDatabase>("BoltPrefabDatabase"); BoltLauncher.SetUdpPlatform(new SteamPlatform()); TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Joystick, "Menu"); if (!SteamManager.Initialized) { if (TitleScreen.StartGameSetup.MpType == TitleScreen.GameSetup.MpTypes.Server) { this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } else { this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser); } this.SetLoadingText("Steam not initialized"); return; } this.RefreshUI(); if (TitleScreen.StartGameSetup.MpType == TitleScreen.GameSetup.MpTypes.Server) { this._hostGameName = PlayerPrefs.GetString("MpGameName", this._hostGameName); this._hostMaxPlayers = PlayerPrefs.GetInt("MpGamePlayerCount", this.GetHostPlayersMax()).ToString(); this._hostFriendsOnly = (PlayerPrefs.GetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1) == 1); this._lobbySetupScreen._gameNameInput.value = this._hostGameName; this._lobbySetupScreen._playerCountInput.value = this._hostMaxPlayers; this._lobbySetupScreen._privateOnlyToggle.value = this._hostFriendsOnly; this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } else { CoopLobbyManager.QueryList(); this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser); } if (AutoJoinAfterMPInvite.LobbyID != null && (CoopLobby.Instance == null || CoopLobby.Instance.Info.LobbyId.ToString() != AutoJoinAfterMPInvite.LobbyID)) { CoopLobbyInfo lobby = new CoopLobbyInfo(ulong.Parse(AutoJoinAfterMPInvite.LobbyID)); AutoJoinAfterMPInvite.LobbyID = null; if (TitleScreen.StartGameSetup.Type == TitleScreen.GameSetup.InitTypes.Continue) { this.OnClientContinueGame(lobby); } else { this.OnClientNewGame(lobby); } } }
void Awake() { // Set Bolt to use Photon as transport layer // this will connect to Photon using config values from Bolt's settings window BoltLauncher.SetUdpPlatform(new PhotonPlatform()); // Optionally, you may want to config the Photon transport layer programatically: //BoltLauncher.SetUdpPlatform(new PhotonPlatform(new PhotonPlatformConfig //{ // AppId = "<your-app-id>", // RegionMaster = "<your-region>", // UsePunchThrough = false // set to true, to use PunchThrough //})); }
private void Awake() { Application.targetFrameRate = 60; BoltLauncher.SetUdpPlatform(new PhotonPlatform()); _labelRoomStyle = new GUIStyle() { fontSize = 20, fontStyle = FontStyle.Bold, normal = { textColor = Color.white } }; }
public static void SetRegion(int regionID) { PhotonRegion region = PhotonRegion.GetRegion((PhotonRegion.Regions)regionID); Debug.Log("[BOLT] New region set : " + region + "."); BoltLauncher.SetUdpPlatform(new PhotonPlatform(new PhotonPlatformConfig { AppId = "580c5d6e-2793-48b2-b0e0-7eb1272407f5", Region = region, RoomCreateTimeout = 10, RoomJoinTimeout = 10, RoomUpdateRate = 1, UsePunchThrough = true })); }
void Awake() { // Set Bolt to use Photon as transport layer // this will connect to Photon using config values from Bolt's settings window BoltLauncher.SetUdpPlatform(new PhotonPlatform()); // Optionally, you may want to config the Photon transport layer programatically: // BoltLauncher.SetUdpPlatform(new PhotonPlatform(new PhotonPlatformConfig // { // AppId = "<your-app-id>", // your App ID // Region = PhotonRegion.GetRegion("<region>"), // your desired region // UsePunchThrough = true, // enable the punch through feature // RoomUpdateRate = 5, // session update rate // RoomCreateTimeout = 10, // timeout when creating a room // RoomJoinTimeout = 10 // timeout when joining a room // })); }
public void DoStartBoltClient() { if (selectedGameSession == null || myPlayerSessionID == null) { LogToMyConsoleMainThread("No Player Session"); return; } if (BoltNetwork.IsRunning) { LogToMyConsoleMainThread("Bolt is already running"); return; } if (staticData.boltFree == true) { BoltLauncher.SetUdpPlatform(new PhotonPlatform()); } BoltLauncher.StartClient(); }
private void InitBolt() { if (this._connectionAttempts < 3) { CoopClientCallbacks.OnDisconnected = new Action(this.OnDisconnected); } BoltConfig config = base.GetConfig(); if (CoopPeerStarter.Dedicated) { BoltLauncher.SetUdpPlatform(new DotNetPlatform()); BoltLauncher.StartClient(config); } else { BoltLauncher.StartClient(SteamUser.GetSteamID().ToEndPoint(), config); } CoopAckChecker.ACKED = false; }
/// <summary> /// Start this peer as the Game Server /// </summary> private void OnServerActive() { if (BoltNetwork.IsRunning) { return; } try { // In order to start the server property when running on the PlayFab stack, it's necessary // to setup the local port where the server will listen and suppress the STUN request by passing // the binding information provided by PlayFab BindingInfo info; if (BuildBindingInfo(out info)) { // Override the STUN information sent by this peer, in other words, the public IP:PORT of this // instance. This information is gattered directly from the PlayFab stack, that provides statically // the binding data of each Virtual Machine BoltLauncher.SetUdpPlatform(new PhotonPlatform(new PhotonPlatformConfig() { ForceExternalEndPoint = info.externalInfo })); // Set the Server port using the information from the binding configuration BoltLauncher.StartServer(info.internalServerPort); } else // Shutdow if the binding info was not found { BoltLog.Error(MessageInvalidBinding); OnShutdown(); } } catch (Exception ex) { BoltLog.Error(MessageExceptionServer); BoltLog.Exception(ex); OnShutdown(); } }
void Awake() { BoltLauncher.SetUdpPlatform(new PhotonPlatform()); }
public static void StartSinglePlayer(BoltConfig config) { BoltLauncher.SetUdpPlatform(new NullPlatform()); BoltLauncher.Initialize(BoltNetworkModes.Host, UdpEndPoint.Any, config); }
public void ui_enterGame() { var steamPeerCallbacks = new SteamPeer.Callbacks(); steamPeerCallbacks.Host_Connected = steamPeer_Host_Connected; steamPeerCallbacks.Host_Disconnected = steamPeer_Host_Disconnected; steamPeerCallbacks.Host_Failed = steamPeer_Host_Failed; var steamPeerSettings = new SteamPeer.Settings(); steamPeerSettings.Host_Address = 0; var activeLobby = SteamHub.LobbyActive; // If no active lobby... return if (activeLobby == null) { Debug.Log("No active lobby to start game for"); // TODO we should say something to user return; } if (activeLobby.GetData <string>(activeLobby.OwnerId.ToString()) == "false" && !activeLobby.IsOwner) { Debug.Log("Host has not started game yet"); return; } if (activeLobby.IsOwner) { // B.1: If you are the lobby creator/owner, you should call // SteamPeer.StartHost(settings, callbacks), steamPeerSettings.Product_Description = "Ohh shiet"; steamPeerSettings.Product_Name = "Northo"; steamPeerSettings.Product_Version = "0.00001"; steamPeerSettings.Host_GamePort = serverPort; steamPeerSettings.Host_Address = 0; SteamPeer.StartHost(steamPeerSettings, steamPeerCallbacks); // We will receive the SteamID the clients should connect to in the Host_Connected callback. // Do nothing else yet.. this flow will continue in that callback } else { // B.2: If you are a member of a lobby and the creator / owner has started it, // you can connect to the SteamID of the game server by first calling // SteamPeer.StartClient(settings, callbacks); SteamPeer.StartClient(steamPeerSettings, steamPeerCallbacks); } // After you have called StartHost / StartClient, you should call // BoltLauncher.SetUdpPlatform(new SteamPlatform()); // depending on if you are host/ server, you do not need to specify any addresses / ports here. BoltLauncher.SetUdpPlatform(new SteamPlatform()); // Now Start BOLT with BoltLauncher.StartServer(); or BoltLauncher.StartClient(); if (activeLobby.IsOwner == true) { BoltLauncher.StartServer(new UdpEndPoint(UdpIPv4Address.Any, (ushort)serverPort)); } else { BoltLauncher.StartClient(); } // If you are the server, everything is done now. // If you are the client you need to connect to the Host by calling // BoltNetwork.Connect(lobbyGameServerSteamId.ToEndPoint()); //if (activeLobby.IsOwner == false) //{ // BoltNetwork.Connect(activeLobby.LobbyId.ToEndPoint()); //} }
public override void BoltStartBegin() { #if !BOLT_CLOUD BoltLauncher.SetUdpPlatform(new DotNetPlatform()); #endif }
private void Awake() { Application.targetFrameRate = 60; BoltLauncher.SetUdpPlatform(new PhotonPlatform()); }
protected override void Awake() { base.Awake(); BoltLauncher.SetUdpPlatform(new PhotonPlatform()); }